Search in sources :

Example 1 with AbandonRequestProtocolOp

use of com.unboundid.ldap.protocol.AbandonRequestProtocolOp in project ldapsdk by pingidentity.

the class LDAPConnection method abandon.

/**
 * Sends an abandon request with the provided information.
 *
 * @param  messageID  The message ID for the request to abandon.
 * @param  controls   The set of controls to include in the abandon request.
 *                    It may be {@code null} or empty if there are no
 *                    controls.
 *
 * @throws  LDAPException  If a problem occurs while sending the request to
 *                         the server.
 */
void abandon(final int messageID, @Nullable final Control... controls) throws LDAPException {
    try {
        connectionInternals.getConnectionReader().deregisterResponseAcceptor(messageID);
    } catch (final Exception e) {
        Debug.debugException(e);
    }
    connectionStatistics.incrementNumAbandonRequests();
    final int abandonMessageID = nextMessageID();
    if (Debug.debugEnabled(DebugType.LDAP)) {
        Debug.debugLDAPRequest(Level.INFO, createAbandonRequestString(messageID, controls), abandonMessageID, this);
    }
    final LDAPConnectionLogger logger = connectionOptions.getConnectionLogger();
    if (logger != null) {
        final List<Control> controlList;
        if (controls == null) {
            controlList = Collections.emptyList();
        } else {
            controlList = Arrays.asList(controls);
        }
        logger.logAbandonRequest(this, abandonMessageID, messageID, controlList);
    }
    sendMessage(new LDAPMessage(abandonMessageID, new AbandonRequestProtocolOp(messageID), controls), connectionOptions.getResponseTimeoutMillis(OperationType.ABANDON));
}
Also used : RetainIdentityRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.RetainIdentityRequestControl) LDAPMessage(com.unboundid.ldap.protocol.LDAPMessage) AbandonRequestProtocolOp(com.unboundid.ldap.protocol.AbandonRequestProtocolOp) LDIFException(com.unboundid.ldif.LDIFException)

Example 2 with AbandonRequestProtocolOp

use of com.unboundid.ldap.protocol.AbandonRequestProtocolOp in project ldapsdk by pingidentity.

the class LDAPConnection method abandon.

/**
 * Processes an abandon request with the provided information.
 *
 * @param  requestID  The async request ID for the request to abandon.
 * @param  controls   The set of controls to include in the abandon request.
 *                    It may be {@code null} or empty if there are no
 *                    controls.
 *
 * @throws  LDAPException  If a problem occurs while sending the request to
 *                         the server.
 */
public void abandon(@NotNull final AsyncRequestID requestID, @Nullable final Control[] controls) throws LDAPException {
    if (synchronousMode()) {
        throw new LDAPException(ResultCode.NOT_SUPPORTED, ERR_ABANDON_NOT_SUPPORTED_IN_SYNCHRONOUS_MODE.get());
    }
    final int messageID = requestID.getMessageID();
    try {
        connectionInternals.getConnectionReader().deregisterResponseAcceptor(messageID);
    } catch (final Exception e) {
        Debug.debugException(e);
    }
    connectionStatistics.incrementNumAbandonRequests();
    final int abandonMessageID = nextMessageID();
    if (Debug.debugEnabled(DebugType.LDAP)) {
        Debug.debugLDAPRequest(Level.INFO, createAbandonRequestString(messageID, controls), abandonMessageID, this);
    }
    final LDAPConnectionLogger logger = connectionOptions.getConnectionLogger();
    if (logger != null) {
        final List<Control> controlList;
        if (controls == null) {
            controlList = Collections.emptyList();
        } else {
            controlList = Arrays.asList(controls);
        }
        logger.logAbandonRequest(this, abandonMessageID, messageID, controlList);
    }
    sendMessage(new LDAPMessage(abandonMessageID, new AbandonRequestProtocolOp(messageID), controls), connectionOptions.getResponseTimeoutMillis(OperationType.ABANDON));
}
Also used : RetainIdentityRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.RetainIdentityRequestControl) LDAPMessage(com.unboundid.ldap.protocol.LDAPMessage) AbandonRequestProtocolOp(com.unboundid.ldap.protocol.AbandonRequestProtocolOp) LDIFException(com.unboundid.ldif.LDIFException)

Aggregations

AbandonRequestProtocolOp (com.unboundid.ldap.protocol.AbandonRequestProtocolOp)2 LDAPMessage (com.unboundid.ldap.protocol.LDAPMessage)2 RetainIdentityRequestControl (com.unboundid.ldap.sdk.unboundidds.controls.RetainIdentityRequestControl)2 LDIFException (com.unboundid.ldif.LDIFException)2