Search in sources :

Example 1 with DeferredAction

use of org.firebirdsql.gds.ng.wire.DeferredAction in project jaybird by FirebirdSQL.

the class V11Statement method free.

@Override
protected void free(final int option) throws SQLException {
    synchronized (getSynchronizationObject()) {
        try {
            doFreePacket(option);
            // intentionally no flush
            getDatabase().enqueueDeferredAction(new DeferredAction() {

                @Override
                public void processResponse(Response response) {
                    processFreeResponse(response);
                }

                @Override
                public WarningMessageCallback getWarningMessageCallback() {
                    return getStatementWarningCallback();
                }
            });
        } catch (IOException ex) {
            switchState(StatementState.ERROR);
            throw new FbExceptionBuilder().exception(ISCConstants.isc_net_write_err).cause(ex).toSQLException();
        }
    }
}
Also used : DeferredAction(org.firebirdsql.gds.ng.wire.DeferredAction) Response(org.firebirdsql.gds.ng.wire.Response) WarningMessageCallback(org.firebirdsql.gds.ng.WarningMessageCallback) FbExceptionBuilder(org.firebirdsql.gds.ng.FbExceptionBuilder) IOException(java.io.IOException)

Example 2 with DeferredAction

use of org.firebirdsql.gds.ng.wire.DeferredAction in project jaybird by FirebirdSQL.

the class V11WireOperations method processDeferredActions.

@Override
public final void processDeferredActions() {
    synchronized (getSynchronizationObject()) {
        if (deferredActions.size() == 0)
            return;
        final DeferredAction[] actions = deferredActions.toArray(new DeferredAction[0]);
        deferredActions.clear();
        for (DeferredAction action : actions) {
            try {
                action.processResponse(readSingleResponse(action.getWarningMessageCallback()));
            } catch (Exception ex) {
                // This only happen if the connection is no longer available
                // We ignore the exception and assume the next operation by the caller will fail as well
                log.debug("Exception in processDeferredActions", ex);
            }
        }
    }
}
Also used : DeferredAction(org.firebirdsql.gds.ng.wire.DeferredAction)

Aggregations

DeferredAction (org.firebirdsql.gds.ng.wire.DeferredAction)2 IOException (java.io.IOException)1 FbExceptionBuilder (org.firebirdsql.gds.ng.FbExceptionBuilder)1 WarningMessageCallback (org.firebirdsql.gds.ng.WarningMessageCallback)1 Response (org.firebirdsql.gds.ng.wire.Response)1