Class WebObjectSocket

java.lang.Object
org.nustaq.kontraktor.remoting.websockets.WebObjectSocket
All Implemented Interfaces:
org.nustaq.kontraktor.remoting.base.ObjectSocket
Direct Known Subclasses:
HttpObjectSocket, JSR356ClientConnector.WSClientEndpoint, UndertowWebsocketServerConnector.UTWebObjectSocket

public abstract class WebObjectSocket
extends java.lang.Object
implements org.nustaq.kontraktor.remoting.base.ObjectSocket
Created by ruedi on 11/05/15. implements batching on a message-object level. This results in nice speed up and protocol compression, as serializing a batch of messages automatically strips double objects+strings.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected org.nustaq.serialization.FSTConfiguration conf  
    protected boolean isClosed  
    protected java.lang.Throwable lastError  
    protected java.util.List objects  
    protected java.util.concurrent.atomic.AtomicInteger sendSequence  
  • Constructor Summary

    Constructors 
    Constructor Description
    WebObjectSocket()  
  • Method Summary

    Modifier and Type Method Description
    void flush()  
    org.nustaq.serialization.FSTConfiguration getConf()  
    java.lang.Throwable getLastError()  
    protected int getObjectMaxBatchSize()  
    java.util.concurrent.atomic.AtomicInteger getSendSequence()  
    boolean isClosed()  
    abstract void sendBinary​(byte[] message)  
    void setConf​(org.nustaq.serialization.FSTConfiguration conf)  
    void setLastError​(java.lang.Throwable ex)  
    void writeObject​(java.lang.Object toWrite)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.nustaq.kontraktor.remoting.base.ObjectSocket

    canWrite, close, getConnectionIdentifier, getId
  • Field Details

    • objects

      protected java.util.List objects
    • conf

      protected org.nustaq.serialization.FSTConfiguration conf
    • lastError

      protected java.lang.Throwable lastError
    • sendSequence

      protected java.util.concurrent.atomic.AtomicInteger sendSequence
    • isClosed

      protected volatile boolean isClosed
  • Constructor Details

  • Method Details

    • getSendSequence

      public java.util.concurrent.atomic.AtomicInteger getSendSequence()
    • writeObject

      public void writeObject​(java.lang.Object toWrite) throws java.lang.Exception
      Specified by:
      writeObject in interface org.nustaq.kontraktor.remoting.base.ObjectSocket
      Throws:
      java.lang.Exception
    • getObjectMaxBatchSize

      protected int getObjectMaxBatchSize()
    • sendBinary

      public abstract void sendBinary​(byte[] message)
    • flush

      public void flush() throws java.lang.Exception
      Specified by:
      flush in interface org.nustaq.kontraktor.remoting.base.ObjectSocket
      Throws:
      java.lang.Exception
    • setLastError

      public void setLastError​(java.lang.Throwable ex)
      Specified by:
      setLastError in interface org.nustaq.kontraktor.remoting.base.ObjectSocket
    • getLastError

      public java.lang.Throwable getLastError()
      Specified by:
      getLastError in interface org.nustaq.kontraktor.remoting.base.ObjectSocket
    • setConf

      public void setConf​(org.nustaq.serialization.FSTConfiguration conf)
      Specified by:
      setConf in interface org.nustaq.kontraktor.remoting.base.ObjectSocket
    • getConf

      public org.nustaq.serialization.FSTConfiguration getConf()
      Specified by:
      getConf in interface org.nustaq.kontraktor.remoting.base.ObjectSocket
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface org.nustaq.kontraktor.remoting.base.ObjectSocket