org.sapia.ubik.rmi.server.command
Class CommandProcessor

java.lang.Object
  extended by org.sapia.ubik.rmi.server.command.CommandProcessor
Direct Known Subclasses:
RMICommandProcessor

public class CommandProcessor
extends java.lang.Object

An instance of this class serves as an entry-point for command objects.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Constructor Summary
CommandProcessor(int maxThreads)
          Constructor for CommandProcessor.
 
Method Summary
 void processAsyncCommand(java.lang.String cmdId, VmId caller, ServerAddress from, Command cmd)
          Processes the given command asynchronously.
 java.lang.Object processSyncCommand(Command cmd)
          Processes this command in the same thread as the caller's.
 void setResponseSender(ResponseSender sender)
          Sets this processor's "response sender".
 void shutdown(long timeout)
          Shuts down this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandProcessor

public CommandProcessor(int maxThreads)
                 throws java.lang.IllegalStateException
Constructor for CommandProcessor.

Throws:
java.lang.IllegalStateException
Method Detail

processSyncCommand

public java.lang.Object processSyncCommand(Command cmd)
Processes this command in the same thread as the caller's.

Parameters:
cmd - a Command.
Returns:
the passed in command return value.

processAsyncCommand

public void processAsyncCommand(java.lang.String cmdId,
                                VmId caller,
                                ServerAddress from,
                                Command cmd)
Processes the given command asynchronously.

Parameters:
cmdId - a command's unique identifier.
from - the ServerAddress from which this command originates.
cmd - the command to execute.

setResponseSender

public void setResponseSender(ResponseSender sender)
Sets this processor's "response sender". A response sender is, as the name implies, in charge of returing a command's return value to the originator of the command.

Parameters:
a - ResponseSender.

shutdown

public void shutdown(long timeout)
              throws java.lang.InterruptedException
Shuts down this instance. Blocks until no commands are left to execute, or until the given timeout is reached.

This method also internally calls shutdownAll() on the OutQueue singleton.

Parameters:
timeout - a timout, in millis.
Throws:
java.lang.InterruptedException - if the calling thread is interrupted while blocking within this method.


Copyright © 2010 Sapia OSS. All Rights Reserved.