More Executor preferring.

Maybe I'm just crazy.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2673 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray.j.greenwell
2009-12-08 19:04:49 +00:00
parent 44c1d15c4b
commit 2c04b41b66
+10 -2
View File
@@ -136,6 +136,14 @@ public class Invoker extends LoopingThread
* Creates an invoker that will post results to the supplied result receiver. * Creates an invoker that will post results to the supplied result receiver.
*/ */
public Invoker (String name, RunQueue resultReceiver) public Invoker (String name, RunQueue resultReceiver)
{
this(name, new RunQueue.AsExecutor(resultReceiver));
}
/**
* Creates an invoker that will post results to the supplied result receiver.
*/
public Invoker (String name, Executor resultReceiver)
{ {
super(name); super(name);
_receiver = resultReceiver; _receiver = resultReceiver;
@@ -211,7 +219,7 @@ public class Invoker extends LoopingThread
willInvokeUnit(unit, start); willInvokeUnit(unit, start);
if (unit.invoke()) { if (unit.invoke()) {
// if it returned true, post it to the receiver thread for result processing // if it returned true, post it to the receiver thread for result processing
_receiver.postRunnable(unit); _receiver.execute(unit);
} }
didInvokeUnit(unit, start); didInvokeUnit(unit, start);
@@ -337,7 +345,7 @@ public class Invoker extends LoopingThread
protected Queue<Unit> _queue = new Queue<Unit>(); protected Queue<Unit> _queue = new Queue<Unit>();
/** The result receiver with which we're working. */ /** The result receiver with which we're working. */
protected RunQueue _receiver; protected Executor _receiver;
/** Tracks the counts of invocations by unit's class. */ /** Tracks the counts of invocations by unit's class. */
protected HashMap<Object,UnitProfile> _tracker = new HashMap<Object,UnitProfile>(); protected HashMap<Object,UnitProfile> _tracker = new HashMap<Object,UnitProfile>();