Interface ConnectionCache<C extends Connection<?,?,?>>

Type Parameters:
C - class implementing Connection interface
All Known Implementing Classes:
AbstractConnector.DefaultConnectionCache

public interface ConnectionCache<C extends Connection<?,?,?>>
Interfaces for simple connection cache, which it is used inside a Connector.
Author:
igor@scictrl.com
  • Method Summary

    Modifier and Type
    Method
    Description
    add(C ch)
    Adds connection to the cache by it's name.
    void
    Removes all dead references and deleted connections.
    get(String name)
    Returns connection, which has provided name.
    remove(String name)
    Removes connection from cache.
  • Method Details

    • add

      C add(C ch)
      Adds connection to the cache by it's name. If any connection by same name already exists, it is released and returned.
      Parameters:
      ch - the connection to be placed in cache
      Returns:
      previous connection with this name, if it was any, otherwise null
    • remove

      C remove(String name)
      Removes connection from cache.
      Parameters:
      name - the name of connection to be removed from cache
      Returns:
      the removed connection, is exists, otherwise null
    • get

      C get(String name)
      Returns connection, which has provided name. Or null if no such connection.
      Parameters:
      name - the connection name
      Returns:
      the connection, or null
    • cleanup

      void cleanup()
      Removes all dead references and deleted connections.