Parallel- und Netzwerkprogrammierung Prüfung HS 2007 Prof. P. Sommerlad / R. Baumann java.util.concurrent Referenz (Auszug) Alle angegebenen Methoden, Interfaces sind public. Klassen und package java.util.concurrent: interface Callable<V> { V call() throws Exception; } interface Future<V> { boolean cancel(boolean mayInterruptIfRunning); boolean isCancelled(); boolean isDone(); V get() throws InterruptedException, ExecutionException; } interface Executor { void execute(Runnable command); } interface ExecutorService extends Executor { <T> Future<T> submit(Callable<T> task); Future<?> submit(Runnable task); } class ConcurrentHashMap<K,V> extends AbstractMap<K,V> implements ConcurrentMap<K,V>, Serializable {...} class CountDownLatch { CountDownLatch(int count); void await()throws InterruptedException; void countDown(); long getCount(); } class CyclicBarrier { public CyclicBarrier(int parties); int getParties(); int await()throws InterruptedException, BrokenBarrierException; boolean isBroken(); void reset(); int getNumberWaiting(); } class Exchanger<V> { V exchange(V x) throws InterruptedException; } class Semaphore { Semaphore(int permits); void acquire() throws InterruptedException; void acquire(int permits) throws InterruptedException; boolean tryAcquire() throws InterruptedException; boolean tryAcquire(int permits) throws InterruptedException; void release() void release(int permits) } package java.util.concurrent.atomic: class AtomicBoolean { boolean compareAndSet(boolean expect, boolean update) boolean get() boolean getAndSet(boolean newValue) boolean set(boolean newValue) } Teil 2 Seite 1/10 class AtomicInteger extends Number{ AtomicInteger(int initialValue) int get() void set(int newValue) int getAndSet(int newValue) boolean compareAndSet(int expect, int update) int getAndIncrement() int getAndDecrement() int getAndAdd(int delta) int incrementAndGet() int decrementAndGet() int addAndGet(int delta) int intValue() } package java.util.concurrent.locks: interface Condition { void await()throws InterruptedException; void signal(); void signalAll(); } interface Lock { void lock(); Condition newCondition(); boolean tryLock(); void unlock(); } interface ReadWriteLock { Lock readLock(); Lock writeLock(); } public class ReentrantLock : implements Lock{...} public class ReentrantReadWriteLock : implements ReentrantLock {...} package java.lang: interface Runnable { void run(); } class Thread implements Runnable { Thread(String name) Thread(Runnable target) static Thread currentThread() static void yield() static void sleep(long millis) throws InterruptedException void start() void run() void interrupt() boolean isInterrupted() final boolean isAlive() final void setName(String name) final String getName() final void join() throws InterruptedException long getId() } class ThreadLocal<T> { T get() void set(T value) }