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 TypeMethodDescriptionvoid
Register a listener for this channel.void
cancelEvent
(EventHandle eventHandle) Cancels a registered event.void
close()
Disconnect the asynchronous channel.void
Connects the asynchronous channel to the specified port.boolean
void
Process the current event data in the buffer.void
queueEvent
(EventHandle eventHandle) Queues a wait for an event.void
Remove a listener from this channelprotected final LockCloseable
withLock()
-
Constructor Details
-
V10AsynchronousChannel
-
-
Method Details
-
withLock
- See Also:
-
connect
Description copied from interface:FbWireAsynchronousChannel
Connects the asynchronous channel to the specified port.- Specified by:
connect
in 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:FbWireAsynchronousChannel
Disconnect the asynchronous channel.Once closed, the connection can be reestablished using
FbWireAsynchronousChannel.connect(String, int, int)
.Calling
close
on a closed channel is a no-op; no exception should be thrown.- Specified by:
close
in interfaceFbWireAsynchronousChannel
- Throws:
SQLException
- For errors closing the channel
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceFbWireAsynchronousChannel
- Returns:
true
if connected, otherwisefalse
-
addChannelListener
Description copied from interface:FbWireAsynchronousChannel
Register a listener for this channel.- Specified by:
addChannelListener
in interfaceFbWireAsynchronousChannel
- Parameters:
listener
- Listener
-
removeChannelListener
Description copied from interface:FbWireAsynchronousChannel
Remove a listener from this channel- Specified by:
removeChannelListener
in interfaceFbWireAsynchronousChannel
- Parameters:
listener
- Listener
-
getSocketChannel
- Specified by:
getSocketChannel
in interfaceFbWireAsynchronousChannel
- Returns:
- The socket channel associated with this asynchronous channel
- Throws:
SQLException
- If not currently connected
-
getEventBuffer
- Specified by:
getEventBuffer
in interfaceFbWireAsynchronousChannel
- Returns:
- The byte buffer for event data
-
processEventData
public void processEventData()Description copied from interface:FbWireAsynchronousChannel
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).- Specified by:
processEventData
in interfaceFbWireAsynchronousChannel
-
queueEvent
Description copied from interface:FbWireAsynchronousChannel
Queues a wait for an event.- Specified by:
queueEvent
in interfaceFbWireAsynchronousChannel
- Parameters:
eventHandle
- Event handle- Throws:
SQLException
-
cancelEvent
Description copied from interface:FbWireAsynchronousChannel
Cancels a registered event.- Specified by:
cancelEvent
in interfaceFbWireAsynchronousChannel
- Parameters:
eventHandle
- The event handle to cancel- Throws:
SQLException
- For errors cancelling the event
-