{@inheritDoc}

@throws IllegalStateException If manager is already closed.
438086
@Override
    public void close() throws IOException, IllegalStateException {
        if (this.open.compareAndSet(true, false)) {
            try {
                this.eventGroup.shutdownGracefully(0L, 5L, TimeUnit.SECONDS).sync();
            } catch (Exception e) {
                throw new IOException("Could not be gracefully closed.", e);
            }
        } else {
            throw new IllegalStateException("Network Manager is already closed");
        }
    }
822764
public function close()
    {
        if (! isset($this->store)) {
            throw new NotOpenException('State already closed.');
        }
        if ($this->updated and $this->store->isMutable()) {
            $this->store->write($this->data);
        }
        $this->store->close();
        $this->store = null;
        $this->updated = false;
    }
125910
@GuardedBy("lock")
	private CompletableFuture<Void> shutDownResourceManagerComponents() {

		final Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(dispatcherResourceManagerComponents.size());

		for (DispatcherResourceManagerComponent<?> dispatcherResourceManagerComponent : dispatcherResourceManagerComponents) {
			terminationFutures.add(dispatcherResourceManagerComponent.closeAsync());
		}

		final FutureUtils.ConjunctFuture<Void> dispatcherTerminationFuture = FutureUtils.completeAll(terminationFutures);

		return FutureUtils.runAfterwards(
			dispatcherTerminationFuture,
			() -> {
				Exception exception = null;

				synchronized (lock) {
					if (resourceManagerLeaderRetriever != null) {
						try {
							resourceManagerLeaderRetriever.stop();
						} catch (Exception e) {
							exception = ExceptionUtils.firstOrSuppressed(e, exception);
						}

						resourceManagerLeaderRetriever = null;
					}

					if (dispatcherLeaderRetriever != null) {
						try {
							dispatcherLeaderRetriever.stop();
						} catch (Exception e) {
							exception = ExceptionUtils.firstOrSuppressed(e, exception);
						}

						dispatcherLeaderRetriever = null;
					}

					if (webMonitorLeaderRetrievalService != null) {
						try {
							webMonitorLeaderRetrievalService.stop();
						} catch (Exception e) {
							exception = ExceptionUtils.firstOrSuppressed(e, exception);
						}

						webMonitorLeaderRetrievalService = null;
					}
				}

				if (exception != null) {
					throw exception;
				}
			});
	}
530033
public function onBeforeAddToManager(Manager $manager)
    {
        $memberType = StaticSchema::inst()->typeNameForDataObject(Member::class);
        if ($manager->hasType($memberType)) {
            return;
        }

        /* @var SchemaScaffolder $owner */
        $owner = $this->owner;

        foreach ($owner->getTypes() as $scaffold) {
            if ($scaffold->getDataObjectInstance()->hasExtension(Versioned::class)) {
                $owner->type(Member::class);
                break;
            }
        }
    }
41412
public static <T> void throwIllegalStateExceptionIfAlreadyInstantiated(Class<T> clazz) {
        if (isInstantiated(clazz)) {
            throw new IllegalStateException(clazz.getSimpleName() + " has already been instantiated. Call SingletonMap.getInstance(" + clazz.getSimpleName() + ".class) to get the initialized instance.");
        }
    }
555427
@Override
	public void rollback() {
		for (ResourceManager<Transaction> manager : managers.values()) {
			Transaction transaction = manager.transaction();
			
			if (transaction.isActive()) {
				try {
					transaction.rollback();
				} catch (Exception e) {
					logger.warning("Transaction [" + transaction.getId()
							+ "]: Rollback failed due to [" + e
							+ "]; Consistency will be ensured in read");
				}
			}
		}
	}
426369
ListenableFuture<Void> closeAsync() {
    ListenableFuture<Void> retFuture = null;
    synchronized (lock) {
      if (closureFuture != null) {
        throw new IllegalStateException("Close has already been invoked");
      }
      // Fail all pending waiters.
      Waiter waiter = readWaiters.poll();
      while (waiter != null) {
        waiter.put(newSpannerException(ErrorCode.INTERNAL, "Client has been closed"));
        waiter = readWaiters.poll();
      }
      waiter = readWriteWaiters.poll();
      while (waiter != null) {
        waiter.put(newSpannerException(ErrorCode.INTERNAL, "Client has been closed"));
        waiter = readWriteWaiters.poll();
      }
      closureFuture = SettableFuture.create();
      retFuture = closureFuture;
      pendingClosure =
          totalSessions() + numSessionsBeingCreated + 1 /* For pool maintenance thread */;

      poolMaintainer.close();
      readSessions.clear();
      writePreparedSessions.clear();
      for (final PooledSession session : ImmutableList.copyOf(allSessions)) {
        if (session.leakedException != null) {
          logger.log(Level.WARNING, "Leaked session", session.leakedException);
        }
        if (session.state != SessionState.CLOSING) {
          closeSessionAsync(session);
        }
      }
    }
    retFuture.addListener(
        new Runnable() {
          @Override
          public void run() {
            executorFactory.release(executor);
          }
        },
        MoreExecutors.directExecutor());

    return retFuture;
  }
