本文整理了Java中com.unboundid.ldap.sdk.LDAPConnection.terminate()
方法的一些代码示例,展示了LDAPConnection.terminate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LDAPConnection.terminate()
方法的具体详情如下:
包路径:com.unboundid.ldap.sdk.LDAPConnection
类名称:LDAPConnection
方法名:terminate
[英]Unbinds from the server and closes the connection, optionally including the provided set of controls in the unbind request. This method is only intended for internal use, since it does not make any attempt to release the connection back to its associated connection pool, if there is one.
[中]从服务器解除绑定并关闭连接,可以选择在解除绑定请求中包含提供的控件集。此方法仅供内部使用,因为它不会尝试将连接释放回其关联的连接池(如果有)。
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* {@inheritDoc}
*/
@Override()
protected void doHealthCheck()
{
final Iterator<Map.Entry<Thread,LDAPConnection>> iterator =
connections.entrySet().iterator();
while (iterator.hasNext())
{
final Map.Entry<Thread,LDAPConnection> e = iterator.next();
final Thread t = e.getKey();
final LDAPConnection c = e.getValue();
if (! t.isAlive())
{
c.setDisconnectInfo(DisconnectType.POOLED_CONNECTION_UNNEEDED, null,
null);
c.terminate(null);
iterator.remove();
}
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
c.terminate(null);
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
c.terminate(null);
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Performs the real work of terminating a defunct connection and replacing it
* with a new connection if possible.
*
* @param connection The defunct connection to be replaced.
*/
private void handleDefunctConnection(final LDAPConnection connection)
{
final Thread t = Thread.currentThread();
connection.setDisconnectInfo(DisconnectType.POOLED_CONNECTION_DEFUNCT, null,
null);
connection.terminate(null);
connections.remove(t);
if (closed)
{
return;
}
try
{
final LDAPConnection conn = createConnection();
connections.put(t, conn);
}
catch (LDAPException le)
{
debugException(le);
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Indicates that the provided connection should be removed from the pool,
* and that no new connection should be created to take its place. This may
* be used to shrink the pool if such functionality is desired.
*
* @param connection The connection to be discarded.
*/
public void discardConnection(final LDAPConnection connection)
{
if (connection == null)
{
return;
}
connection.setDisconnectInfo(DisconnectType.POOLED_CONNECTION_UNNEEDED,
null, null);
connection.terminate(null);
poolStatistics.incrementNumConnectionsClosedUnneeded();
if (availableConnections.remainingCapacity() > 0)
{
final int newReplaceCount = failedReplaceCount.incrementAndGet();
if (newReplaceCount > numConnections)
{
failedReplaceCount.set(numConnections);
}
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Unbinds from the server and closes the connection, optionally including
* the provided set of controls in the unbind request.
* <BR><BR>
* If this method is invoked while any operations are in progress on this
* connection, then the directory server may or may not abort processing for
* those operations, depending on the type of operation and how far along the
* server has already gotten while processing that operation. It is
* recommended that all active operations be abandoned, canceled, or allowed
* to complete before attempting to close an active connection.
*
* @param controls The set of controls to include in the unbind request. It
* may be {@code null} if there are not to be any controls
* sent in the unbind request.
*/
public void close(final Control[] controls)
{
closeRequested = true;
setDisconnectInfo(DisconnectType.UNBIND, null, null);
if (connectionPool == null)
{
terminate(controls);
}
else
{
connectionPool.releaseDefunctConnection(this);
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
if (unbind)
conn.terminate(null);
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* {@inheritDoc}
*/
@Override()
public LDAPConnection replaceDefunctConnection(
final LDAPConnection connection)
throws LDAPException
{
poolStatistics.incrementNumConnectionsClosedDefunct();
connection.setDisconnectInfo(DisconnectType.POOLED_CONNECTION_DEFUNCT, null,
null);
connection.terminate(null);
connections.remove(Thread.currentThread(), connection);
if (closed)
{
throw new LDAPException(ResultCode.CONNECT_ERROR, ERR_POOL_CLOSED.get());
}
final LDAPConnection newConnection = createConnection();
connections.put(Thread.currentThread(), newConnection);
return newConnection;
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Indicates that the provided connection should be removed from the pool,
* and that no new connection should be created to take its place. This may
* be used to shrink the pool if such functionality is desired.
*
* @param connection The connection to be discarded.
*/
public void discardConnection(final LDAPConnection connection)
{
if (connection == null)
{
return;
}
connection.setDisconnectInfo(DisconnectType.POOLED_CONNECTION_UNNEEDED,
null, null);
connection.terminate(null);
poolStatistics.incrementNumConnectionsClosedUnneeded();
if (availableConnections.remainingCapacity() > 0)
{
final int newReplaceCount = failedReplaceCount.incrementAndGet();
if (newReplaceCount > numConnections)
{
failedReplaceCount.set(numConnections);
}
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Unbinds from the server and closes the connection, optionally including
* the provided set of controls in the unbind request.
* <BR><BR>
* If this method is invoked while any operations are in progress on this
* connection, then the directory server may or may not abort processing for
* those operations, depending on the type of operation and how far along the
* server has already gotten while processing that operation. It is
* recommended that all active operations be abandoned, canceled, or allowed
* to complete before attempting to close an active connection.
*
* @param controls The set of controls to include in the unbind request. It
* may be {@code null} if there are not to be any controls
* sent in the unbind request.
*/
@ThreadSafety(level=ThreadSafetyLevel.METHOD_NOT_THREADSAFE)
public void close(final Control[] controls)
{
closeRequested = true;
setDisconnectInfo(DisconnectType.UNBIND, null, null);
if (connectionPool == null)
{
terminate(controls);
}
else
{
connectionPool.releaseDefunctConnection(this);
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
connection.terminate(null);
conn.terminate(null);
return null;
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
if (unbind)
conn.terminate(null);
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
if (unbind)
conn.terminate(null);
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
conn.terminate(null);
connections.remove(t);
conn.terminate(null);
connections.remove(t);
conn.terminate(null);
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* {@inheritDoc}
*/
@Override()
public LDAPConnection replaceDefunctConnection(
final LDAPConnection connection)
throws LDAPException
{
poolStatistics.incrementNumConnectionsClosedDefunct();
connection.setDisconnectInfo(DisconnectType.POOLED_CONNECTION_DEFUNCT, null,
null);
connection.terminate(null);
if (closed)
{
throw new LDAPException(ResultCode.CONNECT_ERROR, ERR_POOL_CLOSED.get());
}
return createConnection();
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* {@inheritDoc}
*/
@Override()
public LDAPConnection replaceDefunctConnection(
final LDAPConnection connection)
throws LDAPException
{
poolStatistics.incrementNumConnectionsClosedDefunct();
connection.setDisconnectInfo(DisconnectType.POOLED_CONNECTION_DEFUNCT, null,
null);
connection.terminate(null);
if (closed)
{
throw new LDAPException(ResultCode.CONNECT_ERROR, ERR_POOL_CLOSED.get());
}
return createConnection();
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Closes the connection.
*/
public void run()
{
final AbstractConnectionPool pool = connection.getConnectionPool();
if (pool != null)
{
final LDAPConnectionPoolStatistics stats =
pool.getConnectionPoolStatistics();
if (stats != null)
{
stats.incrementNumConnectionsClosedUnneeded();
}
}
connection.setDisconnectInfo(DisconnectType.POOL_CLOSED, null, null);
if (unbind)
{
connection.terminate(null);
}
else
{
connection.setClosed();
}
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
connection.terminate(null);
poolStatistics.incrementNumConnectionsClosedExpired();
lastExpiredDisconnectTime = System.currentTimeMillis();
newConnection.terminate(null);
poolStatistics.incrementNumConnectionsClosedUnneeded();
null, null);
poolStatistics.incrementNumConnectionsClosedUnneeded();
connection.terminate(null);
return;
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Closes the connection.
*/
public void run()
{
final AbstractConnectionPool pool = connection.getConnectionPool();
if (pool != null)
{
final LDAPConnectionPoolStatistics stats =
pool.getConnectionPoolStatistics();
if (stats != null)
{
stats.incrementNumConnectionsClosedUnneeded();
}
}
connection.setDisconnectInfo(DisconnectType.POOL_CLOSED, null, null);
if (unbind)
{
connection.terminate(null);
}
else
{
connection.setClosed();
}
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
connection.terminate(null);
poolStatistics.incrementNumConnectionsClosedExpired();
lastExpiredDisconnectTime = System.currentTimeMillis();
内容来源于网络,如有侵权,请联系作者删除!