|Home >> All >> EDU >> oswego >> cs >> dl >> util|
PooledExecutor: A tunable, extensible thread pool class. The main supported public method is execute(Runnable command) , which can be called instead of directly creating threads to execute commands. Thread pools can be useful for several, usually intertwined reasons: To bound resource use. A limit can be placed on the maximum number of simultaneously executing threads. To manage concurrency levels. A targeted number of threads can be allowed to execute simultaneously. To manage a set of threads performing related tasks. To minimize overhead, by reusing previously constructed Thread objects rather than creating ...
Channel: Main interface for buffers, queues, pipes, conduits, etc. A Channel represents anything that you can put items into and take them out of. As with the Sync interface, both blocking (put(x), take), and timeouts (offer(x, msecs), poll(msecs)) policies are provided. Using a zero timeout for offer and poll results in a pure balking policy. To aid in efforts to use Channels in a more typesafe manner, this interface extends Puttable and Takable. You can restrict arguments of instance variables to this type as a way of guaranteeing that producers never try to take, or consumers put. for example: class ...
SynchronizedVariable: Base class for simple, small classes maintaining single values that are always accessed and updated under synchronization. Since defining them for only some types seemed too arbitrary, they exist for all basic types, although it is hard to imagine uses for some. These classes mainly exist so that you do not have to go to the trouble of writing your own miscellaneous classes and methods in situations including: When you need or want to offload an instance variable to use its own synchronization lock. When these objects are used to replace instance variables, they should almost always be declared ...
Executor: Interface for objects that execute Runnables, as well as various objects that can be wrapped as Runnables. The main reason to use Executor throughout a program or subsystem is to provide flexibility: You can easily change from using thread-per-task to using pools or queuing, without needing to change most of your code that generates tasks. The general intent is that execution be asynchronous, or at least independent of the caller. For example, one of the simplest implementations of execute (as performed in ThreadedExecutor) is new Thread(command).start(); . However, this interface allows implementations ...
SynchronousChannel: A rendezvous channel, similar to those used in CSP and Ada. Each put must wait for a take, and vice versa. Synchronous channels are well suited for handoff designs, in which an object running in one thread must synch up with an object running in another thread in order to hand it some information, event, or task. If you only need threads to synch up without exchanging information, consider using a Barrier. If you need bidirectional exchanges, consider using a Rendezvous. [ Introduction to this package. ]
LinkedQueue: A linked list based channel implementation. The algorithm avoids contention between puts and takes when the queue is not empty. Normally a put and a take can proceed simultaneously. (Although it does not allow multiple concurrent puts or takes.) This class tends to perform more efficently than other Channel implementations in producer/consumer applications. [ Introduction to this package. ]
Puttable: This interface exists to enable stricter type checking for channels. A method argument or instance variable in a producer object can be declared as only a Puttable rather than a Channel, in which case a Java compiler will disallow take operations. Full method descriptions appear in the Channel interface. [ Introduction to this package. ]
Takable: This interface exists to enable stricter type checking for channels. A method argument or instance variable in a consumer object can be declared as only a Takable rather than a Channel, in which case a Java compiler will disallow put operations. Full method descriptions appear in the Channel interface. [ Introduction to this package. ]
ThreadFactory: Interface describing any class that can generate new Thread objects. Using ThreadFactories removes hardwiring of calls to new Thread , enabling applications to use special thread subclasses, default prioritization settings, etc. [ Introduction to this package. ]
ThreadFactoryUser: Base class for Executors and related classes that rely on thread factories. Generally intended to be used as a mixin-style abstract class, but can also be used stand-alone. [ Introduction to this package. ]
BoundedChannel: A channel that is known to have a capacity, signifying that put operations may block when the capacity is reached. Various implementations may have intrinsically hard-wired capacities, capacities that are fixed upon construction, or dynamically adjustable capacities.
BoundedBuffer: Efficient array-based bounded buffer class. Adapted from CPJ, chapter 8, which describes design. [ Introduction to this package. ]
SynchronizedInt: A class useful for offloading synch for int instance variables. [ Introduction to this package. ]
DefaultChannelCapacity: A utility class to set the default capacity of BoundedChannel implementations that otherwise require a capacity argument
LinkedNode: A standard linked list node used in various queue classes