diff --git a/src/java/com/threerings/presents/server/PresentsDObjectMgr.java b/src/java/com/threerings/presents/server/PresentsDObjectMgr.java index 32c7dc5c6..a7e4d5b26 100644 --- a/src/java/com/threerings/presents/server/PresentsDObjectMgr.java +++ b/src/java/com/threerings/presents/server/PresentsDObjectMgr.java @@ -275,6 +275,30 @@ public class PresentsDObjectMgr return Thread.currentThread() == _dobjThread; } + /** + * Ensures that the calling thread is the distributed object event dispatch thread, throwing an + * {@link IllegalStateException} if it is not. + */ + public void requireEventThread () + { + if (!isDispatchThread()) { + String errmsg = "This method must be called on the dobj event thread."; + throw new IllegalStateException(errmsg); + } + } + + /** + * Ensures that the calling thread is not the distributed object event dispatch + * thread, throwing an {@link IllegalStateException} if it is. + */ + public void refuseEventThread () + { + if (isDispatchThread()) { + String errmsg = "This method must not be called on the dobj event thread."; + throw new IllegalStateException(errmsg); + } + } + /** * Runs the dobjmgr event loop until it is requested to exit. This should be called from the * main application thread.