Package bftsmart.communication
Class ServerCommunicationSystem
- java.lang.Object
-
- java.lang.Thread
-
- bftsmart.communication.ServerCommunicationSystem
-
- All Implemented Interfaces:
java.lang.Runnable
public class ServerCommunicationSystem extends java.lang.Thread
-
-
Field Summary
Fields Modifier and Type Field Description long
MESSAGE_WAIT_TIME
protected MessageHandler
messageHandler
-
Constructor Summary
Constructors Constructor Description ServerCommunicationSystem(ServerViewController controller, ServiceReplica replica)
Creates a new instance of ServerCommunicationSystem
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CommunicationSystemServerSide
getClientsConn()
javax.crypto.SecretKey
getSecretKey(int id)
ServersCommunicationLayer
getServersConn()
void
joinViewReceived()
void
run()
Thread method responsible for receiving messages sent by other servers.void
send(int[] targets, SystemMessage sm)
Send a message to target processes.void
setAcceptor(Acceptor acceptor)
void
setRequestReceiver(RequestReceiver requestReceiver)
void
setTOMLayer(TOMLayer tomLayer)
void
shutdown()
java.lang.String
toString()
void
updateServersConnections()
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
-
-
-
Field Detail
-
MESSAGE_WAIT_TIME
public final long MESSAGE_WAIT_TIME
- See Also:
- Constant Field Values
-
messageHandler
protected MessageHandler messageHandler
-
-
Constructor Detail
-
ServerCommunicationSystem
public ServerCommunicationSystem(ServerViewController controller, ServiceReplica replica) throws java.lang.Exception
Creates a new instance of ServerCommunicationSystem- Throws:
java.lang.Exception
-
-
Method Detail
-
joinViewReceived
public void joinViewReceived()
-
updateServersConnections
public void updateServersConnections()
-
setAcceptor
public void setAcceptor(Acceptor acceptor)
-
setTOMLayer
public void setTOMLayer(TOMLayer tomLayer)
-
setRequestReceiver
public void setRequestReceiver(RequestReceiver requestReceiver)
-
run
public void run()
Thread method responsible for receiving messages sent by other servers.- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
send
public void send(int[] targets, SystemMessage sm)
Send a message to target processes. If the message is an instance of TOMMessage, it is sent to the clients, otherwise it is set to the servers.- Parameters:
targets
- the target receivers of the messagesm
- the message to be sent
-
getServersConn
public ServersCommunicationLayer getServersConn()
-
getClientsConn
public CommunicationSystemServerSide getClientsConn()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Thread
-
shutdown
public void shutdown()
-
getSecretKey
public javax.crypto.SecretKey getSecretKey(int id)
-
-