Widening, made a note about why we don't set _shutdownRequested.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5647 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -35,8 +35,8 @@ import static com.threerings.presents.Log.log;
|
|||||||
public class PresentsInvoker extends ReportingInvoker
|
public class PresentsInvoker extends ReportingInvoker
|
||||||
implements ShutdownManager.Shutdowner
|
implements ShutdownManager.Shutdowner
|
||||||
{
|
{
|
||||||
@Inject public PresentsInvoker (PresentsDObjectMgr omgr, ShutdownManager shutmgr,
|
@Inject public PresentsInvoker (
|
||||||
ReportManager repmgr)
|
PresentsDObjectMgr omgr, ShutdownManager shutmgr, ReportManager repmgr)
|
||||||
{
|
{
|
||||||
super("presents.Invoker", omgr, repmgr);
|
super("presents.Invoker", omgr, repmgr);
|
||||||
_omgr = omgr;
|
_omgr = omgr;
|
||||||
@@ -46,7 +46,10 @@ public class PresentsInvoker extends ReportingInvoker
|
|||||||
@Override // from Invoker
|
@Override // from Invoker
|
||||||
public void shutdown ()
|
public void shutdown ()
|
||||||
{
|
{
|
||||||
// this will do a sophisticated shutdown of both ourself and the dobjmgr
|
// this will do a sophisticated shutdown of both ourself and the dobjmgr; note: we
|
||||||
|
// specifically avoid setting _shutdownRequested as it's OK for units to be posted to the
|
||||||
|
// PresentsInvoker during the shutdown phase, we just delay shutdown until we're able to
|
||||||
|
// make it to the shutdown unit without queueing up more units for processing
|
||||||
_queue.append(new ShutdownUnit());
|
_queue.append(new ShutdownUnit());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,19 +98,18 @@ public class PresentsInvoker extends ReportingInvoker
|
|||||||
_loopCount++;
|
_loopCount++;
|
||||||
_omgr.postRunnable(this);
|
_omgr.postRunnable(this);
|
||||||
|
|
||||||
// if the invoker still has stuff and we're still under the pass
|
// if the invoker still has stuff and we're still under the pass limit, go ahead and
|
||||||
// limit, go ahead and pass it back to the invoker
|
// pass it back to the invoker
|
||||||
} else if (_queue.hasElements() && (_passCount < MAX_PASSES)) {
|
} else if (_queue.hasElements() && (_passCount < MAX_PASSES)) {
|
||||||
// pass the buck back to the invoker
|
// pass the buck back to the invoker
|
||||||
_loopCount = 0;
|
_loopCount = 0;
|
||||||
postUnit(this);
|
postUnit(this);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// otherwise end it, and complain if we're ending it
|
// otherwise end it, and complain if we're ending it because of passes
|
||||||
// because of passes
|
|
||||||
if (_passCount >= MAX_PASSES) {
|
if (_passCount >= MAX_PASSES) {
|
||||||
log.warning("Shutdown Unit passed 50 times without " +
|
log.warning("Shutdown Unit passed 50 times without finishing, shutting down " +
|
||||||
"finishing, shutting down harshly.");
|
"harshly.");
|
||||||
}
|
}
|
||||||
doShutdown();
|
doShutdown();
|
||||||
}
|
}
|
||||||
@@ -119,8 +121,8 @@ public class PresentsInvoker extends ReportingInvoker
|
|||||||
protected boolean checkLoops ()
|
protected boolean checkLoops ()
|
||||||
{
|
{
|
||||||
if (_loopCount > MAX_LOOPS) {
|
if (_loopCount > MAX_LOOPS) {
|
||||||
log.warning("Shutdown Unit looped on one thread 10000 times " +
|
log.warning("Shutdown Unit looped on one thread 10000 times without finishing, " +
|
||||||
"without finishing, shutting down harshly.");
|
"shutting down harshly.");
|
||||||
doShutdown();
|
doShutdown();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user