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:
Runnable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate WebSocketFrameprivate booleanprivate final LinkedList<WebSocketFrame> private final PerMessageCompressionExtensionprivate booleanprivate booleanprivate static final intprivate static final intprivate static final intprivate static final intFields inherited from class com.neovisionaries.ws.client.WebSocketThread
mWebSocketFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate voiddoFlush()private voidflush()private longflushIfLongInterval(long lastFlushAt) private voidprivate booleanisFlushNeeded(boolean last) private static booleanprivate voidmain()private voidvoidbooleanqueueFrame(WebSocketFrame frame) voidvoidrunMain()private voidsendFrame(WebSocketFrame frame) private voidsendFrames(boolean last) private intMethods inherited from class com.neovisionaries.ws.client.WebSocketThread
callOnThreadCreated, runMethods 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 Details
-
SHOULD_SEND
private static final int SHOULD_SEND- See Also:
-
SHOULD_STOP
private static final int SHOULD_STOP- See Also:
-
SHOULD_CONTINUE
private static final int SHOULD_CONTINUE- See Also:
-
SHOULD_FLUSH
private static final int SHOULD_FLUSH- See Also:
-
FLUSH_THRESHOLD
private static final int FLUSH_THRESHOLD- See Also:
-
mFrames
-
mPMCE
-
mStopRequested
private boolean mStopRequested -
mCloseFrame
-
mFlushNeeded
private boolean mFlushNeeded -
mStopped
private boolean mStopped
-
-
Constructor Details
-
WritingThread
-
-
Method Details
-
runMain
public void runMain()- Specified by:
runMainin classWebSocketThread
-
main
private void main() -
requestStop
public void requestStop() -
queueFrame
-
isHighPriorityFrame
-
addHighPriorityFrame
-
queueFlush
public void queueFlush() -
flushIgnoreError
private void flushIgnoreError() -
flush
- Throws:
IOException
-
waitForFrames
private int waitForFrames() -
sendFrames
- Throws:
WebSocketException
-
isFlushNeeded
private boolean isFlushNeeded(boolean last) -
flushIfLongInterval
- Throws:
WebSocketException
-
doFlush
- Throws:
WebSocketException
-
sendFrame
- Throws:
WebSocketException
-
changeToClosing
private void changeToClosing() -
notifyFinished
private void notifyFinished()
-