javax.naming.ServiceUnavailableException Java Examples

The following examples show how to use javax.naming.ServiceUnavailableException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RetryHandlerBuilderTest.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@Test
public void testRetryOnThrowableCondition() throws Exception {
    Func1<Observable<? extends Throwable>, Observable<?>> retryFun = builder
            .withRetryOnThrowable(ex -> ex instanceof ServiceUnavailableException)
            .buildExponentialBackoff();

    observableOf("A", new ServiceUnavailableException("Retry me"), "B", new IllegalArgumentException("Do not retry"), "C")
            .retryWhen(retryFun, testScheduler)
            .subscribe(testSubscriber);

    // Expect first item
    testScheduler.triggerActions();
    assertThat(testSubscriber.getLatestItem()).isEqualTo("A");

    // Expect second item
    testScheduler.advanceTimeBy(RETRY_DELAY_SEC, TimeUnit.SECONDS);
    assertThat(testSubscriber.getLatestItem()).isEqualTo("B");

    // Expect third item
    testScheduler.advanceTimeBy(2 * RETRY_DELAY_SEC, TimeUnit.SECONDS);
    testSubscriber.assertOnError(IOException.class);

    assertThat(testSubscriber.isUnsubscribed());
}
 
Example #2
Source File: AadAuthenticationHelper.java    From azure-kusto-java with MIT License 6 votes vote down vote up
private AuthenticationResult acquireAccessTokenUsingDeviceCodeFlow() throws Exception {
    AuthenticationContext context = null;
    AuthenticationResult result = null;
    ExecutorService service = null;
    try {
        service = Executors.newSingleThreadExecutor();
        context = new AuthenticationContext(aadAuthorityUri, true, service);
        Future<DeviceCode> future = context.acquireDeviceCode(CLIENT_ID, clusterUrl, null);
        DeviceCode deviceCode = future.get();
        System.out.println(deviceCode.getMessage());
        if (Desktop.isDesktopSupported()) {
            Desktop.getDesktop().browse(new URI(deviceCode.getVerificationUrl()));
        }
        result = waitAndAcquireTokenByDeviceCode(deviceCode, context);


    } finally {
        if (service != null) {
            service.shutdown();
        }
    }
    if (result == null) {
        throw new ServiceUnavailableException("authentication result was null");
    }
    return result;
}
 
Example #3
Source File: AadAuthenticationHelper.java    From azure-kusto-java with MIT License 6 votes vote down vote up
AuthenticationResult acquireWithClientCertificate()
        throws InterruptedException, ExecutionException, ServiceUnavailableException {

    AuthenticationContext context;
    AuthenticationResult result = null;
    ExecutorService service = null;

    try {
        service = Executors.newSingleThreadExecutor();
        context = new AuthenticationContext(aadAuthorityUri, false, service);
        AsymmetricKeyCredential asymmetricKeyCredential = AsymmetricKeyCredential.create(applicationClientId,
                privateKey, x509Certificate);
        // pass null value for optional callback function and acquire access token
        result = context.acquireToken(clusterUrl, asymmetricKeyCredential, null).get();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } finally {
        if (service != null) {
            service.shutdown();
        }
    }
    if (result == null) {
        throw new ServiceUnavailableException("authentication result was null");
    }
    return result;
}
 
Example #4
Source File: AuthHelper.java    From ms-identity-java-webapp with MIT License 5 votes vote down vote up
IAuthenticationResult getAuthResultBySilentFlow(HttpServletRequest httpRequest, String scope) throws Throwable {
    IAuthenticationResult result =  AuthHelper.getAuthSessionObject(httpRequest);

    IAuthenticationResult updatedResult;
    ConfidentialClientApplication app;
    try {
        app = createClientApplication();

        Object tokenCache =  httpRequest.getSession().getAttribute("token_cache");
        if(tokenCache != null){
            app.tokenCache().deserialize(tokenCache.toString());
        }

        SilentParameters parameters = SilentParameters.builder(
                Collections.singleton(scope),
                result.account()).build();

        CompletableFuture<IAuthenticationResult> future = app.acquireTokenSilently(parameters);

        updatedResult = future.get();
    } catch (ExecutionException e) {
        throw e.getCause();
    }

    if (updatedResult == null) {
        throw new ServiceUnavailableException("authentication result was null");
    }

    //update session with latest token cache
    storeTokenCacheInSession(httpRequest, app.tokenCache().serialize());

    return updatedResult;
}
 
