The Java Semaphore class

The Java Semaphore class - Javamex Home Java...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Javamex Home Java synchronization Java threads Java profiling Java cryptography Java I/O NIO Java collections Home Synchronization and concurrency wait/notify synchronized keyword Java 5: ConcurrentHashMap Atomic variables Explicit locks Queues Semaphores Search Got a question about Java? Java discussion forum Controlling resources with the Semaphore class in Java 5 A common situation in server applications is that multiple threads compete for resources which are in some way limited in number: either because they are finite, or because (e.g. in the case of database connections) although we could theoretically have a large number, they are expensive to create and hold on to unnecessarily. A typical situation is this: we create a pool which can hold up to some maximum number of resources; at any one time, the pool knows how many resources it has created (in other words, if it is "allowed to create more"); when a thread needs one of the resources, it "requests" one from the pool; when it has finished with it, it...
View Full Document

Ask a homework question - tutors are online