Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng.wire

# Class WireEventHandle

java.lang.Object
org.firebirdsql.gds.ng.AbstractEventHandle
org.firebirdsql.gds.ng.wire.WireEventHandle

All Implemented Interfaces:
  `EventHandle`, `AsynchronousChannelListener`

public final class WireEventHandle extends AbstractEventHandle implements AsynchronousChannelListener
Event handle for the wire protocol.

Since:
  3.0
Author:
  Mark Rotteveel

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.firebirdsql.gds.ng.wire.AsynchronousChannelListener

  `AsynchronousChannelListener.Event`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WireEventHandle(String eventName, EventHandler eventHandler, Encoding encoding)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `assignNewLocalId()`
  Generates a new local id for this event.
  `void`
  `calculateCount()`
  `void`
  `channelClosing(FbWireAsynchronousChannel channel)`
  Signals the closing of an asynchronous channel.
  `void`
  `eventReceived(FbWireAsynchronousChannel channel, AsynchronousChannelListener.Event event)`
  Signals that an event has been received.
  `int`
  `getEventId()`
  Get the internal event id number for this handle
  `int`
  `getLocalId()`
  `void`
  `setEventId(int eventId)`
  `byte[]`
  `toByteArray()`
  `String`
  `toString()`

  ### Methods inherited from class org.firebirdsql.gds.ng.AbstractEventHandle

  `getEventCount, getEventName, onEventOccurred, setEventCount`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### WireEventHandle

    public WireEventHandle(String eventName, EventHandler eventHandler, Encoding encoding)

- ## Method Details

  - ### calculateCount

    public void calculateCount()

  - ### setEventId

    public void setEventId(int eventId)
    Parameters:
      `eventId` - The server side id of this event

  - ### getEventId

    public int getEventId()
    Description copied from interface: `EventHandle`
    Get the internal event id number for this handle
    Specified by:
      `getEventId` in interface `EventHandle`
    Returns:
      The internal event id

  - ### assignNewLocalId

    public int assignNewLocalId()
    Generates a new local id for this event.

  - ### getLocalId

    public int getLocalId()
    Returns:
      The current local id of this event.

  - ### toByteArray

    public byte[] toByteArray() throws IOException
    Throws:
      `IOException`

  - ### channelClosing

    public void channelClosing(FbWireAsynchronousChannel channel)
    Description copied from interface: `AsynchronousChannelListener`
    Signals the closing of an asynchronous channel.

    Fired before the channel is actually closed.

    Specified by:
      `channelClosing` in interface `AsynchronousChannelListener`
    Parameters:
      `channel` - channel that is being closed

  - ### eventReceived

    public void eventReceived(FbWireAsynchronousChannel channel, AsynchronousChannelListener.Event event)
    Description copied from interface: `AsynchronousChannelListener`
    Signals that an event has been received.

    Implementations should take care to only perform short processing on the current thread. If longer or complicated processing is necessary, please offload it to another thread or executor.

    Specified by:
      `eventReceived` in interface `AsynchronousChannelListener`
    Parameters:
      `channel` - channel that received the event
      `event` - event received

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`