當前位置: 首頁>>代碼示例>>Java>>正文


Java InvalidConnectionException類代碼示例

本文整理匯總了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);
		}
   	}
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:21,代碼來源:AbstractLdapConnector.java

示例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" );
    }
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:19,代碼來源:LdapNetworkConnection.java

示例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);
}
 	}
 }
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:14,代碼來源:AbstractLdapConnector.java

示例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 );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:50,代碼來源:LdapNetworkConnection.java

示例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);
	}
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:9,代碼來源:AbstractSchemaTranslator.java


注:本文中的org.apache.directory.ldap.client.api.exception.InvalidConnectionException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。