private final DeferredException closeException = new DeferredException();
void deleteEverything(Set<String> skipNames) throws IOException { final DeferredException deleteException = new DeferredException(); for(Entry<String, LuceneSearchIndex> index : indexes.asMap().entrySet()){ if (!skipNames.contains(index.getKey())) { try{ index.getValue().deleteEverything(); }catch(IOException e){ deleteException.addException(e); } } } try{ deleteException.close(); }catch(IOException ex){ throw ex; }catch(Exception ex){ throw new IOException("Failure deleting indeices.", ex); } }
/** * Process all events in the queue until it's empty. */ private void processEvents() { @SuppressWarnings("resource") final DeferredException deferredException = new DeferredException(); while (true) { T event; synchronized (queuedEvents) { if (queuedEvents.isEmpty()) { isProcessing = false; break; } event = queuedEvents.removeFirst(); } try { processEvent(event); } catch (Exception e) { deferredException.addException(e); } catch (AssertionError ae) { deferredException.addException(new RuntimeException("Caught an assertion", ae)); } } try { deferredException.close(); } catch(Exception e) { throw new RuntimeException("Exceptions caught during event processing", e); } }
final DeferredException ex = new DeferredException(); for(Host host1 : hosts){ try {
private void exclusively(ExclusiveOperation operation) throws IOException { // Attempt to acquire all exclusive locks to limit concurrent writes occurring. ArrayList<AutoCloseableLock> acquiredLocks = new ArrayList<>(exclusiveLocks.length); for (int i = 0; i < exclusiveLocks.length; i++) { try { // We cannot ensure that all write locks can be acquired, so a best attempt must be made. // If lock is still held after waiting 3 seconds, continue with the lock acquisition and close. // Note: The data from the concurrent write cannot be guaranteed to be persisted on restart. if (exclusiveLocks[i].tryOpen(3L, TimeUnit.SECONDS) != null) { acquiredLocks.add(exclusiveLocks[i]); } } catch (InterruptedException e) { // Do nothing. } } try(DeferredException deferred = new DeferredException()) { try { operation.execute(deferred); } catch(RocksDBException e) { deferred.addException(e); } deferred.suppressingClose(AutoCloseables.all(acquiredLocks)); } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException(e); } }
@Override public void close() throws Exception { DeferredException ex = new DeferredException(); if(plugins != null) { try (AutoCloseableLock l = plugins.writeLock()) { ex.suppressingClose(plugins); } } if(refresher != null) { refresher.cancel(false); } ex.suppressingClose(protocol); ex.suppressingClose(allocator); ex.close(); }
final AtomicReference<RelNode> logicalPlan = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final DeferredException ex = new DeferredException(); Job job = jobsService.submitJob(JobRequest.newBuilder() .setSqlQuery(new SqlQuery("select n_regionkey, max(n_nationkey) as max_nation from cp.\"tpch/nation.parquet\" group by n_regionkey", SYSTEM_USERNAME))
final DeferredException exception = new DeferredException(); final StatusHandler handler = new StatusHandler(exception); final TunnelProvider tunnelProvider = new TunnelProviderImpl(flushable.getAccountor(), coordTunnel, dataCreator, handler, sharedResources.getGroup(PIPELINE_RES_GRP));