@Override public void close() { if (!this.closed.get()) { Futures.await(Services.stopAsync(this, this.executorService)); this.closed.set(true); } }
@Override public void close() { if (!this.closed.get()) { Futures.await(Services.stopAsync(this, this.executor)); log.info("{}: Closed.", this.traceObjectId); this.closed.set(true); } }
@Override public void close() { if (this.closed.compareAndSet(false, true)) { Futures.await(Services.stopAsync(this, this.executor)); this.storage.close(); log.info("Closed."); } }
@Override public void close() { if (!this.closed.get()) { Futures.await(Services.stopAsync(this, this.executor)); this.operationProcessor.close(); this.durableDataLog.close(); // Call this again just in case we were not able to do it in doStop(). log.info("{}: Closed.", this.traceObjectId); this.closed.set(true); } }
@Override public void close() { if (!this.closed.getAndSet(true)) { if (state() == State.RUNNING) { Futures.await(Services.stopAsync(this, this.executorService)); } synchronized (this.clients) { this.clients.clear(); } this.metrics.close(); log.info("{} Closed.", TRACE_OBJECT_ID); } }
@Override public CompletableFuture<Void> stopContainer(ContainerHandle handle, Duration timeout) { Exceptions.checkNotClosed(this.closed.get(), this); ContainerWithHandle result = this.containers.getOrDefault(handle.getContainerId(), null); if (result == null) { return CompletableFuture.completedFuture(null); // This could happen due to some race (or AutoClose) in the caller. } // Stop the container and then unregister it. return Services.stopAsync(result.container, this.executor); }
@Override public void close() { if (this.closed.compareAndSet(false, true)) { this.extensions.values().forEach(SegmentContainerExtension::close); Futures.await(Services.stopAsync(this, this.executor)); this.metadataCleaner.close(); this.writer.close(); this.durableLog.close(); this.readIndex.close(); this.storage.close(); log.info("{}: Closed.", this.traceObjectId); } }
@Override public void close() { if (!this.closed.get()) { try { Futures.await(Services.stopAsync(this, this.executor)); this.dataSource.deleteAllStreams() .exceptionally(ex -> { TestLogger.log(LOG_ID, "Unable to delete all Streams: %s.", ex); return null; }).join(); this.store.close(); } finally { ExecutorServiceHelpers.shutdown(this.executor); this.closed.set(true); TestLogger.log(LOG_ID, "Closed."); } } }
log.info("{}: Stopping.", this.traceObjectId); CompletableFuture.allOf( Services.stopAsync(this.metadataCleaner, this.executor), Services.stopAsync(this.writer, this.executor), Services.stopAsync(this.durableLog, this.executor)) .whenCompleteAsync((r, ex) -> { Throwable failureCause = getFailureCause(this.durableLog, this.writer, this.metadataCleaner);
@Override public void close() { if (!this.closed.getAndSet(true)) { Futures.await(Services.stopAsync(this, executorService())); ReusableLatch signal = this.closeReleaseSignal; if (signal != null) { // Wait until we are told to complete. signal.awaitUninterruptibly(); } } }
@Override protected void doStop() { long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "doStop"); log.info("{}: Stopping.", this.traceObjectId); Services.stopAsync(this.operationProcessor, this.executor) .whenCompleteAsync((r, ex) -> { cancelTailReads(); this.durableDataLog.close(); Throwable cause = this.stopException.get(); if (cause == null && this.operationProcessor.state() == State.FAILED) { cause = this.operationProcessor.failureCause(); } // Terminate the delayed start future now, if still active. this.delayedStart.completeExceptionally(cause == null ? new ObjectClosedException(this) : cause); if (cause == null) { // Normal shutdown. notifyStopped(); } else { // Shutdown caused by some failure. notifyFailed(cause); } log.info("{}: Stopped.", this.traceObjectId); LoggerHelpers.traceLeave(log, traceObjectId, "doStop", traceId); }, this.executor) .exceptionally(ex -> { notifyFailed(ex); return null; }); }