Class SingleInstanceConnectionPool

  • All Implemented Interfaces:
    de.jnkconsulting.e3dc.easyrscp.api.connection.ConnectionPool

    
    public final class SingleInstanceConnectionPool
     implements ConnectionPool
                        

    ConnectionPool 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

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      HomePowerPlantConnection getConnection()
      Unit releaseConnection(HomePowerPlantConnection toRelease)
      <R extends Any> R executeAndRelease(Function1<HomePowerPlantConnection, R> receiver)
      Unit shutdown()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SingleInstanceConnectionPool

        SingleInstanceConnectionPool(HomePowerPlantConnectionFactory connector, Long timeoutMillis)
        Parameters:
        connector - Factory to be used to connect to the home power plant
        timeoutMillis - Timeout in milliseconds.