oracle.toplink.remotecommand
Interface CommandManager
- All Known Implementing Classes:
- RemoteCommandManager
- public interface CommandManager
Purpose: Provide an interface that clients can use to invoke remote commands on other TopLink instances, or on other applications that may want to receive and process TopLink commands.
Description: This is the main interface that is used to send and receive remote commands in a TopLink cluster. The sequence of remote command execution is as follows:
- CommandProcessor creates a command and gives it to its local CommandManager to send to remote services.
- CommandManager uses its CommandConverter to convert the command into a TopLink Command object
- CommandManager then uses its TransportManager to send the Command to all other known cluster members that are subscribing to the same channel
- Each remote TransportManager receives the Command and passes it off to the CommandManager
- Each CommandManager uses its local CommandConverter to convert the command into a format appropriate to its application (CommandProcessor)
- Each CommandManager invokes its local CommandProcessor and passes it the command (formatted the way that the application-specified converter left it in) to be executed. If the CommandProcessor is a TopLink session then the executeWithSession method will be invoked on the command.
Responsibilities:
- Invoke the DiscoveryManager to establish the TopLink cluster
- Propagate remote command to TopLink cluster
- Delegate processing command to its CommandProssesor
- Convert command to appropriate format for sending to TopLink cluster or its command processor
- Since:
- OracleAS TopLink 10g (9.0.4)
- See Also:
Command
, CommandProcessor
Method Summary |
java.lang.String |
getChannel()
PUBLIC: Return the service channel for this command manager. |
CommandConverter |
getCommandConverter()
PUBLIC: Return the converter instance used to convert between TopLink Command objects and an application command format. |
CommandProcessor |
getCommandProcessor()
PUBLIC: Return the command processor that processes commands received from the cluster. |
DiscoveryManager |
getDiscoveryManager()
PUBLIC: Return the discovery manager that manages membership in the TopLink cluster. |
TransportManager |
getTransportManager()
PUBLIC: Return the transport manager that manages sending and receiving of remote commands. |
java.lang.String |
getUrl()
PUBLIC: Return the URL for this command manager. |
void |
initialize()
PUBLIC: Initialize the remote command manager. |
void |
propagateCommand(java.lang.Object command)
ADVANCED: Propagate a remote command to all remote RCM services participating in the TopLink cluster. |
void |
setChannel(java.lang.String channel)
ADVANCED: Set the service channel for this command manager. |
void |
setCommandConverter(CommandConverter commandConverter)
ADVANCED: Set the converter instance that will be invoked by this CommandProcessor to convert commands from their application command format into TopLink Command objects before being propagated to remote command manager services. |
void |
setCommandProcessor(CommandProcessor commandProcessor)
ADVANCED: Set the command processor that will be invoked to process commands. |
void |
setShouldPropagateAsynchronously(boolean asyncMode)
ADVANCED: Set whether this command manager should propagate commands synchronously or asynchronously. |
void |
setShouldRemoveConnectionOnError(boolean removeOnError)
PUBLIC: Set whether connections to remote services should be disconnected when a communications error occurs. |
void |
setTransportManager(TransportManager newTransportManager)
ADVANCED: Set a specific transport manager to manage sending and receiving of remote commands. |
void |
setUrl(java.lang.String url)
ADVANCED: Set the URL for this command manager. |
boolean |
shouldPropagateAsynchronously()
PUBLIC: Return whether this command manager should propagate commands synchronously or asynchronously. |
boolean |
shouldRemoveConnectionOnError()
PUBLIC: Set whether connections to remote services should be disconnected when a communications error occurs. |
void |
shutdown()
PUBLIC: Shut down the remote command manager. |
initialize
public void initialize()
- PUBLIC: Initialize the remote command manager. This will also trigger the DiscoveryManager to start establishing the TopLink cluster.
shutdown
public void shutdown()
- PUBLIC: Shut down the remote command manager. This will also trigger the DiscoveryManager to stop. NOTE: Although this call initiates the shutdown process, no guarantees are made as to when it will actually complete.
shouldPropagateAsynchronously
public boolean shouldPropagateAsynchronously()
- PUBLIC: Return whether this command manager should propagate commands synchronously or asynchronously. If set to synchronous propagation then propagateCommand() will not return to the caller until the command has been executed on all of the services in the cluster. In asynchronous mode the command manager will create a separate thread for each of the remote service executions, and then promptly return to the caller.
-
- Returns:
- True if asynchronous mode enabled, false if synchronous propagation will occur (default is true)
setShouldPropagateAsynchronously
public void setShouldPropagateAsynchronously(boolean asyncMode)
- ADVANCED: Set whether this command manager should propagate commands synchronously or asynchronously. If set to synchronous propagation then propagateCommand() will not return to the caller until the command has been executed on all of the services in the cluster. In asynchronous mode the command manager will create a separate thread for each of the remote service executions, and then promptly return to the caller.
-
- Parameters:
asyncMode
- True if asynchronous mode enabled, false if synchronous propagation will occur (default is true)
setShouldRemoveConnectionOnError
public void setShouldRemoveConnectionOnError(boolean removeOnError)
- PUBLIC: Set whether connections to remote services should be disconnected when a communications error occurs. If set to true then connections will be dropped but will not be thrown. If set to false then the connections will not be dropped when an error occurs, but the exception will be thrown.
-
- Parameters:
removeOnError
- True if connections are to be transparently removed by the RCM, false if the exception should be thrown instead.
shouldRemoveConnectionOnError
public boolean shouldRemoveConnectionOnError()
- PUBLIC: Set whether connections to remote services should be disconnected when a communications error occurs. If set to true then connections will be dropped but will not be thrown. If set to false then the connections will not be dropped when an error occurs, but the exception will be thrown.
-
- Returns:
- Return true if connections will be transparently removed by the RCM, or false if the exception will be thrown instead.
getUrl
public java.lang.String getUrl()
- PUBLIC: Return the URL for this command manager.
-
- Returns:
- The URL String for this CommandManager
setUrl
public void setUrl(java.lang.String url)
- ADVANCED: Set the URL for this command manager.
-
- Parameters:
url
- The URL String for this CommandManager
getChannel
public java.lang.String getChannel()
- PUBLIC: Return the service channel for this command manager. All command managers with the same service channel will send and receive commands from each other. Commands sent on other service channels will not be exchanged with this command manager.
-
- Returns:
- The service channel String subscribed to by this CommandManager
setChannel
public void setChannel(java.lang.String channel)
- ADVANCED: Set the service channel for this command manager. All command managers with the same service channel will send and receive commands from each other. Commands sent on other service channels will not be exchanged with this command manager.
-
- Parameters:
channel
- The service channel subscribed to by this CommandManager
propagateCommand
public void propagateCommand(java.lang.Object command)
- ADVANCED: Propagate a remote command to all remote RCM services participating in the TopLink cluster.
-
- Parameters:
command
- An object representing a TopLink command
getCommandProcessor
public CommandProcessor getCommandProcessor()
- PUBLIC: Return the command processor that processes commands received from the cluster.
-
- Returns:
- An implementation instance of CommandProcessor
setCommandProcessor
public void setCommandProcessor(CommandProcessor commandProcessor)
- ADVANCED: Set the command processor that will be invoked to process commands. Non-TopLink applications can implement this interface in order to receive remote commands from a TopLink cluster.
-
- Parameters:
commandProcessor
- The intended processor of remote commands
setTransportManager
public void setTransportManager(TransportManager newTransportManager)
- ADVANCED: Set a specific transport manager to manage sending and receiving of remote commands.
-
- Parameters:
newTransportManager
- An instance of the desired transport manager type
getTransportManager
public TransportManager getTransportManager()
- PUBLIC: Return the transport manager that manages sending and receiving of remote commands.
-
- Returns:
- The TransportManager instance being used by this CommandManager
getDiscoveryManager
public DiscoveryManager getDiscoveryManager()
- PUBLIC: Return the discovery manager that manages membership in the TopLink cluster.
-
- Returns:
- The DiscoveryManager instance being used by this CommandManager
getCommandConverter
public CommandConverter getCommandConverter()
- PUBLIC: Return the converter instance used to convert between TopLink Command objects and an application command format.
-
- Returns:
- The converter being used by this CommandManager
setCommandConverter
public void setCommandConverter(CommandConverter commandConverter)
- ADVANCED: Set the converter instance that will be invoked by this CommandProcessor to convert commands from their application command format into TopLink Command objects before being propagated to remote command manager services. The converter will also be invoked to convert TopLink Command objects into application format before being sent to the CommandProcessor for execution.
-
- Parameters:
commandConverter
- The converter to be used by this CommandManager