Class ODatabasePoolBase<DB extends ODatabaseInternal>
java.lang.Object
java.lang.Thread
com.orientechnologies.orient.core.db.ODatabasePoolBase<DB>
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
ODatabaseDocumentPool,OObjectDatabasePool
Database pool base class.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ODatabasePoolAbstract<DB>protected final Stringprotected final Stringprotected final StringFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedODatabasePoolBase(String iURL, String iUserName, String iUserPassword) -
Method Summary
Modifier and TypeMethodDescriptionacquire()Acquires a connection from the pool using the configured URL, user-name and user-password.Acquires a connection from the pool.Acquires a connection from the pool specifying options.voidclose()Closes the entire pool freeing all the connections.protected abstract DBcreateResource(Object owner, String iDatabaseName, Object... iAdditionalArgs) intgetAvailableConnections(String name, String userName) Returns amount of available connections which you can acquire for given source and user name.intgetConnectionsInCurrentThread(String name, String userName) intgetCreatedInstances(String name, String userName) intReturns the maximum size of the poolgetPools()Returns all the configured pools.voidDon't call it directly but use database.close().voidRemoves a pool by name/uservoidrun()setup()setup(int iMinSize, int iMaxSize) setup(int iMinSize, int iMaxSize, long idleTimeout, long timeBetweenEvictionRunsMillis) Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
url
-
userName
-
userPassword
-
dbPool
-
-
Constructor Details
-
ODatabasePoolBase
protected ODatabasePoolBase() -
ODatabasePoolBase
-
-
Method Details
-
setup
-
setup
-
setup
public ODatabasePoolBase<DB> setup(int iMinSize, int iMaxSize, long idleTimeout, long timeBetweenEvictionRunsMillis) -
acquire
Acquires a connection from the pool using the configured URL, user-name and user-password. If the pool is empty, then the caller thread will wait for it.- Returns:
- A pooled database instance
-
acquire
Acquires a connection from the pool. If the pool is empty, then the caller thread will wait for it.- Parameters:
iName- Database nameiUserName- User nameiUserPassword- User password- Returns:
- A pooled database instance
-
getAvailableConnections
Returns amount of available connections which you can acquire for given source and user name. Source id is consist of "source name" and "source user name".- Parameters:
name- Source name.userName- User name which is used to acquire source.- Returns:
- amount of available connections which you can acquire for given source and user name.
-
getCreatedInstances
-
acquire
public DB acquire(String iName, String iUserName, String iUserPassword, Map<String, Object> iOptionalParams) Acquires a connection from the pool specifying options. If the pool is empty, then the caller thread will wait for it.- Parameters:
iName- Database nameiUserName- User nameiUserPassword- User password- Returns:
- A pooled database instance
-
getConnectionsInCurrentThread
-
release
Don't call it directly but use database.close().- Parameters:
iDatabase-
-
close
public void close()Closes the entire pool freeing all the connections. -
getMaxSize
public int getMaxSize()Returns the maximum size of the pool -
getPools
Returns all the configured pools. -
remove
Removes a pool by name/user -
run
public void run() -
createResource
-