Class EventChannel
- java.lang.Object
-
- com.ibm.net.rdma.jverbs.cm.EventChannel
-
public class EventChannel extends java.lang.Object
Represents a communication channel.Event channels are used to receive all connection events for a ConnectionId. All connection events (e.g., RDMA_CM_EVENT_CONNECT_REQUEST, RDMA_CM_EVENT_ESTABLISHED) will be delivered through a channel. Event Channel is uniquely identified using File Descriptor.
EventChannel can be created using EventChannel.createEventChannel(). One can associate many ConnectionIds with single event channel by creating ConnectionId using same EventChannel object. Association of EventChannel with ConnectionId happens during ConnectionId creation using ConnectionId.createConnectionId which takes event channel as argument. ConnectionEvent can be retrieved on a channel by getConnectionEvent(timeout) and any event which is received needs to be acknowledged using ackConnectionEvent(). EventChannel cannot be destroyed id there is any unacknowledged ConnectionEvent
While associating many ids to single channel, user should take care of dispatching the event to appropriate ConnectionId. ConnectionId for which event is intended can be accessed by ConnectionEvent.getConnectionId() (connectionId) and ConnectionEvent.getListenId() (serverid).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
ackConnectionEvent(ConnectionEvent connEvent)
Acknowledges connection event.static EventChannel
createEventChannel()
Create new EventChannel.void
destroyEventChannel()
Close an event channel and resources associated with the channel.ConnectionEvent
getConnectionEvent(int timeout)
Retrieves a connection event.int
getFD()
The file descriptor which uniquely identifies this communication channel.
-
-
-
Method Detail
-
ackConnectionEvent
public void ackConnectionEvent(ConnectionEvent connEvent) throws java.lang.IllegalArgumentException, java.io.IOException
Acknowledges connection event. All events which are allocated by getConnectionEvent(timeout) of RDMA must be released, there should be a one-to-one correspondence between successful getConnectionEvent(timeout) and ackConnectionEvent().- Parameters:
connEvent
- Connection event to be acknowledged- Throws:
java.io.IOException
- If an I/O error occursjava.lang.IllegalArgumentException
-
createEventChannel
public static EventChannel createEventChannel() throws java.io.IOException
Create new EventChannel.- Returns:
- the rdma event channel
- Throws:
java.io.IOException
- If an I/O error occurs
-
destroyEventChannel
public void destroyEventChannel() throws java.io.IOException
Close an event channel and resources associated with the channel. All ConnectionIds associated with the channel needs to be destroyed and events returned should be acknowledged before calling this function.- Throws:
java.io.IOException
- If an I/O error occurs
-
getConnectionEvent
public ConnectionEvent getConnectionEvent(int timeout) throws java.io.IOException
Retrieves a connection event. If no events are pending, the call will block until specified timeout and return null. All events that are reported must be acknowledged by calling ackConnectionEvent(). EventChannel cannot be destroyed without acknowledging an already got event. Specifying a negative value in timeout means an infinite timeout.- Parameters:
timeout
- number in milliseconds or negative for infinite.- Returns:
- information about the next communication event.
- Throws:
java.io.IOException
- If an I/O error occurs
-
getFD
public int getFD()
The file descriptor which uniquely identifies this communication channel.- Returns:
- the file descriptor.
-
-