Package org.teamapps.cluster.core
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 intMAX_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 voidclose()java.io.FilegetFile(java.lang.String fileId)java.lang.StringhandleFile(java.io.File file)protected voidhandleSocket(java.net.Socket socket)booleanisConnected()longlastMessageTimestamp()longreceivedBytes()longsendBytes()voidsendKeepAlive()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
MAX_MESSAGE_SIZE
public static final int MAX_MESSAGE_SIZE- See Also:
- Constant Field Values
-
-
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:
isConnectedin interfaceConnection
-
close
public void close()- Specified by:
closein interfaceConnection
-
lastMessageTimestamp
public long lastMessageTimestamp()- Specified by:
lastMessageTimestampin interfaceConnection
-
sendBytes
public long sendBytes()- Specified by:
sendBytesin interfaceConnection
-
receivedBytes
public long receivedBytes()- Specified by:
receivedBytesin interfaceConnection
-
sendKeepAlive
public void sendKeepAlive()- Specified by:
sendKeepAlivein interfaceConnection
-
getFile
public java.io.File getFile(java.lang.String fileId)- Specified by:
getFilein interfaceorg.teamapps.protocol.file.FileProvider
-
handleFile
public java.lang.String handleFile(java.io.File file) throws java.io.IOException- Specified by:
handleFilein interfaceorg.teamapps.protocol.file.FileSink- Throws:
java.io.IOException
-