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

# Class V11WireOperations

java.lang.Object
org.firebirdsql.gds.ng.wire.AbstractWireOperations
org.firebirdsql.gds.ng.wire.version10.V10WireOperations
org.firebirdsql.gds.ng.wire.version11.V11WireOperations

All Implemented Interfaces:
  `FbWireOperations`

Direct Known Subclasses:
  `V13WireOperations`

public class V11WireOperations extends V10WireOperations

Since:
  3.0
Author:
  Mark Rotteveel

- ## Nested Class Summary

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

  `FbWireOperations.ProcessAttachCallback`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `V11WireOperations(WireConnection<?,?> connection, WarningMessageCallback defaultWarningMessageCallback)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `afterEnqueueDeferredAction()`
  Action to perform after the deferred action has been queued in `enqueueDeferredAction(DeferredAction)`.
  `protected void`
  `afterProcessDeferredActions(int processedDeferredActions)`
  Can be used for additional actions after processing deferred actions (e.g.
  `void`
  `completeDeferredActions()`
  Completes pending deferred actions.
  `protected final boolean`
  `completeDeferredActionsRequiresSync()`
  Reports if an explicit sync action is required to complete deferred actions.
  `protected final int`
  `deferredActionCount()`
  The number of deferred actions currently waiting.
  `final void`
  `enqueueDeferredAction(DeferredAction deferredAction)`
  Enqueue a deferred action.
  `final void`
  `processDeferredActions()`
  Processes any deferred actions.

  ### Methods inherited from class org.firebirdsql.gds.ng.wire.version10.V10WireOperations

  `authReceiveResponse`

  ### Methods inherited from class org.firebirdsql.gds.ng.wire.AbstractWireOperations

  `addServerKeys, clearServerKeys, consumePackets, getAttachProperties, getClientAuthBlock, getConnection, getDefaultWarningMessageCallback, getEncoding, getPluginSpecificData, getXdrIn, getXdrOut, getXdrStreamAccess, handleCryptKeyCallback, processOperation, processResponse, processResponseWarnings, readBatchCompletionResponse, readGenericResponse, readInlineBlobResponse, readNextOperation, readOperationResponse, readResponse, readSqlResponse, readStatusVector, readStatusVector, setNetworkTimeout, withLock, writeDirect`

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

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

- ## Constructor Details

  - ### V11WireOperations

    public V11WireOperations(WireConnection<?,?> connection, WarningMessageCallback defaultWarningMessageCallback)

- ## Method Details

  - ### enqueueDeferredAction

    public final void enqueueDeferredAction(DeferredAction deferredAction) throws SQLException
    Description copied from interface: `FbWireOperations`
    Enqueue a deferred action.

    FbDatabase implementations that do not support deferred actions are allowed to throw an `UnsupportedOperationException` (which the default implementation does).

    Parameters:
      `deferredAction` - Deferred action
    Throws:
      `SQLException` - for errors forcing handling of oversized queue using `op_ping` (or `op_batch_sync`)

  - ### afterEnqueueDeferredAction

    protected void afterEnqueueDeferredAction() throws SQLException
    Action to perform after the deferred action has been queued in `enqueueDeferredAction(DeferredAction)`.

    This method should only be called by `enqueueDeferredAction(DeferredAction)`, and can be used to implement forcing processing of deferred actions if too many are queued.

    Throws:
      `SQLException` - for errors forcing handling of oversized queue using `op_ping` (or `op_batch_sync`)

  - ### deferredActionCount

    protected final int deferredActionCount()
    The number of deferred actions currently waiting.

    This method should be called when locked on `AbstractWireOperations.withLock()`.

    Returns:
      number of deferred actions

  - ### completeDeferredActionsRequiresSync

    protected final boolean completeDeferredActionsRequiresSync()
    Reports if an explicit sync action is required to complete deferred actions.

    For wire protocol v11 - v15, the only sync action needed is a flush, in v16 and higher an `op_ping` or `op_batch_sync` is needed (in some cases, a flush would suffice, but we're considering the worst case here).

    Failure to flush or sync (depending on the protocol version) may result in indefinite blocking. The sync action is not needed when deferred actions are processed as part of a normal request/response cycle (as there the request will behave as the sync action).

    Returns:
      `true` if one or more of the deferred action require an explicit sync action.
    Since:
      6

  - ### completeDeferredActions

    public void completeDeferredActions() throws SQLException
    Description copied from interface: `FbWireOperations`
    Completes pending deferred actions.

    Wire protocol implementations that do not support deferred actions should simply do nothing.

    Throws:
      `SQLException` - for errors forcing ping/batch sync

  - ### processDeferredActions

    public final void processDeferredActions()
    Description copied from interface: `FbWireOperations`
    Processes any deferred actions. Protocol versions that do not support deferred actions should simply do nothing.

    WARNING: If the server queues deferred responses, and expects an operation (e.g. `op_batch_sync`, `op_batch_exec` or `op_ping`) to actual send those responses, this method may block indefinitely.

  - ### afterProcessDeferredActions

    protected void afterProcessDeferredActions(int processedDeferredActions)
    Can be used for additional actions after processing deferred actions (e.g. trim a large deferred actions list to its default capacity).

    This implementation trims if `processedDeferredActions > 10`. When overridden, it is recommend to call this method through `super` to still trim (e.g. in a more limited set of circumstances) and perform any other actions this method may perform. If the overridden method wants to forgo trimming, it should pass `-1` for `processedDeferredActions`.

    Parameters:
      `processedDeferredActions` - number of processed deferred actions, or `-1` to ensure no trim is performed