Example #5
Source File: DiscoveryClientController.java    From tutorials with MIT License 5 votes vote down vote up
@GetMapping("/discoveryClient")
public String discoveryPing() throws RestClientException, ServiceUnavailableException {
    URI service = serviceUrl().map(s -> s.resolve("/ping"))
        .orElseThrow(ServiceUnavailableException::new);
    return restTemplate.getForEntity(service, String.class)
        .getBody();
}
 
Example #6
Source File: TestJMXConnectorServer.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * This tests to validate the RegionServer's ConnectorServer after unauthorised stopRegionServer
 * call.
 */
@Test
public void testRSConnectorServerWhenStopRegionServer() throws Exception {
  conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY,
    JMXListener.class.getName() + "," + MyAccessController.class.getName());
  conf.setInt("regionserver.rmi.registry.port", rmiRegistryPort);
  UTIL.startMiniCluster();
  admin = UTIL.getConnection().getAdmin();

  hasAccess = false;
  ServerName serverName = UTIL.getHBaseCluster().getRegionServer(0).getServerName();
  LOG.info("Stopping Region Server...");
  admin.stopRegionServer(serverName.getHostname() + ":" + serverName.getPort());

  // Check whether Region Sever JMX Connector server can be connected
  JMXConnector connector = null;
  try {
    connector = JMXConnectorFactory
        .connect(JMXListener.buildJMXServiceURL(rmiRegistryPort, rmiRegistryPort));
  } catch (IOException e) {
    if (e.getCause() instanceof ServiceUnavailableException) {
      Assert.fail("Can't connect to Region Server ConnectorServer.");
    }
  }
  Assert.assertNotNull("JMXConnector should not be null.", connector);
  connector.close();
}
 
Example #7
Source File: JNDIProviderImpl.java    From ldapchai with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean errorIsRetryable( final Exception e )
{
    if ( e instanceof CommunicationException || e instanceof ServiceUnavailableException )
    {
        final String msgText = e.getMessage();
        if ( msgText != null && !msgText.toLowerCase().contains( "unrecognized extended operation" ) )
        {
            return true;
        }
    }

    return super.errorIsRetryable( e );
}
 
Example #8
Source File: ReactorRetryHandlerBuilderTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void testRetryOnThrowable() {
    StepVerifier
            .withVirtualTime(() ->
                    streamOf("A", new ServiceUnavailableException("Retry me"), "B", new IllegalArgumentException("Do not retry me."), "C")
                            .retryWhen(newRetryHandlerBuilder().withRetryOnThrowable(ex -> ex instanceof ServiceUnavailableException).buildReactorExponentialBackoff())
            )
            .expectNext("A")
            .expectNoEvent(Duration.ofSeconds(RETRY_DELAY_SEC))
            .expectNext("B")
            .expectErrorMatches(e -> e instanceof IOException && e.getCause() instanceof IllegalArgumentException)
            .verify();
}
 
Example #9
Source File: SearchFirstActiveDirectoryRealm.java    From centraldogma with Apache License 2.0 5 votes vote down vote up
/**
 * Builds an {@link AuthenticationInfo} object by querying the active directory LDAP context for the
 * specified username.
 */
@Nullable
@Override
protected AuthenticationInfo queryForAuthenticationInfo(
        AuthenticationToken token, LdapContextFactory ldapContextFactory) throws NamingException {
    try {
        return queryForAuthenticationInfo0(token, ldapContextFactory);
    } catch (ServiceUnavailableException e) {
        // It might be a temporary failure, so try again.
        return queryForAuthenticationInfo0(token, ldapContextFactory);
    }
}
 
