protected class MultipleCommandService.CommandTypeExecutor extends Object
MultipleCommandService that encasulates a supported command type and the
executor that should be used to execute commands of that type. Note the two constructors - one takes a
java.lang.Class and one an instance of CommandExecutor. If the java.lang.Class
constructor is used, then for each command request that is issued to this command service, a new instance should
be created to handle each command. If the CommandExecutor constructor is used, that means each command
that comes in should be handed off to that specific instance. In that case, the executor instance must
ensure thread-safety, since commands may come in concurrently.
Subclasses create instances of these objects and return them in
MultipleCommandService.getSupportedCommandTypeExecutors().
| Modifier and Type | Field and Description |
|---|---|
Class |
m_executorClass
the executor's class - this must implement
CommandExecutor |
CommandType |
m_type
the type of command this executor will handle
|
| Constructor and Description |
|---|
MultipleCommandService.CommandTypeExecutor(CommandType type,
Class executorClass)
Creates a new object that defines what class to instantiate for each new command to execute.
|
MultipleCommandService.CommandTypeExecutor(CommandType type,
CommandExecutor executorInstance)
Creates a new object that defines what executor instance to use to execute all commands of the given
type. |
| Modifier and Type | Method and Description |
|---|---|
CommandExecutor |
getExecutor()
Returns the executor instance that should be used to execute the next command.
|
public final CommandType m_type
public final Class m_executorClass
CommandExecutorpublic MultipleCommandService.CommandTypeExecutor(CommandType type, Class executorClass)
type - the type of command to be handed off to new instances of the given executor classexecutorClass - class of the executor to instantiate when new commands are to be executedIllegalArgumentException - if the given class is an interface, an abstract class or not assignable to
CommandExecutor; also if any parameter is null. Note
that this is also thrown if the class is a MultipleCommandService
object, since that would result in an infinite recursive loop.public MultipleCommandService.CommandTypeExecutor(CommandType type, CommandExecutor executorInstance)
type. Because all commands will be handed off to the given executor instance, that instance must
ensure thread-safety.type - the type of command that will be handled by the given executor instanceexecutorInstance - the executor that will handle all commands of the given typeIllegalArgumentException - if any parameter is null or if the instance is a
MultipleCommandService object, since that would result in an
infinite recursive loop.public CommandExecutor getExecutor()
RuntimeException - failed to create the executor instance (should rarely, if ever, occur)Copyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.