Holy fruity beverage Batman! I'm taking the plunge and switching to Guice for

dependency resolution and management. Things are currently in a state of
transition, but the important patterns have been established and I'll aim to
sweep through all of Narya, Nenya and Vilya in the near future and do
everything properly.

Going through the other million-odd lines of code we have scattered across our
various projects that use these libraries is not something I plan to do, so
we'll be maintaining backward compatibility with the old static member method,
though I hope to strive toward eradication of that usage entirely in MSOY while
we still have a fighting chance.

Given that some of our projects will continue to use the static member method
in perpetuity, I'm not going to @Deprecate those fields because that would fill
their logs with so much spam that they'd have to turn off deprecation warnings
which would make life worse for them. So instead we'll settle for the big scary
comment warning people away from the old bits.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5153 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-06-07 17:44:48 +00:00
parent 443ad8e139
commit 3aefc93838
25 changed files with 1090 additions and 842 deletions
@@ -23,43 +23,41 @@ package com.threerings.presents.server;
import java.util.Iterator;
import com.google.inject.Inject;
import com.samskivert.util.Invoker;
import com.samskivert.util.StringUtil;
import static com.threerings.presents.Log.log;
/**
* Extends the generic {@link Invoker} and integrates it a bit more into
* the Presents system.
* Extends the generic {@link Invoker} and integrates it a bit more into the Presents system.
*/
public class PresentsInvoker extends Invoker
implements PresentsServer.Reporter
implements ReportManager.Reporter
{
/**
* Creates an invoker that will post results to the supplied
* distributed object manager.
*/
public PresentsInvoker (PresentsDObjectMgr omgr)
@Inject public PresentsInvoker (PresentsDObjectMgr omgr, ReportManager repmgr)
{
super("presents.Invoker", omgr);
_omgr = omgr;
if (PERF_TRACK) {
PresentsServer.registerReporter(this);
repmgr.registerReporter(this);
}
}
/**
* Will do a sophisticated shutdown of both itself and the DObjectManager
* thread.
*/
@Override // from Invoker
public void shutdown ()
{
// this will do a sophisticated shutdown of both ourself and the dobjmgr
_queue.append(new ShutdownUnit());
}
// documentation inherited from interface
public void appendReport (
StringBuilder buf, long now, long sinceLast, boolean reset)
// from interface ReportManager.Reporter
public void appendReport (StringBuilder buf, long now, long sinceLast, boolean reset)
{
buf.append("* presents.util.Invoker:\n");
int qsize = _queue.size();
@@ -93,7 +91,7 @@ public class PresentsInvoker extends Invoker
}
}
// documentation inherited
@Override // from Invoker
protected void willInvokeUnit (Unit unit, long start)
{
super.willInvokeUnit(unit, start);
@@ -111,7 +109,7 @@ public class PresentsInvoker extends Invoker
}
}
// documentation inherited
@Override // from Invoker
protected void didInvokeUnit (Unit unit, long start)
{
super.didInvokeUnit(unit, start);
@@ -124,9 +122,8 @@ public class PresentsInvoker extends Invoker
}
/**
* This unit gets posted back and forth between the invoker and DObjectMgr
* until both of their queues are empty and they can both be safely
* shutdown.
* This gets posted back and forth between the invoker and DObjectMgr until both of their
* queues are empty and they can both be safely shutdown.
*/
protected class ShutdownUnit extends Unit
{