public final class MessageFilter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VERSION |
Modifier and Type | Method and Description |
---|---|
boolean |
anyConnectionsDropped()
Returns true if a connection related to this filter has been dropped or restarted.
|
void |
clearMatched() |
void |
clearOr() |
static MessageFilter |
create() |
PeerContext |
droppedConnection()
Which connection dropped or was restarted?
|
long |
getInitialTimeout() |
Message |
getMessage() |
PeerContext |
getSource()
Returns the source that this filter (or chain) matches
|
long |
getTimeout() |
boolean |
hasCallback() |
freenet.io.comm.MessageFilter.MATCHED |
match(Message m,
boolean noTimeout,
long now) |
freenet.io.comm.MessageFilter.MATCHED |
match(Message m,
long now) |
boolean |
matched() |
boolean |
matchesDroppedConnection(PeerContext ctx) |
boolean |
matchesRestartedConnection(PeerContext ctx) |
void |
onDroppedConnection(PeerContext ctx,
Executor executor)
Notify because of a dropped connection.
|
void |
onMatched(Executor executor)
Notify waiters that we have been matched.
|
void |
onRestartedConnection(PeerContext ctx,
Executor executor)
Notify because of a restarted connection.
|
void |
onTimedOut(Executor executor)
Notify waiters that we have timed out.
|
MessageFilter |
or(MessageFilter or)
Modifies the filter so that it returns true if either it or the filter in the argument returns true.
|
MessageFilter |
setAsyncCallback(AsyncMessageFilterCallback cb,
ByteCounter ctr) |
MessageFilter |
setField(java.lang.String fieldName,
boolean value) |
MessageFilter |
setField(java.lang.String fieldName,
byte value) |
MessageFilter |
setField(java.lang.String fieldName,
int value) |
MessageFilter |
setField(java.lang.String fieldName,
long value) |
MessageFilter |
setField(java.lang.String fieldName,
java.lang.Object fieldValue) |
MessageFilter |
setField(java.lang.String fieldName,
short value) |
void |
setMessage(Message message) |
MessageFilter |
setNoTimeout() |
MessageFilter |
setSource(PeerContext source) |
MessageFilter |
setTimeout(long timeout)
This filter will expire after the specificed amount of time.
|
MessageFilter |
setTimeoutRelativeToCreation(boolean b)
Set whether the timeout is relative to the creation of the filter, or the start of
waitFor().
|
MessageFilter |
setType(MessageType type) |
java.lang.String |
toString() |
public static final java.lang.String VERSION
public static MessageFilter create()
public MessageFilter setTimeoutRelativeToCreation(boolean b)
b
- If true, the timeout is relative to the time at which setTimeout() was called,
if false, it's relative to the start of waitFor().public MessageFilter setTimeout(long timeout)
timeout
- The time before this filter expires in mspublic MessageFilter setNoTimeout()
public MessageFilter setType(MessageType type)
public MessageFilter setSource(PeerContext source)
public PeerContext getSource()
public MessageFilter setField(java.lang.String fieldName, boolean value)
public MessageFilter setField(java.lang.String fieldName, byte value)
public MessageFilter setField(java.lang.String fieldName, short value)
public MessageFilter setField(java.lang.String fieldName, int value)
public MessageFilter setField(java.lang.String fieldName, long value)
public MessageFilter setField(java.lang.String fieldName, java.lang.Object fieldValue)
public MessageFilter or(MessageFilter or)
public MessageFilter setAsyncCallback(AsyncMessageFilterCallback cb, ByteCounter ctr)
public freenet.io.comm.MessageFilter.MATCHED match(Message m, long now)
public freenet.io.comm.MessageFilter.MATCHED match(Message m, boolean noTimeout, long now)
public boolean matched()
public PeerContext droppedConnection()
public Message getMessage()
public void setMessage(Message message)
public long getInitialTimeout()
public long getTimeout()
public java.lang.String toString()
toString
in class java.lang.Object
public void clearMatched()
public void clearOr()
public boolean matchesDroppedConnection(PeerContext ctx)
public boolean matchesRestartedConnection(PeerContext ctx)
public void onDroppedConnection(PeerContext ctx, Executor executor)
ctx
- public void onRestartedConnection(PeerContext ctx, Executor executor)
ctx
- public void onMatched(Executor executor)
public void onTimedOut(Executor executor)
public boolean anyConnectionsDropped()
public boolean hasCallback()