Skip to content

Commit

Permalink
SAK-40833 Add unboundid configurable option RetryFailedOperationsDueT…
Browse files Browse the repository at this point in the history
…oInvalidConnections
  • Loading branch information
austin48 authored and Miguel Pellicer committed Oct 24, 2018
1 parent 60fd048 commit 1b7e555
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions providers/component/src/webapp/WEB-INF/unboundid-ldap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@
<value>10</value>
</property -->

<!-- Specifies whether attempts to process operations should be retried on a
newly-created connection if the initial attempt fails in a manner that
indicates that the connection used to process that request may no longer
be valid. May help with networks that close idle connections
Defaults to UnboundidDirectoryProvider.DEFAULT_RETRY_FAILED_OPERATIONS_DUE_TO_INVALID_CONNECTIONS (false) -->
<!-- property name="retryFailedOperationsDueToInvalidConnections">
<value>false</value>
</property -->

<!-- Optional. Size of batch when loading multiple users at once.
Defaults to DEFAULT_BATCH_SIZE = 200 -->
<!-- property name="batchSize">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public class UnboundidDirectoryProvider implements UserDirectoryProvider, LdapCo
/** Default LDAP maximum number of connections in the pool */
public static final int DEFAULT_POOL_MAX_CONNS = 10;

public static final boolean DEFAULT_RETRY_FAILED_OPERATIONS_DUE_TO_INVALID_CONNECTIONS = false;

/** Default LDAP maximum number of objects in a result */
public static final int DEFAULT_MAX_RESULT_SIZE = 1000;

Expand Down Expand Up @@ -148,6 +150,8 @@ public class UnboundidDirectoryProvider implements UserDirectoryProvider, LdapCo
/** Maximum number of physical connections in the pool */
private int poolMaxConns = DEFAULT_POOL_MAX_CONNS;

private boolean retryFailedOperationsDueToInvalidConnections = DEFAULT_RETRY_FAILED_OPERATIONS_DUE_TO_INVALID_CONNECTIONS;

/** Maximum number of results from one LDAP query */
private int maxResultSize = DEFAULT_MAX_RESULT_SIZE;

Expand Down Expand Up @@ -290,6 +294,7 @@ public void init()
try {
log.info("Creating LDAP connection pool of size " + poolMaxConns);
connectionPool = new LDAPConnectionPool(serverSet, bindRequest, poolMaxConns);
connectionPool.setRetryFailedOperationsDueToInvalidConnections(retryFailedOperationsDueToInvalidConnections);
} catch (com.unboundid.ldap.sdk.LDAPException e) {
log.error("Could not init LDAP pool", e);
}
Expand Down Expand Up @@ -1176,6 +1181,20 @@ public void setPoolMaxConns(int poolMaxConns) {
this.poolMaxConns = poolMaxConns;
}

/**
* {@inheritDoc}
*/
public boolean getRetryFailedOperationsDueToInvalidConnections() {
return retryFailedOperationsDueToInvalidConnections;
}

/**
* {@inheritDoc}
*/
public void setRetryFailedOperationsDueToInvalidConnections(boolean retryFailedOperationsDueToInvalidConnections) {
this.retryFailedOperationsDueToInvalidConnections = retryFailedOperationsDueToInvalidConnections;
}

/**
* {@inheritDoc}
*/
Expand Down

0 comments on commit 1b7e555

Please sign in to comment.