Class ServerCommunicationSystem

  • All Implemented Interfaces:
    java.lang.Runnable

    public class ServerCommunicationSystem
    extends java.lang.Thread
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • 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
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 interface java.lang.Runnable
        Overrides:
        run in class java.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 message
        sm - the message to be sent
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Thread
      • shutdown

        public void shutdown()
      • getSecretKey

        public javax.crypto.SecretKey getSecretKey​(int id)