
public abstract class CallSynchronizer<ID,INPUT,OUTPUT> extends Object
| Constructor and Description |
|---|
CallSynchronizer()
Constructor.
|
CallSynchronizer(long timeout)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortCall(ID id)
Abort the call with the given ID.
|
protected abstract void |
operate(ID callerID,
INPUT input)
This method operates the call, it performs the adequate operations to
ensure there will be a response calling on another thread.
|
OUTPUT |
performCall(ID callerID,
INPUT input)
This method is the main method to syncronize the caller thread.
|
void |
performResponse(ID id,
OUTPUT output)
When a response for a call is found, this method should be used to notify
the Caller
Thread waiting for it. |
void |
purge()
When there will be no more responses this method aborts all calls,
|
public CallSynchronizer(long timeout)
public CallSynchronizer()
public OUTPUT performCall(ID callerID, INPUT input) throws InterruptedException, TimeoutException
Thread will be stoped until another thread calls
CallSynchronizer#performResponse(ID, Object).callerID - the Id to identify the call.input - The input needed to perform the call.InterruptedException - when the call was aborted by other thread.TimeoutException - when the timeout wait limit for response has been exceeded.CallSynchronizer#performResponse(ID, Object)protected abstract void operate(ID callerID, INPUT input)
callerID - the call identifierinput - the input needed for the callpublic void performResponse(ID id, OUTPUT output)
Thread waiting for it.id - output - public void abortCall(ID id)
performCall(Object, Object) will throw a
InterruptedException.id - public void purge()
Copyright © 2018 universAAL Consortium. All rights reserved.