01: /*=============================================================================
02: * Copyright Texas Instruments, Inc., 2002. All Rights Reserved.
03: *
04: * This program is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package ti.chimera.service;
20:
21: /**
22: * The "swing worker" is service that provides a call-gate which makes it
23: * possible to perform long running processes from the AWT event thread
24: * without blocking the UI, or from a WorkerThread without blocking it.
25: *
26: * @author Rob Clark
27: * @version 0.1
28: */
29: public abstract class SwingWorker extends ti.chimera.Service {
30: /**
31: * Class Constructor.
32: */
33: public SwingWorker() {
34: super ("swing worker");
35: }
36:
37: /**
38: * Call the {@link Runnable#run} method. This method does not return until
39: * until the runnable completes, but may call the runnable from a different
40: * thread context if needed. Because of this, care must be taken about the
41: * use of synchronization, specifically a monitor acquired before calling
42: * this method may not be held by the thread invoking the runnable, which
43: * could lend to race conditions or deadlock (if the invoking thread tries
44: * to acquire the monitor already held by the thread that called this.
45: *
46: * @param r the runnable to run
47: * @param str the progress message to display to user
48: * @throws Throwable if an exception was thrown by the runnable
49: */
50: public abstract void run(Runnable r, String str) throws Throwable;
51: }
52:
53: /*
54: * Local Variables:
55: * tab-width: 2
56: * indent-tabs-mode: nil
57: * mode: java
58: * c-indentation-style: java
59: * c-basic-offset: 2
60: * eval: (c-set-offset 'substatement-open '0)
61: * End:
62: */
|