Module jtrim.query

Interface ChannelOpener<ChannelType extends Channel>

Type Parameters:
ChannelType - the type of the channel opened by the ChannelOpener
All Known Implementing Classes:
FileChannelOpener

public interface ChannelOpener<ChannelType extends Channel>
Defines an interface to open a new Channel for processing. This interface must open a new channel each new request.

This interface was designed for the AsyncChannelLink and so to preserve the contract of AsyncDataLink instances of ChannelOpener must always open the channel to the same source (e.g.: to the same file) whenever requested.

Thread safety

Implementations of this interface must be safe to be accessed by multiple threads concurrently.

Synchronization transparency

Implementations of this interface are not required to be synchronization transparent.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Opens a new channel to the source defined by this ChannelOpener instance.
  • Method Details

    • openChanel

      ChannelType openChanel() throws IOException
      Opens a new channel to the source defined by this ChannelOpener instance. This method opens a new channel each time called an these opened channels must be closed separately.
      Returns:
      new channel to the source defined by this ChannelOpener instance. The returned instance must be closed in order to prevent resource leakage. This method never returns null.
      Throws:
      IOException - thrown if the channel could not be opened for some reasons