Class V11WireOperations
- All Implemented Interfaces:
FbWireOperations
- Direct Known Subclasses:
V13WireOperations
- 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
ConstructorsConstructorDescriptionV11WireOperations
(WireConnection<?, ?> connection, WarningMessageCallback defaultWarningMessageCallback) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Action to perform after the deferred action has been queued inenqueueDeferredAction(DeferredAction)
.protected void
afterProcessDeferredActions
(int processedDeferredActions) Can be used for additional actions after processing deferred actions (e.g.void
Completes pending deferred actions.protected final boolean
Reports if an explicit sync action is required to complete deferred actions.protected final int
The number of deferred actions currently waiting.final void
enqueueDeferredAction
(DeferredAction deferredAction) Enqueue a deferred action.final void
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, readNextOperation, readOperationResponse, readResponse, readSqlResponse, readStatusVector, readStatusVector, setNetworkTimeout, withLock, writeDirect
-
Constructor Details
-
V11WireOperations
public V11WireOperations(WireConnection<?, ?> connection, WarningMessageCallback defaultWarningMessageCallback)
-
-
Method Details
-
enqueueDeferredAction
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 usingop_ping
(orop_batch_sync
)
-
afterEnqueueDeferredAction
Action to perform after the deferred action has been queued inenqueueDeferredAction(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 usingop_ping
(orop_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
orop_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
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
orop_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 throughsuper
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
forprocessedDeferredActions
.- Parameters:
processedDeferredActions
- number of processed deferred actions, or-1
to ensure no trim is performed
-