Class Adapter<TK extends Adapter.Toolkit>

    • Field Detail

      • endpoint

        protected final WSEndpoint<?> endpoint
      • pool

        protected volatile Pool<TK extends Adapter.Toolkit> pool
        Pool of Adapter.Toolkits. Instances of this pool may be replaced at runtime. Therefore, when you take an object out of the pool, you must make sure that it is recycled by the same instance of the pool.
    • Constructor Detail

      • Adapter

        protected Adapter​(WSEndpoint endpoint)
        Creates an Adapter that delivers messages to the given endpoint.
    • Method Detail

      • getEndpointComponent

        protected Component getEndpointComponent()
      • reconfigure

        public void reconfigure()
        The pool instance needs to be recreated to prevent reuse of old Toolkit instances.
        Specified by:
        reconfigure in interface Reconfigurable
      • getSPI

        public <S> S getSPI​(Class<S> spiType)
        Description copied from interface: Component
        Gets the specified SPI.

        This method works as a kind of directory service for SPIs, allowing various components to define private contract and talk to each other.

        Specified by:
        getSPI in interface Component
        Returns:
        null if such an SPI is not provided by this object.
      • getEndpoint

        public WSEndpoint<?> getEndpoint()
        Gets the endpoint that this Adapter is serving.
        Returns:
        always non-null.
      • getPool

        protected Pool<TK> getPool()
        Returns a reference to the pool of Toolkits for this adapter. The pool may be recreated during runtime reconfiguration and this method will then return a reference to a new instance. When you recycle a toolkit, you must make sure that you return it to the same pool instance that you took it from.
        Returns:
      • createToolkit

        protected abstract TK createToolkit()
        Creates a Adapter.Toolkit instance.

        If the derived class doesn't have to add any per-thread state to Adapter.Toolkit, simply implement this as new Toolkit().