com.sun.enterprise.v3.admin.cluster
Class CommandRunnable

java.lang.Object
  extended by com.sun.enterprise.v3.admin.cluster.CommandRunnable
All Implemented Interfaces:
java.lang.Runnable

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

This class wraps a CommandInvocation so that it can be run via a thread pool. On construction you pass it the CommandInvocation to execute as well as a response queue and the ActionReport that was set on the CommandInvocation. When the run() method is called the CommandInvocation is executed (which sets its results in the ActionReport) and then it adds itself to the response queue where it can be picked up and the ActionReport inspected for the results.

Author:
dipol

Constructor Summary
CommandRunnable(CommandRunner.CommandInvocation ci, ActionReport report, java.util.concurrent.BlockingQueue<CommandRunnable> q)
          Construct a CommandRunnable.
 
Method Summary
 ActionReport getActionReport()
          Returns the ActionReport that was passed on the constructor.
 CommandRunner.CommandInvocation getCommandInvocation()
          Returns the CommandInvocation that was passed on the constructor
 java.lang.String getName()
          Get the name that was previously set.
 void run()
           
 void setName(java.lang.String s)
          Set a name on the runnable.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandRunnable

public CommandRunnable(CommandRunner.CommandInvocation ci,
                       ActionReport report,
                       java.util.concurrent.BlockingQueue<CommandRunnable> q)
Construct a CommandRunnable. This class wraps a CommandInvocation so that it can be executed via a thread pool.

Parameters:
ci - A CommandInvocation containing the command you want to run.
report - The ActionReport you used with the CommandInvocation
q - A blocking queue that this class will add itself to when its run method has completed. After dispatching this class to a thread pool the caller can block on the response queue where it will dequeue CommandRunnables and then use the getActionReport() method to retrieve the results.
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

setName

public void setName(java.lang.String s)
Set a name on the runnable. The name is not interpreted to mean anything so the caller can use it for whatever it likes.

Parameters:
s - The name

getName

public java.lang.String getName()
Get the name that was previously set.

Returns:
A name that was previously set or null if no name was set.

getCommandInvocation

public CommandRunner.CommandInvocation getCommandInvocation()
Returns the CommandInvocation that was passed on the constructor

Returns:
The CommandInvocation that was passed on the constructor

getActionReport

public ActionReport getActionReport()
Returns the ActionReport that was passed on the constructor.

Returns:
the ActionReport that was passed on the constructor.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2012 GlassFish Community. All Rights Reserved.