Example #10
Source File: AadAuthenticationHelperTest.java    From azure-kusto-java with MIT License 5 votes vote down vote up
@Test
@DisplayName("validate cached token. Refresh if needed. Call regularly if no refresh token")
void useCachedTokenAndRefreshWhenNeeded() throws InterruptedException, ExecutionException, ServiceUnavailableException, IOException, DataServiceException, URISyntaxException, CertificateException, OperatorCreationException, PKCSException {
    String certFilePath = Paths.get("src", "test", "resources", "cert.cer").toString();
    String privateKeyPath = Paths.get("src", "test", "resources", "key.pem").toString();

    X509Certificate x509Certificate = readPem(certFilePath, "basic").getCertificate();
    PrivateKey privateKey = readPem(privateKeyPath, "basic").getKey();

    ConnectionStringBuilder csb = ConnectionStringBuilder
            .createWithAadApplicationCertificate("resource.uri", "client-id", x509Certificate, privateKey);

    AadAuthenticationHelper aadAuthenticationHelperSpy = spy(new AadAuthenticationHelper(csb));

    AuthenticationResult authenticationResult = new AuthenticationResult("testType", "firstToken", "refreshToken", 0, "id", mock(UserInfo.class), false);
    AuthenticationResult authenticationResultFromRefresh = new AuthenticationResult("testType", "fromRefresh", null, 90, "id", mock(UserInfo.class), false);
    AuthenticationResult authenticationResultNullRefreshTokenResult = new AuthenticationResult("testType", "nullRefreshResult", null, 0, "id", mock(UserInfo.class), false);

    doReturn(authenticationResultFromRefresh).when(aadAuthenticationHelperSpy).acquireAccessTokenByRefreshToken();
    doReturn(authenticationResult).when(aadAuthenticationHelperSpy).acquireWithClientCertificate();

    assertEquals("firstToken", aadAuthenticationHelperSpy.acquireAccessToken());

    // Token was passed as expired - expected to be refreshed
    assertEquals("fromRefresh", aadAuthenticationHelperSpy.acquireAccessToken());

    // Token is still valid - expected to return the same
    assertEquals("fromRefresh", aadAuthenticationHelperSpy.acquireAccessToken());

    doReturn(new Date(System.currentTimeMillis() + MIN_ACCESS_TOKEN_VALIDITY_IN_MILLISECS * 2)).when(aadAuthenticationHelperSpy).dateInAMinute();
    doReturn(authenticationResultNullRefreshTokenResult).when(aadAuthenticationHelperSpy).acquireWithClientCertificate();

    // Null refresh token + token is now expired- expected to authenticate again and reacquire token
    assertEquals("nullRefreshResult", aadAuthenticationHelperSpy.acquireAccessToken());
}
 
Example #11
Source File: AuthHelper.java    From ms-identity-java-webapp with MIT License 5 votes vote down vote up
IAuthenticationResult getAuthResultByAuthCode(
        HttpServletRequest httpServletRequest,
        AuthorizationCode authorizationCode,
        String currentUri, Set<String> scopes) throws Throwable {

    IAuthenticationResult result;
    ConfidentialClientApplication app;
    try {
        app = createClientApplication();

        String authCode = authorizationCode.getValue();
        AuthorizationCodeParameters parameters = AuthorizationCodeParameters.builder(
                authCode,
                new URI(currentUri))
                .scopes(scopes)
                .build();

        Future<IAuthenticationResult> future = app.acquireToken(parameters);

        result = future.get();
    } catch (ExecutionException e) {
        throw e.getCause();
    }

    if (result == null) {
        throw new ServiceUnavailableException("authentication result was null");
    }

    storeTokenCacheInSession(httpServletRequest, app.tokenCache().serialize());

    return result;
}
 
Example #12
Source File: AuthHelper.java    From ms-identity-java-webapp with MIT License 5 votes vote down vote up
private IAuthenticationResult getAuthResultByAuthCode(
        HttpServletRequest httpServletRequest,
        AuthorizationCode authorizationCode,
        String currentUri) throws Throwable {

    IAuthenticationResult result;
    ConfidentialClientApplication app;
    try {
        app = createClientApplication();

        String authCode = authorizationCode.getValue();
        AuthorizationCodeParameters parameters = AuthorizationCodeParameters.builder(
                authCode,
                new URI(currentUri)).
                build();

        Future<IAuthenticationResult> future = app.acquireToken(parameters);

        result = future.get();
    } catch (ExecutionException e) {
        throw e.getCause();
    }

    if (result == null) {
        throw new ServiceUnavailableException("authentication result was null");
    }

    SessionManagementHelper.storeTokenCacheInSession(httpServletRequest, app.tokenCache().serialize());

    return result;
}
 
