diff --git a/src/java/com/threerings/presents/peer/server/PeerManager.java b/src/java/com/threerings/presents/peer/server/PeerManager.java index 0219784a6..b28a7997d 100644 --- a/src/java/com/threerings/presents/peer/server/PeerManager.java +++ b/src/java/com/threerings/presents/peer/server/PeerManager.java @@ -109,6 +109,12 @@ public class PeerManager public void apply (NodeObject nodeobj); } + /** Used by {@link #invokeOnNodes}. */ + public static interface Function + { + public void invoke (Client client, NodeObject nodeobj); + } + /** * Wraps an operation that needs a shared resource lock to be acquired before it can be * performed, and released after it completes. Used by {@link #performWithLock}. @@ -257,6 +263,20 @@ public class PeerManager } } + /** + * Invokes the supplied function on all node objects (except the local node). A caller + * that needs to call an invocation service method on a remote node should use this mechanism + * to locate the appropriate node (or nodes) and call the desired method. + */ + public void invokeOnNodes (Function func) + { + for (PeerNode peer : _peers.values()) { + if (peer.nodeobj != null) { + func.invoke(peer.getClient(), peer.nodeobj); + } + } + } + /** * Returns true if the supplied peer credentials match our shared secret. */