本文整理匯總了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);
}
}