Class OPartitionedDatabasePool
- All Implemented Interfaces:
OOrientListener,OOrientShutdownListener,OOrientStartupListener
To acquire connection from the pool call acquire() method but to release connection
you just need to call ODatabase.close() method.
In case of remote storage database pool will keep connections to the remote storage till you close pool. So in case of remote storage you should close pool at the end of it's usage, it also may be closed on application shutdown but you should not rely on this behaviour.
This pool has one noticeable difference from other pools. If you perform several subsequent acquire calls in the same thread the same instance of database will be returned, but amount of calls to close method should match to amount of acquire calls to release database back in the pool. It will allow you to use such feature as transaction propagation when you perform call of one service from another one.
Given pool has two parameters now, amount of maximum connections for single partition and total amount of connections which may be hold by pool. When you start to use pool it will automatically split by several partitions, each partition is independent from other which gives us very good multicore scalability. Amount of partitions will be close to amount of cores but it is not mandatory and depends how much application is loaded. Amount of connections which may be hold by single partition is defined by user but we suggest to use default parameters if your application load is not extremely high.
If total amount of connections which allowed to be hold by this pool is reached thread will wait till free connection will be available. If total amount of connection is set to value 0 or less it means that there is no connection limit.
- Since:
- 06/11/14
- Author:
- Andrey Lomakin (a.lomakin-at-orientdb.com)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOPartitionedDatabasePool(String url, String userName, String password) Deprecated.OPartitionedDatabasePool(String url, String userName, String password, int maxPartitionSize, int maxPoolSize) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionacquire()Deprecated.voidclose()Deprecated.intDeprecated.intDeprecated.intDeprecated.getProperty(String iName) Deprecated.Gets the property value.getUrl()Deprecated.Deprecated.booleanDeprecated.booleanisClosed()Deprecated.voidDeprecated.voidDeprecated.protected voidopenDatabase(com.orientechnologies.orient.core.db.OPartitionedDatabasePool.DatabaseDocumentTxPooled db) Deprecated.setAutoCreate(boolean autoCreate) Deprecated.setProperty(String iName, Object iValue) Deprecated.Sets a property valueMethods inherited from class com.orientechnologies.orient.core.OOrientListenerAbstract
onStorageRegistered, onStorageUnregistered
-
Field Details
-
properties
Deprecated.
-
-
Constructor Details
-
OPartitionedDatabasePool
Deprecated. -
OPartitionedDatabasePool
@Deprecated public OPartitionedDatabasePool(String url, String userName, String password, int maxPartitionSize, int maxPoolSize) Deprecated.
-
-
Method Details
-
getUrl
Deprecated. -
getUserName
Deprecated. -
getMaxPartitonSize
public int getMaxPartitonSize()Deprecated. -
getAvailableConnections
public int getAvailableConnections()Deprecated. -
getCreatedInstances
public int getCreatedInstances()Deprecated. -
acquire
Deprecated. -
isAutoCreate
public boolean isAutoCreate()Deprecated. -
setAutoCreate
Deprecated. -
isClosed
public boolean isClosed()Deprecated. -
openDatabase
protected void openDatabase(com.orientechnologies.orient.core.db.OPartitionedDatabasePool.DatabaseDocumentTxPooled db) Deprecated. -
onShutdown
public void onShutdown()Deprecated.- Specified by:
onShutdownin interfaceOOrientListener- Specified by:
onShutdownin interfaceOOrientShutdownListener- Overrides:
onShutdownin classOOrientListenerAbstract
-
onStartup
public void onStartup()Deprecated.- Specified by:
onStartupin interfaceOOrientStartupListener- Overrides:
onStartupin classOOrientListenerAbstract
-
close
public void close()Deprecated. -
setProperty
Deprecated.Sets a property value- Parameters:
iName- Property nameiValue- new value to set- Returns:
- The previous value if any, otherwise null
-
getProperty
Deprecated.Gets the property value.- Parameters:
iName- Property name- Returns:
- The previous value if any, otherwise null
-