|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
com.bigdata.ha.pipeline.HAReceiveService<M>
public class HAReceiveService<M extends HAWriteMessageBase>
Receives data from an HASendService.
The non-blocking processing of the data cannot proceed until the message parameters and an output buffer have been set. So an accept results in a task to be run. The Future from this task is returned to the method called from the RMI control invocation, thus allowing that method to wait for the completion of the data transfer.
| Nested Class Summary | |
|---|---|
static interface |
HAReceiveService.IHAReceiveCallback<M extends HAWriteMessageBase>
Hook to notice receive events. |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
log
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
HAReceiveService(InetSocketAddress addrSelf,
InetSocketAddress addrNext)
Create a new service instance - you MUST Thread.start() the
service. |
|
HAReceiveService(InetSocketAddress addrSelf,
InetSocketAddress addrNext,
HAReceiveService.IHAReceiveCallback<M> callback)
Create a new service instance - you MUST Thread.start() the
service. |
|
| Method Summary | |
|---|---|
void |
awaitShutdown()
Block until the service is shutdown. |
void |
changeDownStream(InetSocketAddress addrNext)
Change the address to which the payloads are being relayed. |
protected void |
finalize()
Extended to terminate() processing in order to ensure that
the service is eventually shutdown. |
Future<Void> |
receiveData(M msg,
ByteBuffer buffer)
Receive data into the caller's buffer as described by the caller's message. |
void |
run()
|
void |
start()
|
void |
terminate()
Immediate shutdown. |
String |
toString()
|
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger log
| Constructor Detail |
|---|
public HAReceiveService(InetSocketAddress addrSelf,
InetSocketAddress addrNext)
Thread.start() the
service.
addrSelf - The Internet socket address at which this service will listen.addrNext - The Internet socket address of a downstream service to which
each data transfer will be relayed as it is received
(optional).
public HAReceiveService(InetSocketAddress addrSelf,
InetSocketAddress addrNext,
HAReceiveService.IHAReceiveCallback<M> callback)
Thread.start() the
service.
addrSelf - The Internet socket address at which this service will listen.addrNext - The Internet socket address of a downstream service to which
each data transfer will be relayed as it is received
(optional).callback - An object which will be notified as each payload arrives.| Method Detail |
|---|
public String toString()
toString in class Thread
protected void finalize()
throws Throwable
terminate() processing in order to ensure that
the service is eventually shutdown.
finalize in class ObjectThrowablepublic void terminate()
public void awaitShutdown()
throws InterruptedException
InterruptedExceptionpublic void start()
start in class Threadpublic void run()
run in interface Runnablerun in class Thread
public Future<Void> receiveData(M msg,
ByteBuffer buffer)
throws InterruptedException
msg - The metadata about the data to be transferred.buffer - The buffer in which this service will receive the data. The
buffer MUST be large enough for the data to be received. The
buffer SHOULD be a direct ByteBuffer in order to
benefit from NIO efficiencies. This method will own the buffer
until the returned Future is done.
InterruptedExceptionpublic void changeDownStream(InetSocketAddress addrNext)
HASendService and then
HASendService.start(InetSocketAddress)s it with the new address
(if any).
The ReadTask will throw out an exception when if there was a
downstream target when the HASendService.IncSendTask is interrupted. Since the
ReadTask lacks the context to issue the appropriate RMI to the
downstream task, the exception must be caught hand handled by the
WriteCacheService. It can simply rediscover the new downstream
service and then re-submit both the RMI and the WriteCache block.
addrNext - The new address -or- null if payloads should not
be relayed at this time.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||