Example #13
Source File: LDAPCertStoreHelper.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #14
Source File: LDAPCertStoreHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #15
Source File: JNDIContext.java    From tomee with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
    if (name == null) {
        throw new InvalidNameException("The name cannot be null");
    } else if (name.startsWith("java:")) {
        name = name.replaceFirst("^java:", "");
    } else if (!name.startsWith("/")) {
        name = tail + name;
    }

    final JNDIRequest req = new JNDIRequest(RequestMethodCode.JNDI_LIST, name);
    req.setModuleId(moduleId);

    final JNDIResponse res;
    try {
        res = request(req);
    } catch (Exception e) {
        if (e instanceof RemoteException && e.getCause() instanceof ConnectException) {
            e = (Exception) e.getCause();
            throw (ServiceUnavailableException) new ServiceUnavailableException("Cannot list '" + name + "'.").initCause(e);
        }
        throw (NamingException) new NamingException("Cannot list '" + name + "'.").initCause(e);
    }

    switch (res.getResponseCode()) {

        case ResponseCodes.JNDI_OK:
            return null;

        case ResponseCodes.JNDI_ENUMERATION:
            return (NamingEnumeration) res.getResult();

        case ResponseCodes.JNDI_NOT_FOUND:
            throw new NameNotFoundException(name);

        case ResponseCodes.JNDI_NAMING_EXCEPTION:
            final Throwable throwable = ((ThrowableArtifact) res.getResult()).getThrowable();
            if (throwable instanceof NamingException) {
                throw (NamingException) throwable;
            }
            throw (NamingException) new NamingException().initCause(throwable);

        case ResponseCodes.JNDI_ERROR:
            throw (Error) res.getResult();

        default:
            throw new ClientRuntimeException("Invalid response from server :" + res.getResponseCode());
    }

}
 
Example #16
Source File: ElastistorUtil.java    From cloudstack with Apache License 2.0 4 votes vote down vote up
public Object executeCommand(String command, MultivaluedMap<String, String> params, Object responeObj) throws Throwable {

            if (!initialized) {
                throw new IllegalStateException("Error : ElastiCenterClient is not initialized.");
            }

            if (command == null || command.trim().isEmpty()) {
                throw new InvalidParameterException("No command to execute.");
            }

            try {
                ClientConfig config = new DefaultClientConfig();
                Client client = Client.create(config);
                WebResource webResource = client.resource(UriBuilder.fromUri(restprotocol + elastiCenterAddress + restpath).build());

                MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
                queryParams.add(queryparamapikey, apiKey);
                queryParams.add(queryparamresponse, responseType);

                queryParams.add(queryparamcommand, command);

                if (null != params) {
                    for (String key : params.keySet()) {
                        queryParams.add(key, params.getFirst(key));
                    }
                }
                if (debug) {
                    System.out.println("Command Sent " + command + " : " + queryParams);
                }
                ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);

                if (response.getStatus() >= 300) {
                    if (debug)
                        System.out.println("ElastiCenter returned error code : " + response.getStatus());
                    if (401 == response.getStatus()) {
                        throw new InvalidCredentialsException("Please specify a valid API Key.");
                    } else if (431 == response.getStatus()) {
                        throw new InvalidParameterException(response.getHeaders().getFirst("X-Description"));
                    } else if (432 == response.getStatus()) {
                        throw new InvalidParameterException(command + " does not exist on the ElastiCenter server.  Please specify a valid command or contact your ElastiCenter Administrator.");
                    } else {
                        throw new ServiceUnavailableException("Internal Error. Please contact your ElastiCenter Administrator.");
                    }
                } else if (null != responeObj) {
                    String jsonResponse = response.getEntity(String.class);
                    if (debug) {
                        System.out.println("Command Response : " + jsonResponse);
                    }
                    Gson gson = new Gson();
                    return gson.fromJson(jsonResponse, responeObj.getClass());
                } else {
                    return "Success";
                }
            } catch (Throwable t) {
                throw t;
            }
        }
 
Example #17
Source File: ElastistorUtil.java    From cloudstack with Apache License 2.0 4 votes vote down vote up
public ElastiCenterClient(String address, String key) throws InvalidCredentialsException, InvalidParameterException, SSLHandshakeException, ServiceUnavailableException {
    elastiCenterAddress = address;
    apiKey = key;
    initialize();
}
 
