Interface IConnection

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
IConnectable, IJmsQueueReader<T>, IJobQueue<T>, IJobQueueServlet<T>, IPublisher<T>, IRequester<T>, IRequestResponseConnection, IResponder<T>, IResponderServlet<T>, ISubmitter<T>, ISubscriber<T>, ITopicConnection, IURIConnection
All Known Implementing Classes:
AbstractJobQueueServlet, AbstractResponderServlet, AbstractTopicConnection, AcquireServlet, AMQPSubscriberImpl, DeviceServlet, HeterogeneousScanServlet, JmsQueueReader, JobQueueImpl, JobQueueProxy, LiveStreamConnection, MalcolmDeviceProxy, MockScannableConnector, MockTopupScannable, NodeInsertionRequestResponder, PositionerServlet, ResponderImpl, RunnableDeviceServiceProxy, ScanServlet

public interface IConnection extends AutoCloseable
An instance of a class that implements this interfaces represents a connection of some kind that can be disconnected by calling the disconnect() method. Note that there is no connect() method, the connection is assumed to be either connected when created or automatically connects when necessary. It is undefined whether it is possible to reconnect to a connection. Subclasses may override this.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    void
    Call to disconnect any resources which we no longer need.
    boolean
    Returns whether this connection is connected.
  • Method Details

    • disconnect

      void disconnect() throws EventException
      Call to disconnect any resources which we no longer need. The resource may have timed out so it might not be connected, in that case it silently returns. Note, that the method close(), inherited from AutoCloseable calls this method, which means that if an object of a class implementing IConnection is used with a try-with-resources block this method will be called automatically when exiting that block.
      Throws:
      EventException - if resource could not be disconnected.
    • isConnected

      boolean isConnected()
      Returns whether this connection is connected. This method returns true until disconnect is called, even if the connection is created lazily.
      Returns:
      true if connected, false otherwise
    • close

      default void close() throws EventException
      Implements AutoCloseable.close() to call disconnect(). Note: this method should not be overridden.
      Specified by:
      close in interface AutoCloseable
      Throws:
      EventException