I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit f777696e authored by zzz's avatar zzz
Browse files

finals, volatiles, cleanups

parent c9c181c1
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ class SearchMessageSelector implements MessageSelector {
private final RouterContext _context;
private static final AtomicInteger __searchSelectorId = new AtomicInteger();
private final Hash _peer;
private boolean _found;
private volatile boolean _found;
private final int _id;
private final long _exp;
private final SearchState _state;
......@@ -30,7 +30,6 @@ class SearchMessageSelector implements MessageSelector {
_context = context;
_log = context.logManager().getLog(SearchMessageSelector.class);
_peer = peer.getIdentity().getHash();
_found = false;
_exp = expiration;
_state = state;
_id = __searchSelectorId.incrementAndGet();
......@@ -40,7 +39,7 @@ class SearchMessageSelector implements MessageSelector {
@Override
public String toString() {
return "Search selector [" + _id + "] looking for a reply from " + _peer
return "Search selector [" + _id + "] looking for a reply from " + _peer
+ " with regards to " + _state.getTarget();
}
......@@ -62,7 +61,9 @@ class SearchMessageSelector implements MessageSelector {
return true;
}
}
public long getExpiration() { return _exp; }
public boolean isMatch(I2NPMessage message) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("[" + _id + "] isMatch("+message.getClass().getName()
......
......@@ -14,24 +14,30 @@ import net.i2p.util.Log;
*
*/
class StoreMessageSelector implements MessageSelector {
private Log _log;
private Hash _peer;
private long _storeJobId;
private long _waitingForId;
private long _expiration;
private boolean _found;
private final Log _log;
private final Hash _peer;
private final long _storeJobId;
private final long _waitingForId;
private final long _expiration;
private volatile boolean _found;
/**
* @param storeJobId just for logging
* @param peer just for logging
*/
public StoreMessageSelector(RouterContext ctx, long storeJobId, RouterInfo peer, long waitingForId,
long expiration) {
_log = ctx.logManager().getLog(StoreMessageSelector.class);
_peer = peer.getIdentity().getHash();
_storeJobId = storeJobId;
_found = false;
_waitingForId = waitingForId;
_expiration = expiration;
}
public boolean continueMatching() { return !_found; }
public long getExpiration() { return _expiration; }
public boolean isMatch(I2NPMessage message) {
if (_log.shouldLog(Log.DEBUG))
_log.debug(_storeJobId + ": isMatch("+message.getClass().getName() + ") [want deliveryStatusMessage from "
......@@ -57,8 +63,8 @@ class StoreMessageSelector implements MessageSelector {
@Override
public String toString() {
StringBuilder rv = new StringBuilder(64);
rv.append("Waiting for netDb confirm from ").append(_peer.toBase64()).append(", found? ");
StringBuilder rv = new StringBuilder(128);
rv.append("Waiting for netDb confirm from ").append(_peer).append(", found? ");
rv.append(_found).append(" waiting for ").append(_waitingForId);
return rv.toString();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment