@Override public void close() throws Exception { AutoCloseables.close(pkgInputStream, sheetInputStream); } }
@Override public void close() { AutoCloseables.closeNoChecked(context); } }
/** * Called before committing the KV value to the store (and before incrementVersion is called). * * In the case of an remote KV store, this is called before the version retrieved from the master is set. * * @param value that is being committed * @return a AutoClosable that is called if the commit fails */ default AutoCloseable preCommit(T value) { return AutoCloseables.noop(); }
@Override public synchronized void close() { List<AutoCloseable> closeables = new ArrayList<>(); closeables.add(() -> super.close()); List<AutoCloseable> backList = new ArrayList<>(); backList.addAll(closeable.getCloseables()); Collections.reverse(backList); closeables.addAll(backList); AutoCloseables.closeNoChecked(AutoCloseables.all(closeables)); } }
private Pipeline get(PhysicalOperator operator) throws Exception { try(RollbackCloseable closeable = AutoCloseables.rollbackable(AutoCloseables.all(operators))) { final CreatorVisitor visitor = new CreatorVisitor(); OpPipe opPipe = operator.accept(visitor, null); Preconditions.checkNotNull(opPipe.getPipe()); Pipeline driver = new Pipeline(opPipe.getPipe(), visitor.terminal, operators, sharedResourcesContext); closeable.commit(); return driver; } }
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 { try{ AutoCloseables.close(vector, buf); }finally{ buf = null; } } }
@Override public void queryCompleted(QueryState state) { AutoCloseables.closeNoChecked(allocator); System.out.println("Total rows returned : " + count.get() + ". Returned in " + w.elapsed(TimeUnit.MILLISECONDS) + "ms."); }
@Override public AutoCloseable traceStart(int numRecords) { return AutoCloseables.noop(); }
@Override public void close() throws Exception { AutoCloseables.close(autoCloseables); } };
@Override public void submissionFailed(UserException ex) { AutoCloseables.closeNoChecked(allocator); this.ex = ex; }
@Override public AutoCloseable preCommit(NameSpaceContainer value) { if (value.getType() != NameSpaceContainer.Type.SOURCE) { return AutoCloseables.noop(); } // for sources, we want to maintain a numeric version so we can distinguish chronological order SourceConfig source = value.getSource(); Long configOrdinal= source.getConfigOrdinal(); value.getSource().setConfigOrdinal(configOrdinal == null ? 0 : configOrdinal + 1); return () -> { // rollback the ordinal in case the commit fails value.getSource().setConfigOrdinal(configOrdinal); }; }
@Override public void close() throws Exception { try{ AutoCloseables.close(projectBuildOffsetBuf, projectProbeSv2, projectNullKeyOffset, projectBuildKeyOffsetBuf, probed); } finally { projectBuildOffsetBuf = null; projectProbeSv2 = null; projectNullKeyOffset = null; projectBuildKeyOffsetBuf = null; probed = null; } }
public PriorityQueueCopier createCopier() throws Exception { Preconditions.checkState(tempContainer == null); Preconditions.checkState(mergeState == MergeState.COPY); if (copier != null) { AutoCloseables.closeNoChecked(copier); } tempContainer = VectorContainer.create(copierAllocator, dataSchema); return createCopier(tempContainer, this.diskRuns); }
AutoCloseable traceBuf = debugInsertion ? table.traceStart(records) : AutoCloseables.noop()) { long findAddr = offsets.memoryAddress(); table.insert(findAddr, records);
/** * decorator method to call multiple Partitioners close() */ public void close() throws Exception { AutoCloseables.close(partitioners); }
@Override public void close() { try { Metrics.resetMetrics(); } catch (Error | Exception e) { logger.warn("failure resetting metrics.", e); } executor.close(); AutoCloseables.closeNoChecked(allocator); }
@Override public void close() throws Exception { AutoCloseables.close(sample); } }