Class CommandPropagator
- java.lang.Object
-
- org.eclipse.persistence.internal.sessions.coordination.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 Summary
Fields Modifier and Type Field Description protected Command
command
The command to sendprotected byte[]
commandBytes
The command to sendprotected RemoteConnection
connection
Connection to send toprotected RemoteCommandManager
rcm
Reference to manager to get connections, etc.
-
Constructor Summary
Constructors Constructor Description CommandPropagator(RemoteCommandManager rcm, Command command, byte[] commandBytes)
Constructor used to create the main propagatorCommandPropagator(RemoteCommandManager rcm, Command command, byte[] commandBytes, RemoteConnection connection)
Constructor used to create the async propagator threads
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
asynchronousPropagateCommand()
INTERNAL: Asynchronously propagate the commandprotected Command
getCommand()
INTERNAL: Returns the command to be sentprotected RemoteCommandManager
getRemoteCommandManager()
INTERNAL: Returns the remote command managervoid
handleCommunicationException(RemoteConnection conn, CommunicationException comEx)
INTERNAL: We received the specified CommunicationException trying to execute the command over the specified connection.void
handleExceptionFromRemoteExecution(RemoteConnection conn, java.lang.String exString)
INTERNAL: We received the specified exception String while executing the command over the specified connection.void
propagateCommand(RemoteConnection connection)
INTERNAL: Propagate the command to the specified connection.void
run()
INTERNAL: This is the execution method of the async propagation thread.void
synchronousPropagateCommand()
INTERNAL: Synchronously propagate the command
-
-
-
Field Detail
-
rcm
protected RemoteCommandManager rcm
Reference to manager to get connections, etc.
-
command
protected Command command
The command to send
-
commandBytes
protected byte[] commandBytes
The command to send
-
connection
protected RemoteConnection connection
Connection to send to
-
-
Constructor Detail
-
CommandPropagator
public CommandPropagator(RemoteCommandManager rcm, Command command, byte[] commandBytes)
Constructor used to create the main propagator
-
CommandPropagator
public CommandPropagator(RemoteCommandManager rcm, Command command, byte[] commandBytes, RemoteConnection connection)
Constructor used to create the async propagator threads
-
-
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 interfacejava.lang.Runnable
-
-