Example #18
Source File: Connection.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr)
        throws IOException, NamingException {
    BerDecoder rber;
    boolean waited = false;

    while (((rber = ldr.getReplyBer()) == null) && !waited) {
        try {
            // If socket closed, don't even try
            synchronized (this) {
                if (sock == null) {
                    throw new ServiceUnavailableException(host + ":" + port +
                        "; socket closed");
                }
            }
            synchronized (ldr) {
                // check if condition has changed since our last check
                rber = ldr.getReplyBer();
                if (rber == null) {
                    if (readTimeout > 0) {  // Socket read timeout is specified

                        // will be woken up before readTimeout only if reply is
                        // available
                        ldr.wait(readTimeout);
                        waited = true;
                    } else {
                        // no timeout is set so we wait infinitely until
                        // a response is received
                        // https://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
                        ldr.wait();
                    }
                } else {
                    break;
                }
            }
        } catch (InterruptedException ex) {
            throw new InterruptedNamingException(
                "Interrupted during LDAP operation");
        }
    }

    if ((rber == null) && waited) {
        abandonRequest(ldr, null);
        throw new NamingException("LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
Example #19
Source File: LDAPCertStoreHelper.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #20
Source File: Connection.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr)
        throws IOException, NamingException {
    BerDecoder rber;
    boolean waited = false;

    while (((rber = ldr.getReplyBer()) == null) && !waited) {
        try {
            // If socket closed, don't even try
            synchronized (this) {
                if (sock == null) {
                    throw new ServiceUnavailableException(host + ":" + port +
                        "; socket closed");
                }
            }
            synchronized (ldr) {
                // check if condition has changed since our last check
                rber = ldr.getReplyBer();
                if (rber == null) {
                    if (readTimeout > 0) {  // Socket read timeout is specified

                        // will be woken up before readTimeout only if reply is
                        // available
                        ldr.wait(readTimeout);
                        waited = true;
                    } else {
                        // no timeout is set so we wait infinitely until
                        // a response is received
                        // https://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
                        ldr.wait();
                    }
                } else {
                    break;
                }
            }
        } catch (InterruptedException ex) {
            throw new InterruptedNamingException(
                "Interrupted during LDAP operation");
        }
    }

    if ((rber == null) && waited) {
        abandonRequest(ldr, null);
        throw new NamingException("LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
Example #21
Source File: LDAPCertStoreHelper.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #22
Source File: LDAPCertStoreHelper.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #23
Source File: Connection.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr)
        throws IOException, NamingException {
    BerDecoder rber;
    boolean waited = false;

    while (((rber = ldr.getReplyBer()) == null) && !waited) {
        try {
            // If socket closed, don't even try
            synchronized (this) {
                if (sock == null) {
                    throw new ServiceUnavailableException(host + ":" + port +
                        "; socket closed");
                }
            }
            synchronized (ldr) {
                // check if condition has changed since our last check
                rber = ldr.getReplyBer();
                if (rber == null) {
                    if (readTimeout > 0) {  // Socket read timeout is specified

                        // will be woken up before readTimeout only if reply is
                        // available
                        ldr.wait(readTimeout);
                        waited = true;
                    } else {
                        ldr.wait(15 * 1000); // 15 second timeout
                    }
                } else {
                    break;
                }
            }
        } catch (InterruptedException ex) {
            throw new InterruptedNamingException(
                "Interrupted during LDAP operation");
        }
    }

    if ((rber == null) && waited) {
        removeRequest(ldr);
        throw new NamingException("LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
Example #24
Source File: LDAPCertStoreHelper.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #25
Source File: Connection.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr)
        throws IOException, NamingException {
    BerDecoder rber;
    boolean waited = false;

    while (((rber = ldr.getReplyBer()) == null) && !waited) {
        try {
            // If socket closed, don't even try
            synchronized (this) {
                if (sock == null) {
                    throw new ServiceUnavailableException(host + ":" + port +
                        "; socket closed");
                }
            }
            synchronized (ldr) {
                // check if condition has changed since our last check
                rber = ldr.getReplyBer();
                if (rber == null) {
                    if (readTimeout > 0) {  // Socket read timeout is specified

                        // will be woken up before readTimeout only if reply is
                        // available
                        ldr.wait(readTimeout);
                        waited = true;
                    } else {
                        ldr.wait(15 * 1000); // 15 second timeout
                    }
                } else {
                    break;
                }
            }
        } catch (InterruptedException ex) {
            throw new InterruptedNamingException(
                "Interrupted during LDAP operation");
        }
    }

    if ((rber == null) && waited) {
        removeRequest(ldr);
        throw new NamingException("LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
Example #26
Source File: LDAPCertStoreHelper.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #27
Source File: LDAPCertStoreHelper.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #28
Source File: LDAPCertStoreHelper.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #29
Source File: LDAPCertStoreHelper.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}
 
Example #30
Source File: LDAPCertStoreHelper.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isCausedByNetworkIssue(CertStoreException e) {
    Throwable t = e.getCause();
    return (t != null && (t instanceof ServiceUnavailableException ||
                          t instanceof CommunicationException));
}