Class CommandPropagator

  • All Implemented Interfaces:
    java.lang.Runnable

    public class CommandPropagator
    extends java.lang.Object
    implements java.lang.Runnable

    Purpose: Synchronous and asynchronous propagation of remote commands

    Description: Maintains a reference to the RemoteCommandManager to obtain the connection information required to send the commands. In sync mode the caller is blocked until the command has been sent along all of the connections. If in async mode then a CommandPropagator instance is further created for each of the connections and control is returned to the caller while the threads send the command to the remote services.

    • Field Detail

      • command

        protected Command command
        The command to send
      • commandBytes

        protected byte[] commandBytes
        The command to send
    • Constructor Detail

      • CommandPropagator

        public CommandPropagator​(RemoteCommandManager rcm,
                                 Command command,
                                 byte[] commandBytes)
        Constructor used to create the main propagator
    • Method Detail

      • getRemoteCommandManager

        protected RemoteCommandManager getRemoteCommandManager()
        INTERNAL: Returns the remote command manager
      • getCommand

        protected Command getCommand()
        INTERNAL: Returns the command to be sent
      • synchronousPropagateCommand

        public void synchronousPropagateCommand()
        INTERNAL: Synchronously propagate the command
      • asynchronousPropagateCommand

        public void asynchronousPropagateCommand()
        INTERNAL: Asynchronously propagate the command
      • propagateCommand

        public void propagateCommand​(RemoteConnection connection)
        INTERNAL: Propagate the command to the specified connection.
      • handleExceptionFromRemoteExecution

        public void handleExceptionFromRemoteExecution​(RemoteConnection conn,
                                                       java.lang.String exString)
        INTERNAL: We received the specified exception String while executing the command over the specified connection. Turn it into a RemoteCommandManagerException and throw it on this, the client side.
      • handleCommunicationException

        public void handleCommunicationException​(RemoteConnection conn,
                                                 CommunicationException comEx)
        INTERNAL: We received the specified CommunicationException trying to execute the command over the specified connection. We treat CommunicationExceptions as the transport-generic wrapper exception that wraps the transport exception, so the real exception that interests us is inside.
      • run

        public void run()
        INTERNAL: This is the execution method of the async propagation thread. It will create other threads, one each for the remote connections, to propagate the command.
        Specified by:
        run in interface java.lang.Runnable