707151
@Override
    public void close() throws IllegalStateException, IOException {

        // validate state
        if (isClosed())
    	    throw new IllegalStateException("Serial connection is not open; cannot 'close()'.");

        // remove serial port listener
        SerialInterrupt.removeListener(fileDescriptor);

    	// close serial port now
        com.pi4j.jni.Serial.close(fileDescriptor);

        // reset file descriptor
        fileDescriptor = -1;
	}
564685
void checkNotClosed() throws JMSException {
        int currentState;
        synchronized (stateLock) {
            currentState = state;
        }
        if (currentState == CLOSED) {
            throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                               "SESSION_CLOSED_CWSIA0049",
                                                                               null,
                                                                               tc
                            );
        }
    }
157198
@Override
    public void onManagerEvent(ManagerEvent event)
    {

        // if this turns out to be slow, we could consider caching the reflection lookup

        try
        {

            Method method = this.getClass().getDeclaredMethod("handleEvent", new Class[]{event.getClass()});
            if (method != null)
            {
                method.invoke(this, event);
                return;
            }
        }
        catch (Exception e)
        {
            logger.error(e, e);
        }

        logger.error("The event " + event.getClass()
                + " couldn't be mapped to a method in AbstractManagerEventListener.java, someone should add it!");

    }
546493
private function _close()
    {
        if ($this->_closed) {
            // index is already closed and resources are cleaned up
            return;
        }

        $this->commit();

        // Release "under processing" flag
        Zend_Search_Lucene_LockManager::releaseReadLock($this->_directory);

        if ($this->_closeDirOnExit) {
            $this->_directory->close();
        }

        $this->_directory    = null;
        $this->_writer       = null;
        $this->_segmentInfos = null;

        $this->_closed = true;
    }
88321
@Override
    public void shutdown() {
        Throwable shutdownException = null;
        try {
            fire(new ManagerStopping());
        } catch (Exception e) {
            try {
                fireException(e);
            } catch (Exception e2) {
                shutdownException = e2;
            }
        }
        synchronized (this) {
            for (Context context : contexts) {
                context.clearAll();
            }
            contexts.clear();
            extensions.clear();

            runtimeLogger.clear();

            handledThrowables.remove();
        }
        if (shutdownException != null) {
            UncheckedThrow.throwUnchecked(shutdownException);
        }
    }
880232
public function closeManager($name = null)
    {
        $name = $name ?: $this->getDefaultManagerName();

        if (!$this->managerExists($name)) {
            throw new InvalidArgumentException(sprintf('Doctrine Manager named "%s" does not exist.', $name));
        }

        // force the creation of a new document manager
        // if the current one is closed
        $this->resetService(
            $this->getManagerBindingName($this->managers[$name])
        );

        $this->resetService(
            $this->getConnectionBindingName($this->connections[$name])
        );

        unset($this->managersMap[$name]);
        unset($this->connectionsMap[$name]);
    }
787124
protected void close()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "close"
                            );

        if (flushHelper != null)
            flushHelper.shutdown(); // Complete outstanding work.
        if (notifyHelper != null)
            notifyHelper.shutdown(); // No longer need a notify thread.

        logFile = null;

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "close"
                            );
    }
496716
public void close(AutoCloseable closeable) {
    try {
      closeable.close();
    } catch (Exception e) {
      throw new IllegalStateException("Fail to close " + closeable, e);
    }
  }
692801
public CompletableFuture<Void> close() {
    CompletableFuture<Void> future = new CompletableFuture<>();
    submitter.close()
      .thenCompose(v -> listener.close())
      .thenCompose(v -> manager.close())
      .whenComplete((managerResult, managerError) -> {
        connection.close().whenComplete((connectionResult, connectionError) -> {
          if (managerError != null) {
            future.completeExceptionally(managerError);
          } else if (connectionError != null) {
            future.completeExceptionally(connectionError);
          } else {
            future.complete(null);
          }
        });
      });
    return future;
  }
1277215
public void stop() throws DevFailed {
        try {
            if (isStarted.get()) {
                tangoClasses.clear();
                if (tangoExporter != null) {
                    tangoExporter.clearClass();
                    tangoExporter.unexportAll();
                }
                TangoCacheManager.shutdown();
                EventManager.getInstance().close();
                if (monitoring != null) {
                    monitoring.stop();
                }
            }
        } finally {
            ORBManager.shutdown();
            logger.info("everything has been shutdown normally");
            isStarted.set(false);
        }
    }