Menu

Commit [r4764]  Maximize  Restore  History

PLT Utilities: Some redesign to better integrate with java.util.concurrent (now that Java 5 is the minimum supported API, these classes are available). There were some backwards-incompatible changes to TaskController and related classes.

Specific concurrency-related changes:

- Refactored TaskController to implement the Future interface -- this required changing the types of exceptions thrown by get() and (for consistency) value(). Simplified the requirements for subclassing, lifting the state-change and resource-management logic entirely into the abstract parent class. Updated to fully support concurrent state changes safely. Added some additional methods, including support for listeners.

- Similarly updated IncrementalTaskController. Also changed the interface used to access intermediate results -- they are now added to a single queue, which the client can get and read from.

- Renamed IncrementalTask.isFinished() -> isResolved().

- Defined specific TaskController implementations as public top-level classes rather that private classes nested in ConcurrentUtil. Enhanced these (and the related ConcurrentUtil methods) to support predefined Futures and execution via arbitrary Executors.

- Rewrote SwingWorker to implement IncrementalTaskController (making it more closely match the Java 6 version -- both now implement Future).

- Implemented IncrementalTask execution in a remote process (a long-standing to-do item).

- Eliminated the unnecessary use of threads, where possible. DelayedInterrupter now uses a single thread for the entire class, rather than one per object. Some ConcurrentUtil methods run their tasks with a provided executor rather than threads (keeping the default behavior by defining the simple Executor THREAD_EXECUTOR).

- Added helper methods to ConcurrentUtil to support implementation of timeouts. (This is non-trivial because the semantics of Object.wait() do not distinguish between a timeout and a spurious wake-up.)

- Optimized CompletionMonitor to avoid unnecessary locking; added timeout support to all Monitor classes.

Some other changes:

- Added ListenerSet, a general-purpose facility for providing listener support without the need for custom interface definitions.

- Fixed some concurrency bugs in LazyThunk. Added a similar CachedThunk that supports resetting, and a general ResolvingThunk interface for Thunks that have an "unresolved" and "resolved" state.

- Added SnapshotSynchronizedSet and SnapshotSynchronizedList, enhancements to the Collections.synchronized methods that make copies of their contents for iteration rather than requiring the client to synchronize.

- Added IOUtil.attemptClose, ignoreSystemOut, and ignoreSystemErr.

dlsmith 2009-02-20

1 2 > >> (Page 1 of 2)
changed /trunk/plt/src/edu/rice/cs/plt/collect/CollectUtil.java
added /trunk/plt/src/edu/rice/cs/plt/collect/DelegatingList.java
changed /trunk/plt/src/edu/rice/cs/plt/collect/DelegatingRelation.java
changed /trunk/plt/src/edu/rice/cs/plt/collect/ImmutableRelation.java
added /trunk/plt/src/edu/rice/cs/plt/collect/ListenerSet.java
added /trunk/plt/src/edu/rice/cs/plt/collect/SnapshotSynchronizedList.java
added /trunk/plt/src/edu/rice/cs/plt/collect/SnapshotSynchronizedSet.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/CompletionMonitor.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/CompletionMonitorTest.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/ConcurrentUtil.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/ConcurrentUtilTest.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/ConditionMonitor.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/DelayedInterrupter.java
added /trunk/plt/src/edu/rice/cs/plt/concurrent/ExecutorIncrementalTaskController.java
added /trunk/plt/src/edu/rice/cs/plt/concurrent/ExecutorTaskController.java
added /trunk/plt/src/edu/rice/cs/plt/concurrent/FutureTaskController.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/IncrementalTask.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/IncrementalTaskController.java
added /trunk/plt/src/edu/rice/cs/plt/concurrent/PollingTaskController.java
added /trunk/plt/src/edu/rice/cs/plt/concurrent/ProcessIncrementalTaskController.java
added /trunk/plt/src/edu/rice/cs/plt/concurrent/ProcessTaskController.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/StateMonitor.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/StateMonitorTest.java
changed /trunk/plt/src/edu/rice/cs/plt/concurrent/TaskController.java
changed /trunk/plt/src/edu/rice/cs/plt/io/IOUtil.java
/trunk/plt/src/edu/rice/cs/plt/collect/CollectUtil.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/collect/DelegatingList.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/collect/DelegatingRelation.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/collect/ImmutableRelation.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/collect/ListenerSet.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/collect/SnapshotSynchronizedList.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/collect/SnapshotSynchronizedSet.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/CompletionMonitor.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/CompletionMonitorTest.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/ConcurrentUtil.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/ConcurrentUtilTest.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/ConditionMonitor.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/DelayedInterrupter.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/ExecutorIncrementalTaskController.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/ExecutorTaskController.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/FutureTaskController.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/IncrementalTask.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/IncrementalTaskController.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/PollingTaskController.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/ProcessIncrementalTaskController.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/ProcessTaskController.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/StateMonitor.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/StateMonitorTest.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/concurrent/TaskController.java Diff Switch to side-by-side view
Loading...
/trunk/plt/src/edu/rice/cs/plt/io/IOUtil.java Diff Switch to side-by-side view
Loading...
1 2 > >> (Page 1 of 2)
MongoDB Logo MongoDB