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
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 TypeMethodDescriptiondefault voidclose()ImplementsAutoCloseable.close()to calldisconnect().voidCall to disconnect any resources which we no longer need.booleanReturns whether this connection is connected.
-
Method Details
-
disconnect
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 methodclose(), inherited fromAutoCloseablecalls this method, which means that if an object of a class implementingIConnectionis 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 returnstrueuntil disconnect is called, even if the connection is created lazily.- Returns:
trueif connected,falseotherwise
-
close
ImplementsAutoCloseable.close()to calldisconnect(). Note: this method should not be overridden.- Specified by:
closein interfaceAutoCloseable- Throws:
EventException
-