Module org.firebirdsql.jaybird
Class V10AsynchronousChannel
java.lang.Object
org.firebirdsql.gds.ng.wire.version10.V10AsynchronousChannel
- All Implemented Interfaces:
FbWireAsynchronousChannel
Asynchronous channel implementation for the V10 wire protocol.
- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister a listener for this channel.voidcancelEvent(EventHandle eventHandle) Cancels a registered event.voidclose()Disconnect the asynchronous channel.voidConnects the asynchronous channel to the specified port.booleanvoidProcess the current event data in the buffer.voidqueueEvent(EventHandle eventHandle) Queues a wait for an event.voidRemove a listener from this channelprotected final LockCloseablewithLock()
-
Constructor Details
-
V10AsynchronousChannel
-
-
Method Details
-
withLock
- See Also:
-
connect
Description copied from interface:FbWireAsynchronousChannelConnects the asynchronous channel to the specified port.- Specified by:
connectin interfaceFbWireAsynchronousChannel- Parameters:
hostName- HostnameportNumber- The port numberauxHandle- Handle identifier for this asynchronous channel- Throws:
SQLException- For errors connecting, or if the connection is already established
-
close
Description copied from interface:FbWireAsynchronousChannelDisconnect the asynchronous channel.Once closed, the connection can be reestablished using
FbWireAsynchronousChannel.connect(String, int, int).Calling
closeon a closed channel is a no-op; no exception should be thrown.- Specified by:
closein interfaceFbWireAsynchronousChannel- Throws:
SQLException- For errors closing the channel
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceFbWireAsynchronousChannel- Returns:
trueif connected, otherwisefalse
-
addChannelListener
Description copied from interface:FbWireAsynchronousChannelRegister a listener for this channel.- Specified by:
addChannelListenerin interfaceFbWireAsynchronousChannel- Parameters:
listener- Listener
-
removeChannelListener
Description copied from interface:FbWireAsynchronousChannelRemove a listener from this channel- Specified by:
removeChannelListenerin interfaceFbWireAsynchronousChannel- Parameters:
listener- Listener
-
getSocketChannel
- Specified by:
getSocketChannelin interfaceFbWireAsynchronousChannel- Returns:
- The socket channel associated with this asynchronous channel
- Throws:
SQLException- If not currently connected
-
getEventBuffer
- Specified by:
getEventBufferin interfaceFbWireAsynchronousChannel- Returns:
- The byte buffer for event data
-
processEventData
public void processEventData()Description copied from interface:FbWireAsynchronousChannelProcess the current event data in the buffer.This is only to be called by the
AsynchronousProcessor. Implementations should be ready to deal with incomplete data in the event buffer (eg by not processing).- Specified by:
processEventDatain interfaceFbWireAsynchronousChannel
-
queueEvent
Description copied from interface:FbWireAsynchronousChannelQueues a wait for an event.- Specified by:
queueEventin interfaceFbWireAsynchronousChannel- Parameters:
eventHandle- Event handle- Throws:
SQLException
-
cancelEvent
Description copied from interface:FbWireAsynchronousChannelCancels a registered event.- Specified by:
cancelEventin interfaceFbWireAsynchronousChannel- Parameters:
eventHandle- The event handle to cancel- Throws:
SQLException- For errors cancelling the event
-