com.threerings.presents.server
Class LocalDObjectMgr

java.lang.Object
  extended by com.threerings.presents.server.PresentsDObjectMgr
      extended by com.threerings.presents.server.LocalDObjectMgr
All Implemented Interfaces:
Interval.Factory, RunQueue, DObjectManager, RootDObjectManager, Executor

public class LocalDObjectMgr
extends PresentsDObjectMgr

A special version of the distributed object manager, modified to operate on the AWT thread so that it can run in a client with a GUI and provide a "light" server for local operation of a normally distributed application.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.presents.server.PresentsDObjectMgr
PresentsDObjectMgr.AccessObjectEvent<T extends DObject>, PresentsDObjectMgr.EventHelper, PresentsDObjectMgr.LongRunnable, PresentsDObjectMgr.ProxyReference, PresentsDObjectMgr.Reference, PresentsDObjectMgr.Stats, PresentsDObjectMgr.UnitProfile
 
Nested classes/interfaces inherited from interface com.samskivert.util.RunQueue
RunQueue.AsExecutor
 
Field Summary
 
Fields inherited from class com.threerings.presents.server.PresentsDObjectMgr
_current, _defaultController, _dobjThread, _eventCount, _evqueue, _fatalThrottle, _helpers, _invmgr, _nextEventId, _nextOid, _objects, _profiles, _proxies, _recent, _refs, _running, _unitProfInterval, DEFREFVEC_SIZE, DUMMY_OID, UNIT_PROF_ENABLED
 
Fields inherited from interface com.samskivert.util.RunQueue
AWT
 
Constructor Summary
LocalDObjectMgr(ReportManager repmgr)
          Creates the dobjmgr and prepares it for operation.
 
Method Summary
 DObjectManager getClientDObjectMgr(int clientOid)
          Creates a DObjectManager that posts directly to this local object manager, but first sets the source oid of all events to properly identify them with the supplied client oid.
 boolean isDispatchThread()
          Returns true if the thread invoking this method is the same thread that is doing distributed object event dispatch.
 void postEvent(DEvent event)
          Posts a distributed object event into the system.
 void postRunnable(Runnable unit)
          Posts a self-contained unit of code that should be run on the distributed object manager thread at the next available opportunity.
 
Methods inherited from class com.threerings.presents.server.PresentsDObjectMgr
clearProxyObject, clearReference, clearUnitProfiles, destroyObject, dispatchEvent, dumpUnitProfiles, execute, getNextEventId, getNextOid, getObject, getStats, getUnitProfInterval, handleFatalError, harshShutdown, informObjectAvailable, isManager, isRunning, newInterval, objectAdded, objectDestroyed, objectRemoved, processCompoundEvent, processEvent, processUnit, queueIsEmpty, refuseEventThread, registerEventHelpers, registerObject, registerProxyObject, removedLastSubscriber, requireEventThread, run, setDefaultAccessController, setUnitProfInterval, subscribeToObject, unsubscribeFromObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalDObjectMgr

@Inject
public LocalDObjectMgr(ReportManager repmgr)
Creates the dobjmgr and prepares it for operation.

Method Detail

getClientDObjectMgr

public DObjectManager getClientDObjectMgr(int clientOid)
Creates a DObjectManager that posts directly to this local object manager, but first sets the source oid of all events to properly identify them with the supplied client oid. Normally this oid setting happens when an event is received on the server over the network, but in local mode we have to do it by hand.


isDispatchThread

public boolean isDispatchThread()
Description copied from class: PresentsDObjectMgr
Returns true if the thread invoking this method is the same thread that is doing distributed object event dispatch. Code that wishes to enforce that it is either always or never called on the event dispatch thread will want to make use of this method. From interface RunQueue

Specified by:
isDispatchThread in interface RunQueue
Overrides:
isDispatchThread in class PresentsDObjectMgr

postEvent

public void postEvent(DEvent event)
Description copied from interface: DObjectManager
Posts a distributed object event into the system. Instead of requesting the modification of a distributed object attribute by calling the setter for that attribute on the object itself, an AttributeChangedEvent can be constructed and posted directly. This is true for all event types and is useful for situations where one doesn't have access to the object in question, but needs to affect some event.

This event will be forwarded to the ultimate manager of the object (on the client, this means it will be forwarded to the server) where it will be checked for validity and then applied to the object and dispatched to all its subscribers.

Specified by:
postEvent in interface DObjectManager
Overrides:
postEvent in class PresentsDObjectMgr
Parameters:
event - The event to be dispatched.

postRunnable

public void postRunnable(Runnable unit)
Description copied from class: PresentsDObjectMgr
Posts a self-contained unit of code that should be run on the distributed object manager thread at the next available opportunity. The code will be queued up with the rest of the events and invoked in turn. Like event processing code, the code should not take long to complete and should definitely not block. From interface RunQueue

Specified by:
postRunnable in interface RunQueue
Overrides:
postRunnable in class PresentsDObjectMgr