Skip to content

kotkovkirill/pooltest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

ResourcePool is implemented on 2 non thread safe hashsets and two types of locks:

  • global lock with condition responsible for locking acquire method
  • internal lock on each resource object passed to remove method responsible for locking remove method

I decided not to use linkedblockingqueue due to the fact that requirements could not be implemented with one collection and we still need additional storage for "used" resources

There is a bunch of tests prepared in PoolImplTest.java, main one is testConcurrency, where thread safety of the class is checked

Possible ways to improve solution:

  • introduce waiting fairness
  • use threadlocals to improve performance if this resource pool is indended to use in typical scenario resource per thread (as for example connection pool)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages