Class HttpObjectSocket
java.lang.Object
org.nustaq.kontraktor.remoting.websockets.WebObjectSocket
org.nustaq.kontraktor.remoting.http.HttpObjectSocket
- All Implemented Interfaces:
org.nustaq.kontraktor.remoting.base.ObjectSink,org.nustaq.kontraktor.remoting.base.ObjectSocket
public class HttpObjectSocket extends WebObjectSocket implements org.nustaq.kontraktor.remoting.base.ObjectSink
Created by ruedi on 12.05.2015.
bidirectional http longpoll based objectsocket backed by a binary queue.
-
Field Summary
Fields Modifier and Type Field Description static intHISTORY_SIZEstatic intHTTP_BATCH_SIZEstatic intLP_TIMEOUTFields inherited from class org.nustaq.kontraktor.remoting.websockets.WebObjectSocket
conf, isClosed, lastError, objects, sendSequence -
Constructor Summary
Constructors Constructor Description HttpObjectSocket(java.lang.String sessionId, java.lang.Runnable closeAction) -
Method Summary
Modifier and Type Method Description voidcancelLongPoll()protected voidcheckThread()voidclose()voidflush()java.lang.StringgetConnectionIdentifier()intgetId()longgetLastRemoteCallMS()longgetLastUse()org.nustaq.kontraktor.util.Pair<java.lang.Runnable,KHttpExchange>getLongPollTask()longgetLongPollTaskTime()org.nustaq.kontraktor.util.Pair<byte[],java.lang.Integer>getNextQueuedMessage()java.lang.StringgetSessionId()org.nustaq.kontraktor.remoting.base.ObjectSinkgetSink()voidreceiveObject(org.nustaq.kontraktor.remoting.base.ObjectSink asink, java.lang.Object received, java.util.List<org.nustaq.kontraktor.IPromise> createdFutures, java.lang.Object securityContext)voidsendBinary(byte[] message)voidsetLongPollTask(org.nustaq.kontraktor.util.Pair<java.lang.Runnable,KHttpExchange> longPollTask)voidsetSink(org.nustaq.kontraktor.remoting.base.ObjectSink sink)voidsinkClosed()voidstoreLPMessage(int inSequence, java.lang.Object msg)java.lang.ObjecttakeStoredLPMessage(int seq)voidtriggerLongPoll()voidupdateLastRemoteCallTimeStamp()voidupdateTimeStamp()voidwriteObject(java.lang.Object toWrite)Methods inherited from class org.nustaq.kontraktor.remoting.websockets.WebObjectSocket
getConf, getLastError, getObjectMaxBatchSize, getSendSequence, isClosed, setConf, setLastError
-
Field Details
-
LP_TIMEOUT
public static int LP_TIMEOUT -
HISTORY_SIZE
public static int HISTORY_SIZE -
HTTP_BATCH_SIZE
public static int HTTP_BATCH_SIZE
-
-
Constructor Details
-
HttpObjectSocket
public HttpObjectSocket(java.lang.String sessionId, java.lang.Runnable closeAction)
-
-
Method Details
-
getSessionId
public java.lang.String getSessionId() -
updateTimeStamp
public void updateTimeStamp() -
updateLastRemoteCallTimeStamp
public void updateLastRemoteCallTimeStamp() -
getLastRemoteCallMS
public long getLastRemoteCallMS() -
getLastUse
public long getLastUse() -
sendBinary
public void sendBinary(byte[] message)- Specified by:
sendBinaryin classWebObjectSocket
-
writeObject
public void writeObject(java.lang.Object toWrite) throws java.lang.Exception- Specified by:
writeObjectin interfaceorg.nustaq.kontraktor.remoting.base.ObjectSocket- Overrides:
writeObjectin classWebObjectSocket- Throws:
java.lang.Exception
-
close
public void close() throws java.io.IOException- Specified by:
closein interfaceorg.nustaq.kontraktor.remoting.base.ObjectSocket- Throws:
java.io.IOException
-
getId
public int getId()- Specified by:
getIdin interfaceorg.nustaq.kontraktor.remoting.base.ObjectSocket
-
getConnectionIdentifier
public java.lang.String getConnectionIdentifier()- Specified by:
getConnectionIdentifierin interfaceorg.nustaq.kontraktor.remoting.base.ObjectSocket
-
setSink
public void setSink(org.nustaq.kontraktor.remoting.base.ObjectSink sink) -
getSink
public org.nustaq.kontraktor.remoting.base.ObjectSink getSink() -
getNextQueuedMessage
public org.nustaq.kontraktor.util.Pair<byte[],java.lang.Integer> getNextQueuedMessage() -
checkThread
protected void checkThread() -
getLongPollTask
-
cancelLongPoll
public void cancelLongPoll() -
triggerLongPoll
public void triggerLongPoll() -
setLongPollTask
public void setLongPollTask(org.nustaq.kontraktor.util.Pair<java.lang.Runnable,KHttpExchange> longPollTask) -
getLongPollTaskTime
public long getLongPollTaskTime() -
receiveObject
public void receiveObject(org.nustaq.kontraktor.remoting.base.ObjectSink asink, java.lang.Object received, java.util.List<org.nustaq.kontraktor.IPromise> createdFutures, java.lang.Object securityContext)- Specified by:
receiveObjectin interfaceorg.nustaq.kontraktor.remoting.base.ObjectSink
-
sinkClosed
public void sinkClosed()- Specified by:
sinkClosedin interfaceorg.nustaq.kontraktor.remoting.base.ObjectSink
-
takeStoredLPMessage
public java.lang.Object takeStoredLPMessage(int seq) -
storeLPMessage
public void storeLPMessage(int inSequence, java.lang.Object msg) -
flush
public void flush() throws java.lang.Exception- Specified by:
flushin interfaceorg.nustaq.kontraktor.remoting.base.ObjectSocket- Overrides:
flushin classWebObjectSocket- Throws:
java.lang.Exception
-