java.lang.Object
net.i2p.sam.SAMStreamSession.StreamSender
net.i2p.sam.SAMStreamSession.V1StreamSender
- All Implemented Interfaces:
Runnable
- Enclosing class:
SAMStreamSession
SAM V1 stream session sender.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteCacheByte cache for packet buffers.Pending outbound data buffers.private final OutputStreamOutput stream for the I2P socket.private booleanShutting down gracefully.private booleanStill running.private final ObjectLock for sender running state.Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionvoidrun()Writes queued payloads to the peer until the sender is stopped.voidsendBytes(InputStream in, int size) Send bytes through the SAM STREAM session socket sender.voidStop a SAM STREAM session socket sender gracefully: stop the sender thread once all pending data has been sent.voidStop a SAM STREAM session socket sender thread immediately.
Field Details
_data
_cache
Byte cache for packet buffers._out
Output stream for the I2P socket._stillRunning
private volatile boolean _stillRunningStill running._shuttingDownGracefully
private volatile boolean _shuttingDownGracefullyShutting down gracefully.runningLock
Lock for sender running state.
Constructor Details
V1StreamSender
V1StreamSender.- Parameters:
s- the socket to send stream data overid- the connection's handler id- Throws:
IOException- if the socket's output stream cannot be opened
Method Details
sendBytes
Send bytes through the SAM STREAM session socket sender.- Specified by:
sendBytesin classSAMStreamSession.StreamSender- Parameters:
in- Data input streamsize- Count of bytes to send- Throws:
IOException- if the client didnt provide enough data
stopRunning
public void stopRunning()Stop a SAM STREAM session socket sender thread immediately.- Specified by:
stopRunningin classSAMStreamSession.StreamSender
shutDownGracefully
public void shutDownGracefully()Stop a SAM STREAM session socket sender gracefully: stop the sender thread once all pending data has been sent.- Specified by:
shutDownGracefullyin classSAMStreamSession.StreamSender
run
public void run()Writes queued payloads to the peer until the sender is stopped.- Specified by:
runin interfaceRunnable- Specified by:
runin classSAMStreamSession.StreamSender