35. Tries for ”timeOut” time units to insert an element into the tail of the queue. If not possible returns with an error instead of throwing an exception.
63. (a) newCachedThreadPool() : Constructs a thread pool that executes each task immediately.using an existing idle thread when available and creating a new thread otherwise.
64. (b) newFixedThreadPool() : Constructs a thread pool with a fixed size. If more tasks are submitted than available threads the unserved tasks are placed on a queue
99. Synchronizers (contd) Exchanger Allows two threads to exchange objects when both are ready for the exchange. When two threads work on two instances of the same data structure , one by filling an instance and other by emptying the others Semaphore Allows a set of threads to wait until permits are available fot proceeding To restrict the total number of threads that can access a resource. If permit count is one , use to block threads until another thread gives permission SynchronousQueue Allows a thread to hand off an object to another thread To send an object from one thread to another when both are ready,without explicit synchronization
105. Waits until all parties have called await on the barrier or until the timeout has been reached, in which case a TimeoutException is thrown. Upon success, returns the arrival index of this party. The first party has index parties - 1, and the last party has index 0.