@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
path = ShardPath.loadShardPath(logger, nodeEnv, shardId, this.indexSettings); } catch (Exception inner) { ex.addSuppressed(inner); throw ex;
@Override public void close() throws ResourceException { if (managedConnection == null) { IllegalStateException error = new IllegalStateException("connection already closed " + this); error.addSuppressed(closeTrace); throw error; } try { managedConnection.close(this); } finally { closeTrace = new Throwable("close stack trace"); managedConnection = null; } }
void stop(@Observes final BeforeShutdown beforeShutdown) { final IllegalStateException ise = new IllegalStateException("Something went wrong releasing health checks"); contexts.forEach(c -> { try { c.release(); } catch (final RuntimeException re) { ise.addSuppressed(re); } }); final Throwable[] suppressed = ise.getSuppressed(); if (suppressed.length == 1) { throw RuntimeException.class.cast(suppressed[0]); } else if (suppressed.length > 1) { throw ise; } }
protected void closeSubtransactions() { /* * We share one exception for all failures, which are added * as supressedExceptions to it. */ IllegalStateException failure = null; for (T subtransaction : backingTxs.values()) { try { subtransaction.close(); } catch (Exception e) { // If we did not allocated failure we allocate it if (failure == null) { failure = new IllegalStateException("Uncaught exception occured during closing transaction", e); } else { // We update it with additional exceptions, which occurred during error. failure.addSuppressed(e); } } } // If we have failure, we throw it at after all attempts to close. if (failure != null) { throw failure; } } }
private static MethodHandle getKrb5GetSessionKeyFunction() { Class<?> extendedContextClass; Class<?> inquireTypeClass; try { extendedContextClass = Class.forName("com.sun.security.jgss.ExtendedGSSContext", false, SpnegoAuthenticator.class.getClassLoader()); inquireTypeClass = Class.forName("com.sun.security.jgss.InquireType"); } catch (ClassNotFoundException e) { try { extendedContextClass = Class.forName("com.ibm.security.jgss.ExtendedGSSContext", false, SpnegoAuthenticator.class.getClassLoader()); inquireTypeClass = Class.forName("com.ibm.security.jgss.InquireType"); } catch (ClassNotFoundException e1) { IllegalStateException exception = new IllegalStateException("The code is running in an unknown java vm"); exception.addSuppressed(e); exception.addSuppressed(e1); throw exception; } } @SuppressWarnings("unchecked") Object getSessionKeyConst = Enum.valueOf(inquireTypeClass.asSubclass(Enum.class), "KRB5_GET_SESSION_KEY"); try { MethodHandle handle = MethodHandles.lookup().findVirtual(extendedContextClass, "inquireSecContext", MethodType.methodType(Object.class, inquireTypeClass)); return MethodHandles.insertArguments(handle, 0, getSessionKeyConst).asType(MethodType.methodType(Key.class, GSSContext.class)); } catch (NoSuchMethodException | IllegalAccessException e) { throw new IllegalStateException(e); } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
protected void closeSubtransactions() { /* * We share one exception for all failures, which are added * as supressedExceptions to it. */ IllegalStateException failure = null; for (T subtransaction : backingTxs.values()) { try { subtransaction.close(); } catch (Exception e) { // If we did not allocated failure we allocate it if (failure == null) { failure = new IllegalStateException("Uncaught exception occured during closing transaction", e); } else { // We update it with additional exceptions, which occurred during error. failure.addSuppressed(e); } } } // If we have failure, we throw it at after all attempts to close. if (failure != null) { throw failure; } }
private static void initAndTest() { WhiteBox.registerNatives(); WhiteBox w = new WhiteBox(); Throwable deoptMethod = null; try { w.deoptimizeMethod(WhiteBoxSupport.class.getMethod("initSafely")); w.isClassAlive(WhiteBoxSupport.class.getName()); } catch (Throwable ex) { deoptMethod = ex; } Throwable deoptAll = null; try { w.deoptimizeAll(); } catch (Throwable ex) { deoptAll = ex; } if (deoptMethod == null) { mode = Mode.DEOPT_METHOD; } else if (deoptAll == null) { mode = Mode.DEOPT_ALL; } else { IllegalStateException whiteBoxFailed = new IllegalStateException(); whiteBoxFailed.addSuppressed(deoptAll); whiteBoxFailed.addSuppressed(deoptMethod); throw whiteBoxFailed; } whiteBox = w; }
deletedLayers.forEach(this::addLayer); } catch (RuntimeException exceptionOnRestore) { wrappedException.addSuppressed(exceptionOnRestore);
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }
@GuardedBy("monitor") void checkHealthy() { if (states.count(RUNNING) != numberOfServices) { IllegalStateException exception = new IllegalStateException( "Expected to be healthy after starting. The following services are not running: " + Multimaps.filterKeys(servicesByState, not(equalTo(RUNNING)))); for (Service service : servicesByState.get(State.FAILED)) { exception.addSuppressed(new FailedService(service)); } throw exception; } } }