Let's just use a runnable there. Having the node action turns out not to be

super useful. If one really needs it they can keep a final reference around.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5304 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-08-10 02:16:54 +00:00
parent 7481cdd5a1
commit eda49af57b
@@ -271,7 +271,7 @@ public abstract class PeerManager
* the objects unless you really know what you're doing. more likely it will summarize * the objects unless you really know what you're doing. more likely it will summarize
* information contained therein. * information contained therein.
*/ */
public void applyToNodes (Function<NodeObject, Void> op) public void applyToNodes (Function<NodeObject,Void> op)
{ {
op.apply(_nodeobj); op.apply(_nodeobj);
for (PeerNode peer : _peers.values()) { for (PeerNode peer : _peers.values()) {
@@ -312,10 +312,9 @@ public abstract class PeerManager
* *
* @param onDropped a runnable to be executed if the action was not invoked on the local server * @param onDropped a runnable to be executed if the action was not invoked on the local server
* or any peer node due to failing to match any of the nodes. The runnable will be executed on * or any peer node due to failing to match any of the nodes. The runnable will be executed on
* the dobj event thread and will be passed the node action that was not invoked. * the dobj event thread.
*/ */
public <T extends NodeAction> void invokeNodeAction ( public void invokeNodeAction (final NodeAction action, final Runnable onDropped)
final T action, final Function<T,Void> onDropped)
{ {
// if we're not on the dobjmgr thread, get there // if we're not on the dobjmgr thread, get there
if (!_omgr.isDispatchThread()) { if (!_omgr.isDispatchThread()) {
@@ -348,7 +347,7 @@ public abstract class PeerManager
// if we did not invoke the action on any node, call the onDropped handler // if we did not invoke the action on any node, call the onDropped handler
if (!invoked && onDropped != null) { if (!invoked && onDropped != null) {
onDropped.apply(action); onDropped.run();
} }
} }