public class RequestHandler extends java.lang.Object implements PrioRunnable, ByteCounter, RequestSenderListener
| Constructor and Description |
|---|
RequestHandler(PeerNode source,
long id,
Node n,
short htl,
Key key,
RequestTag tag,
KeyBlock passedInKeyBlock,
boolean realTimeFlag,
boolean needsPubKey) |
| Modifier and Type | Method and Description |
|---|---|
int |
getPriority() |
void |
onAbortDownstreamTransfers(int reason,
java.lang.String desc)
Abort downstream transfers (not necessarily upstream ones, so not via the PRB).
|
void |
onCHKTransferBegins()
Should return quickly, allocate a thread if it needs to block etc
|
void |
onDataFoundLocally()
Not called by RequestSender, but called if the data was in the store.
|
void |
onNotStarted(boolean internalError)
Not called by RequestSender, but called if localOnly is true and the data
is not in the store.
|
void |
onReceivedRejectOverload()
Should return quickly, allocate a thread if it needs to block etc
|
void |
onRequestSenderFinished(int status,
boolean fromOfferedKey,
RequestSender rs)
Should return quickly, allocate a thread if it needs to block etc
|
void |
receivedBytes(int x) |
void |
run() |
void |
sentBytes(int x)
Sent some bytes.
|
void |
sentPayload(int x)
Sent payload - only include the number of bytes of actual payload i.e.
|
java.lang.String |
toString() |
protected void |
transferFinished(boolean success)
Once the transfer has finished and we have the final status code, either path fold
or just unregister.
|
public RequestHandler(PeerNode source, long id, Node n, short htl, Key key, RequestTag tag, KeyBlock passedInKeyBlock, boolean realTimeFlag, boolean needsPubKey)
source - id - n - htl - key - tag - passedInKeyBlock - We ALWAYS look up in the datastore before starting a request.
SECURITY: Do not pass messages into handler constructors. See note at top of NodeDispatcher.realTimeFlag - needsPubKey - public java.lang.String toString()
toString in class java.lang.Objectpublic void run()
run in interface java.lang.Runnablepublic void onReceivedRejectOverload()
RequestSenderListeneronReceivedRejectOverload in interface RequestSenderListenerpublic void onCHKTransferBegins()
RequestSenderListeneronCHKTransferBegins in interface RequestSenderListenerprotected void transferFinished(boolean success)
success - Whether the block transfer succeeded.public void onAbortDownstreamTransfers(int reason,
java.lang.String desc)
RequestSenderListeneronAbortDownstreamTransfers in interface RequestSenderListenerpublic void onRequestSenderFinished(int status,
boolean fromOfferedKey,
RequestSender rs)
RequestSenderListeneronRequestSenderFinished in interface RequestSenderListenerpublic void sentBytes(int x)
ByteCountersentBytes in interface ByteCounterpublic void receivedBytes(int x)
receivedBytes in interface ByteCounterpublic void sentPayload(int x)
ByteCountersentPayload in interface ByteCounterx - Number of bytes sentpublic int getPriority()
getPriority in interface PrioRunnablepublic void onNotStarted(boolean internalError)
RequestSenderListeneronNotStarted in interface RequestSenderListenerinternalError - If true, something broke severely.public void onDataFoundLocally()
RequestSenderListeneronDataFoundLocally in interface RequestSenderListener