01: /*
02: * <copyright>
03: * Copyright 1997-2004 BBNT Solutions, LLC
04: * under sponsorship of the Defense Advanced Research Projects Agency (DARPA).
05: *
06: * This program is free software; you can redistribute it and/or modify
07: * it under the terms of the Cougaar Open Source License as published by
08: * DARPA on the Cougaar Open Source Website (www.cougaar.org).
09: *
10: * THE COUGAAR SOFTWARE AND ANY DERIVATIVE SUPPLIED BY LICENSOR IS
11: * PROVIDED 'AS IS' WITHOUT WARRANTIES OF ANY KIND, WHETHER EXPRESS OR
12: * IMPLIED, INCLUDING (BUT NOT LIMITED TO) ALL IMPLIED WARRANTIES OF
13: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND WITHOUT
14: * ANY WARRANTIES AS TO NON-INFRINGEMENT. IN NO EVENT SHALL COPYRIGHT
15: * HOLDER BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT OR CONSEQUENTIAL
16: * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE OF DATA OR PROFITS,
17: * TORTIOUS CONDUCT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18: * PERFORMANCE OF THE COUGAAR SOFTWARE.
19: * </copyright>
20: */
21:
22: package org.cougaar.core.thread;
23:
24: /**
25: * This is the {@link Schedulable} implementation used by the simplest
26: * thread service implementation, which runs its {@link Schedulable}s
27: * serially.
28: */
29: class SerialSchedulable extends TrivialSchedulable {
30: private SerialThreadQueue queue;
31:
32: SerialSchedulable(Runnable runnable, String name, Object consumer,
33: SerialThreadQueue queue) {
34: super (runnable, name, consumer);
35: this .queue = queue;
36: }
37:
38: Thread runThread() {
39: queue.enqueue(this );
40: return Thread.currentThread(); // dummy return, must be non-null
41: }
42:
43: }
|