// line 405 of https://github.com/freenet/fred/blob/3fcc2d1b3a0d5ccbeb73928d6b267440e5b4c17b/src/freenet/io/comm/MessageFilter.java /** * Notify waiters that we have been matched. * Hopefully no locks will be held at this point by the caller. */ public void onMatched(Executor executor) { final Message msg; final AsyncMessageFilterCallback cb; ByteCounter ctr; synchronized(this) { msg = _message; cb = _callback; ctr = _ctr; // Clear matched before calling callback in case we are re-added. if(_callback != null) clearMatched(); } if(cb != null) { if(cb instanceof SlowAsyncMessageFilterCallback) executor.execute(new PrioRunnable() { @Override public void run() { cb.onMatched(msg); } @Override public int getPriority() { return ((SlowAsyncMessageFilterCallback)cb).getPriority(); } }, "Slow callback for "+cb); else cb.onMatched(msg); if(ctr != null) ctr.receivedBytes(msg._receivedByteCount); } }