Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng.wire
Interface FbWireAsynchronousChannel
- All Known Implementing Classes:
V10AsynchronousChannel
public interface FbWireAsynchronousChannel
Interface for the asynchronous channel used for event notification.
- Since:
- 3.0
- Author:
- Mark Rotteveel
-
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 channel
-
Method Details
-
connect
Connects the asynchronous channel to the specified port.- 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
Disconnect the asynchronous channel.Once closed, the connection can be reestablished using
connect(String, int, int).Calling
closeon a closed channel is a no-op; no exception should be thrown.- Throws:
SQLException- For errors closing the channel
-
isConnected
boolean isConnected()- Returns:
trueif connected, otherwisefalse
-
addChannelListener
Register a listener for this channel.- Parameters:
listener- Listener
-
removeChannelListener
Remove a listener from this channel- Parameters:
listener- Listener
-
getSocketChannel
- Returns:
- The socket channel associated with this asynchronous channel
- Throws:
SQLException- If not currently connected
-
getEventBuffer
ByteBuffer getEventBuffer()- Returns:
- The byte buffer for event data
-
processEventData
void processEventData()Process 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). -
queueEvent
Queues a wait for an event.- Parameters:
eventHandle- Event handle- Throws:
SQLException
-
cancelEvent
Cancels a registered event.- Parameters:
eventHandle- The event handle to cancel- Throws:
SQLException- For errors cancelling the event
-