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(String sessionId, Runnable closeAction) -
Method Summary
Modifier and Type Method Description voidcancelLongPoll()protected voidcheckThread()voidclose()voidflush()StringgetConnectionIdentifier()intgetId()longgetLastRemoteCallMS()longgetLastUse()org.nustaq.kontraktor.util.Pair<Runnable,KHttpExchange>getLongPollTask()longgetLongPollTaskTime()org.nustaq.kontraktor.util.Pair<byte[],Integer>getNextQueuedMessage()StringgetSessionId()org.nustaq.kontraktor.remoting.base.ObjectSinkgetSink()voidreceiveObject(org.nustaq.kontraktor.remoting.base.ObjectSink asink, Object received, List<org.nustaq.kontraktor.IPromise> createdFutures, Object securityContext)voidsendBinary(byte[] message)voidsetLongPollTask(org.nustaq.kontraktor.util.Pair<Runnable,KHttpExchange> longPollTask)voidsetSink(org.nustaq.kontraktor.remoting.base.ObjectSink sink)voidsinkClosed()voidstoreLPMessage(int inSequence, Object msg)ObjecttakeStoredLPMessage(int seq)voidtriggerLongPoll()voidupdateLastRemoteCallTimeStamp()voidupdateTimeStamp()voidwriteObject(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
-
Method Details
-
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
- Specified by:
writeObjectin interfaceorg.nustaq.kontraktor.remoting.base.ObjectSocket- Overrides:
writeObjectin classWebObjectSocket- Throws:
Exception
-
close
- Specified by:
closein interfaceorg.nustaq.kontraktor.remoting.base.ObjectSocket- Throws:
IOException
-
getId
public int getId()- Specified by:
getIdin interfaceorg.nustaq.kontraktor.remoting.base.ObjectSocket
-
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
-
checkThread
protected void checkThread() -
getLongPollTask
-
cancelLongPoll
public void cancelLongPoll() -
triggerLongPoll
public void triggerLongPoll() -
setLongPollTask
-
getLongPollTaskTime
public long getLongPollTaskTime() -
receiveObject
public void receiveObject(org.nustaq.kontraktor.remoting.base.ObjectSink asink, Object received, List<org.nustaq.kontraktor.IPromise> createdFutures, 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
-
storeLPMessage
-
flush
- Specified by:
flushin interfaceorg.nustaq.kontraktor.remoting.base.ObjectSocket- Overrides:
flushin classWebObjectSocket- Throws:
Exception
-