Class SingleInstanceConnectionPool
-
- All Implemented Interfaces:
-
de.jnkconsulting.e3dc.easyrscp.api.connection.ConnectionPool
public final class SingleInstanceConnectionPool implements ConnectionPoolConnectionPool which uses exactly one connection to the home power plant.
The one connection is kept ThreadSave and it is ensured that only one connection, which is not currently in use by another thread is used.
- Since:
2.0
-
-
Constructor Summary
Constructors Constructor Description SingleInstanceConnectionPool(HomePowerPlantConnectionFactory connector, Long timeoutMillis)
-
Method Summary
Modifier and Type Method Description HomePowerPlantConnectiongetConnection()UnitreleaseConnection(HomePowerPlantConnection toRelease)<R extends Any> RexecuteAndRelease(Function1<HomePowerPlantConnection, R> receiver)Unitshutdown()-
-
Constructor Detail
-
SingleInstanceConnectionPool
SingleInstanceConnectionPool(HomePowerPlantConnectionFactory connector, Long timeoutMillis)
- Parameters:
connector- Factory to be used to connect to the home power planttimeoutMillis- Timeout in milliseconds.
-
-
Method Detail
-
getConnection
HomePowerPlantConnection getConnection()
-
releaseConnection
Unit releaseConnection(HomePowerPlantConnection toRelease)
-
executeAndRelease
<R extends Any> R executeAndRelease(Function1<HomePowerPlantConnection, R> receiver)
-
-
-
-