Package com.neovisionaries.ws.client
Class WritingThread
- java.lang.Object
-
- java.lang.Thread
-
- com.neovisionaries.ws.client.WebSocketThread
-
- com.neovisionaries.ws.client.WritingThread
-
- All Implemented Interfaces:
java.lang.Runnable
class WritingThread extends WebSocketThread
-
-
Field Summary
Fields Modifier and Type Field Description private static intFLUSH_THRESHOLDprivate WebSocketFramemCloseFrameprivate booleanmFlushNeededprivate java.util.LinkedList<WebSocketFrame>mFramesprivate PerMessageCompressionExtensionmPMCEprivate booleanmStoppedprivate booleanmStopRequestedprivate static intSHOULD_CONTINUEprivate static intSHOULD_FLUSHprivate static intSHOULD_SENDprivate static intSHOULD_STOP-
Fields inherited from class com.neovisionaries.ws.client.WebSocketThread
mWebSocket
-
-
Constructor Summary
Constructors Constructor Description WritingThread(WebSocket websocket)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddHighPriorityFrame(WebSocketFrame frame)private voidchangeToClosing()private voiddoFlush()private voidflush()private longflushIfLongInterval(long lastFlushAt)private voidflushIgnoreError()private booleanisFlushNeeded(boolean last)private static booleanisHighPriorityFrame(WebSocketFrame frame)private voidmain()private voidnotifyFinished()voidqueueFlush()booleanqueueFrame(WebSocketFrame frame)voidrequestStop()voidrunMain()private voidsendFrame(WebSocketFrame frame)private voidsendFrames(boolean last)private intwaitForFrames()-
Methods inherited from class com.neovisionaries.ws.client.WebSocketThread
callOnThreadCreated, run
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
SHOULD_SEND
private static final int SHOULD_SEND
- See Also:
- Constant Field Values
-
SHOULD_STOP
private static final int SHOULD_STOP
- See Also:
- Constant Field Values
-
SHOULD_CONTINUE
private static final int SHOULD_CONTINUE
- See Also:
- Constant Field Values
-
SHOULD_FLUSH
private static final int SHOULD_FLUSH
- See Also:
- Constant Field Values
-
FLUSH_THRESHOLD
private static final int FLUSH_THRESHOLD
- See Also:
- Constant Field Values
-
mFrames
private final java.util.LinkedList<WebSocketFrame> mFrames
-
mPMCE
private final PerMessageCompressionExtension mPMCE
-
mStopRequested
private boolean mStopRequested
-
mCloseFrame
private WebSocketFrame mCloseFrame
-
mFlushNeeded
private boolean mFlushNeeded
-
mStopped
private boolean mStopped
-
-
Constructor Detail
-
WritingThread
public WritingThread(WebSocket websocket)
-
-
Method Detail
-
runMain
public void runMain()
- Specified by:
runMainin classWebSocketThread
-
main
private void main()
-
requestStop
public void requestStop()
-
queueFrame
public boolean queueFrame(WebSocketFrame frame)
-
isHighPriorityFrame
private static boolean isHighPriorityFrame(WebSocketFrame frame)
-
addHighPriorityFrame
private void addHighPriorityFrame(WebSocketFrame frame)
-
queueFlush
public void queueFlush()
-
flushIgnoreError
private void flushIgnoreError()
-
flush
private void flush() throws java.io.IOException- Throws:
java.io.IOException
-
waitForFrames
private int waitForFrames()
-
sendFrames
private void sendFrames(boolean last) throws WebSocketException- Throws:
WebSocketException
-
isFlushNeeded
private boolean isFlushNeeded(boolean last)
-
flushIfLongInterval
private long flushIfLongInterval(long lastFlushAt) throws WebSocketException- Throws:
WebSocketException
-
doFlush
private void doFlush() throws WebSocketException- Throws:
WebSocketException
-
sendFrame
private void sendFrame(WebSocketFrame frame) throws WebSocketException
- Throws:
WebSocketException
-
changeToClosing
private void changeToClosing()
-
notifyFinished
private void notifyFinished()
-
-