本文整理汇总了Java中org.apache.directory.ldap.client.api.exception.InvalidConnectionException类的典型用法代码示例。如果您正苦于以下问题:Java InvalidConnectionException类的具体用法?Java InvalidConnectionException怎么用?Java InvalidConnectionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InvalidConnectionException类属于org.apache.directory.ldap.client.api.exception包,在下文中一共展示了InvalidConnectionException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: schema
import org.apache.directory.ldap.client.api.exception.InvalidConnectionException; //导入依赖的package包/类
@Override
public Schema schema() {
if (!connectionManager.isConnected()) {
return null;
}
// always fetch fresh schema when this method is called
schemaManager = null;
schemaTranslator = null;
try {
return getSchemaTranslator().translateSchema(connectionManager);
} catch (InvalidConnectionException e) {
// The connection might have been disconnected. Try to reconnect.
connectionManager.connect();
try {
return getSchemaTranslator().translateSchema(connectionManager);
} catch (InvalidConnectionException e1) {
throw new ConnectorException("Reconnect error: "+e.getMessage(), e);
}
}
}
示例2: checkSession
import org.apache.directory.ldap.client.api.exception.InvalidConnectionException; //导入依赖的package包/类
/**
* Check that a session is valid, ie we can send requests to the
* server
*
* @throws Exception If the session is not valid
*/
private void checkSession() throws InvalidConnectionException
{
if ( ldapSession == null )
{
throw new InvalidConnectionException( "Cannot connect on the server, the connection is null" );
}
if ( !connected.get() )
{
throw new InvalidConnectionException( "Cannot connect on the server, the connection is invalid" );
}
}
示例3: prepareIcfSchema
import org.apache.directory.ldap.client.api.exception.InvalidConnectionException; //导入依赖的package包/类
private void prepareIcfSchema() {
try {
getSchemaTranslator().prepareIcfSchema(connectionManager);
} catch (InvalidConnectionException e) {
// The connection might have been disconnected. Try to reconnect.
connectionManager.connect();
try {
getSchemaTranslator().prepareIcfSchema(connectionManager);
} catch (InvalidConnectionException e1) {
throw new ConnectorException("Reconnect error: "+e.getMessage(), e);
}
}
}
示例4: writeRequest
import org.apache.directory.ldap.client.api.exception.InvalidConnectionException; //导入依赖的package包/类
/**
* a reusable code block to be used in various bind methods
*/
private void writeRequest( Request request ) throws LdapException
{
// Send the request to the server
WriteFuture writeFuture = ldapSession.write( request );
long localTimeout = timeout;
while ( localTimeout > 0 )
{
// Wait only 100 ms
boolean done = writeFuture.awaitUninterruptibly( 100 );
if ( done )
{
return;
}
// Wait for the message to be sent to the server
if ( !ldapSession.isConnected() )
{
// We didn't received anything : this is an error
LOG.error( "Message failed : something wrong has occurred" );
Exception exception = ( Exception ) ldapSession.removeAttribute( EXCEPTION_KEY );
if ( exception != null )
{
if ( exception instanceof LdapException )
{
throw ( LdapException ) exception;
}
else
{
throw new InvalidConnectionException( exception.getMessage(), exception );
}
}
throw new InvalidConnectionException( "Error while sending some message : the session has been closed" );
}
localTimeout -= 100;
}
LOG.error( "TimeOut has occurred" );
throw new LdapException( TIME_OUT_ERROR );
}
示例5: prepareIcfSchema
import org.apache.directory.ldap.client.api.exception.InvalidConnectionException; //导入依赖的package包/类
/**
* Make sure that we have icfSchema
*/
public void prepareIcfSchema(ConnectionManager<C> connectionManager) throws InvalidConnectionException {
if (icfSchema == null) {
translateSchema(connectionManager);
}
}