Class NetworkConnection

java.lang.Object
org.teamapps.cluster.core.NetworkConnection
All Implemented Interfaces:
Connection, org.teamapps.protocol.file.FileProvider, org.teamapps.protocol.file.FileSink

public class NetworkConnection
extends java.lang.Object
implements Connection
  • Field Summary

    Fields
    Modifier and Type Field Description
    static int MAX_MESSAGE_SIZE  
  • Constructor Summary

    Constructors
    Constructor Description
    NetworkConnection​(java.net.Socket socket, MessageQueue messageQueue, ConnectionHandler connectionHandler, org.teamapps.protocol.schema.ModelRegistry modelRegistry, java.io.File tempDir, java.lang.String clusterSecret)  
    NetworkConnection​(HostAddress hostAddress, MessageQueue messageQueue, ConnectionHandler connectionHandler, org.teamapps.protocol.schema.ModelRegistry modelRegistry, java.io.File tempDir, java.lang.String clusterSecret)  
  • Method Summary

    Modifier and Type Method Description
    void close()  
    java.io.File getFile​(java.lang.String fileId)  
    java.lang.String handleFile​(java.io.File file)  
    protected void handleSocket​(java.net.Socket socket)  
    boolean isConnected()  
    long lastMessageTimestamp()  
    long receivedBytes()  
    long sendBytes()  
    void sendKeepAlive()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • NetworkConnection

      public NetworkConnection​(java.net.Socket socket, MessageQueue messageQueue, ConnectionHandler connectionHandler, org.teamapps.protocol.schema.ModelRegistry modelRegistry, java.io.File tempDir, java.lang.String clusterSecret)
    • NetworkConnection

      public NetworkConnection​(HostAddress hostAddress, MessageQueue messageQueue, ConnectionHandler connectionHandler, org.teamapps.protocol.schema.ModelRegistry modelRegistry, java.io.File tempDir, java.lang.String clusterSecret)
  • Method Details

    • handleSocket

      protected void handleSocket​(java.net.Socket socket)
    • isConnected

      public boolean isConnected()
      Specified by:
      isConnected in interface Connection
    • close

      public void close()
      Specified by:
      close in interface Connection
    • lastMessageTimestamp

      public long lastMessageTimestamp()
      Specified by:
      lastMessageTimestamp in interface Connection
    • sendBytes

      public long sendBytes()
      Specified by:
      sendBytes in interface Connection
    • receivedBytes

      public long receivedBytes()
      Specified by:
      receivedBytes in interface Connection
    • sendKeepAlive

      public void sendKeepAlive()
      Specified by:
      sendKeepAlive in interface Connection
    • getFile

      public java.io.File getFile​(java.lang.String fileId)
      Specified by:
      getFile in interface org.teamapps.protocol.file.FileProvider
    • handleFile

      public java.lang.String handleFile​(java.io.File file) throws java.io.IOException
      Specified by:
      handleFile in interface org.teamapps.protocol.file.FileSink
      Throws:
      java.io.IOException