public class BufferedIoOutputStream extends AbstractInnerCloseable implements IoOutputStream
IoOutputStream capable of queuing write requestsAbstractCloseable.State| Modifier and Type | Field and Description |
|---|---|
protected AtomicReference<IoWriteFutureImpl> |
currentWrite |
protected Object |
id |
protected IoOutputStream |
out |
protected Queue<IoWriteFutureImpl> |
writes |
closeFuture, lock, statelogCLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT| Constructor and Description |
|---|
BufferedIoOutputStream(Object id,
IoOutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
Object |
getId() |
protected Closeable |
getInnerCloseable() |
protected void |
startWriting() |
String |
toString() |
IoWriteFuture |
writePacket(Buffer buffer)
Encode and send the given buffer.
|
doCloseGracefully, doCloseImmediatelyaddCloseFutureListener, builder, close, isClosed, isClosing, preClose, removeCloseFutureListenergetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenerprotected final IoOutputStream out
protected final Queue<IoWriteFutureImpl> writes
protected final AtomicReference<IoWriteFutureImpl> currentWrite
protected final Object id
public BufferedIoOutputStream(Object id, IoOutputStream out)
public Object getId()
public IoWriteFuture writePacket(Buffer buffer) throws IOException
PacketWriterwritePacket in interface PacketWriterbuffer - the buffer to encode and send. NOTE: the buffer must not be touched
until the returned write future is completed.IoWriteFuture that can be used to check when the packet has actually been sentIOException - if an error occurred when encoding sending the packetprotected void startWriting()
throws IOException
IOExceptionprotected Closeable getInnerCloseable()
getInnerCloseable in class AbstractInnerCloseableCopyright © 2008–2021 The Apache Software Foundation. All rights reserved.