Package net.quasardb.qdb
Class SessionPool
java.lang.Object
net.quasardb.qdb.SessionPool
Session / connection pool. This class is thread-safe.
Simple, fixed-size pool where sessions are pre-allocated in the constructor.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SessionPool
- Parameters:
factory
- SessionFactory instance used to create new sessions.size
- Amount of sessions to pre-allocate.
-
-
Method Details
-
acquire
Take a session from the pool. May block if no sessions are available.- Throws:
InterruptedException
IOException
-
release
Release a session back to the pool.- Parameters:
s
- Session previously acquired from the pool- Throws:
InterruptedException
-
size
public int size()Returns the amount of sessions currently on the pool. -
close
Close the pool and all sessions associated with it. Should *not* be called when there are still sessions that are not released back to the pool yet.- Throws:
IOException
-