guarana.toolkit.task.communicators
Class InOutCommunicator
java.lang.Object
guarana.util.observer.smart.SmartObservable
guarana.framework.task.Task
guarana.toolkit.task.communicators.Communicator
guarana.toolkit.task.communicators.InOutCommunicator
- All Implemented Interfaces:
- ISource, IStubInOut, guarana.util.observer.smart.ISmartObserver, Remote
public class InOutCommunicator
- extends Communicator
- implements IStubInOut
This communicator is to be used, exclusively, in two way ResponderPort
s.
It provides a passive interface only.
Graphical notation:
- Since:
- Guaranį SDK 1.0.0
- Author:
- Rafael Z. Frantz
Constructor Summary |
InOutCommunicator(String name,
String host,
int port)
Constructs a new Passive Communicator to receive requests and give responses. |
Method Summary |
void |
execute()
This method executes the business logic of this task. |
IStubFuture |
pushRequest(Message<?> message)
This method can be invoked to push a request message into the ResponderPort via InOut-Communicator. |
void |
update(guarana.util.observer.smart.SmartObservable slot,
Object arg)
This method is automatically called by the observable slot to notify the slot has received a message. |
Methods inherited from class guarana.util.observer.smart.SmartObservable |
addSmartObserver, containsSmartObserver, containsSmartObserver, countSmartObservers, deleteSmartObserver, deleteSmartObservers, hasChanged, notifySmartObservers, notifySmartObservers |
InOutCommunicator
public InOutCommunicator(String name,
String host,
int port)
- Constructs a new Passive Communicator to receive requests and give responses.
- Parameters:
name
- The name of the communicator.host
- The host name on which the registry is running.port
- The port on which the registry accepts requests.
execute
public void execute()
throws TaskExecutionException
- This method executes the business logic of this task. It is automatically invoked by workers.
- Overrides:
execute
in class Task
- Throws:
TaskExecutionException
- to report any exception that has occurred during the execution of this method.- See Also:
TaskExecutionException
pushRequest
public IStubFuture pushRequest(Message<?> message)
throws RemoteException
- This method can be invoked to push a request message into the
ResponderPort
via InOut-Communicator.
- Specified by:
pushRequest
in interface IStubInOut
- Parameters:
message
- The request message.
- Returns:
- a remote future object that will contain the response message for the request.
- Throws:
RemoteException
- if any remote exception is raised during this method execution.- See Also:
communicator.proxy.IStubInOut
update
public void update(guarana.util.observer.smart.SmartObservable slot,
Object arg)
- This method is automatically called by the observable slot to notify the slot has received a message.
For all those tasks that can execute with one or more messages in its input slots, this method will add the
task to the executable task reporter, so it can be executed. In this case the task execution will consume messages
from all input slots.
Please, do not call this method by yourself.
Overrides the implementation at Task
for performance reasons.
- Specified by:
update
in interface guarana.util.observer.smart.ISmartObserver
- Overrides:
update
in class Task
- Parameters:
slot
- The Slot
associated with this task.arg
- THIS PARAMETHER IS NOT USED.
Guaranį DSL Home