EclipseLink 1.2.0, build 'v20091016-r5565' API Reference

org.eclipse.persistence.sessions.coordination
Interface CommandManager

All Known Implementing Classes:
RemoteCommandManager

public interface CommandManager

Purpose: Provide an interface that clients can use to invoke remote commands on other EclipseLink instances, or on other applications that may want to receive and process EclipseLink commands.

Description: This is the main interface that is used to send and receive remote commands in a EclipseLink cluster. The sequence of remote command execution is as follows:

  1. CommandProcessor creates a command and gives it to its local CommandManager to send to remote services.
  2. CommandManager uses its CommandConverter to convert the command into a TopLink Command object
  3. CommandManager then uses its TransportManager to send the Command to all other known cluster members that are subscribing to the same channel
  4. Each remote TransportManager receives the Command and passes it off to the CommandManager
  5. Each CommandManager uses its local CommandConverter to convert the command into a format appropriate to its application (CommandProcessor)
  6. 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 EclipseLink session then the executeWithSession method will be invoked on the command.

Responsibilities:

See Also:
Command, CommandProcessor
Author:
Steven Vo
Since:
OracleAS TopLink 10g (9.0.4)

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 EclipseLink 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.
 boolean isCommandProcessorASession()
          ADVANCE: Return whether this commandProcessor is a EclipseLink session or not.
 void propagateCommand(java.lang.Object command)
          ADVANCED: Propagate a remote command to all remote RCM services participating in the EclipseLink 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 EclipseLink 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 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.
 void shutdown()
          PUBLIC: Shut down the remote command manager.
 

Method Detail

initialize

void initialize()
PUBLIC: Initialize the remote command manager. This will also trigger the DiscoveryManager to start establishing the EclipseLink cluster.


shutdown

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.


getUrl

java.lang.String getUrl()
PUBLIC: Return the URL for this command manager.

Returns:
The URL String for this CommandManager

setUrl

void setUrl(java.lang.String url)
ADVANCED: Set the URL for this command manager.

Parameters:
url - The URL String for this CommandManager

getChannel

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

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

void propagateCommand(java.lang.Object command)
ADVANCED: Propagate a remote command to all remote RCM services participating in the EclipseLink cluster.

Parameters:
command - An object representing a TopLink command

getCommandProcessor

CommandProcessor getCommandProcessor()
PUBLIC: Return the command processor that processes commands received from the cluster.

Returns:
An implementation instance of CommandProcessor

setCommandProcessor

void setCommandProcessor(CommandProcessor commandProcessor)
ADVANCED: Set the command processor that will be invoked to process commands. EclipseLink applications can implement this interface in order to receive remote commands from a EclipseLink cluster.

Parameters:
commandProcessor - The intended processor of remote commands

setTransportManager

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

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

DiscoveryManager getDiscoveryManager()
PUBLIC: Return the discovery manager that manages membership in the EclipseLink cluster.

Returns:
The DiscoveryManager instance being used by this CommandManager

getCommandConverter

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

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 EclipseLink Command objects before being propagated to remote command manager services. The converter will also be invoked to convert EclipseLink Command objects into application format before being sent to the CommandProcessor for execution.

Parameters:
commandConverter - The converter to be used by this CommandManager

shouldPropagateAsynchronously

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.


setShouldPropagateAsynchronously

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.


isCommandProcessorASession

boolean isCommandProcessorASession()
ADVANCE: Return whether this commandProcessor is a EclipseLink session or not.


EclipseLink 1.2.0, build 'v20091016-r5565' API Reference