Skip to main content

Resource Pooling


Requirements for Resource Pool:
  • Allow threads to access resources concurrently
  • Should block threads if no resource is available at the moment
  • Maintain a pool of initialized resources to allow reuse and avoid costly initialization of resources
Classes from java.util.concurrent package that will be used:
  • ConcurrentLinkedQueue - An unbounded thread-safe queue. This collection is ideal to act as container of resources since it provides concurrent non blocking access to its elements.
  • Semaphore - Semaphore maintains a set of permits by having a counter. This can be used to acquire or release a permit. If no permits are available then acquire() blocks the invoking thread.
Implementation

Code reference on github: Resource Pooling

Comments

  1. In most all cases, you will actually pay slightly less as a result of interest compounding only twice annually. mortgage payment calculator This emanates from understanding what decisions an individual is trying to create. mortgage calculator

    ReplyDelete

Post a Comment