<p>Mark the destinationHandler as requiring
cleanup and start the asynchDeletionThread if it is not already running.</p>

@param dh
161346
public void markDestinationAsCleanUpPending(DestinationHandler dh)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "markDestinationAsCleanUpPending", dh);

        if (dh.isLink())
        {
            linkIndex.cleanup(dh);
        }
        else
        {
            destinationIndex.cleanup(dh);
        }

        //Start asynchDeletionThread if not already running
        startAsynchDeletion();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "markDestinationAsCleanUpPending");
    }
49053
protected void corruptDestination(DestinationHandler dh)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "corruptDestination", dh);

        if (!dh.isLink() && destinationIndex.containsDestination(dh))
        {
            destinationIndex.corrupt(dh);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "corruptDestination");
    }
814893
private void unready(final Handler<AsyncResult<Void>> doneHandler) {
    if (currentContext != null && data != null) {
      log.debug(String.format("%s - Pausing network", NetworkManager.this));
      data.remove(currentContext.status(), new Handler<AsyncResult<String>>() {
        @Override
        public void handle(AsyncResult<String> result) {
          if (result.failed()) {
            new DefaultFutureResult<Void>(result.cause()).setHandler(doneHandler);
          } else {
            new DefaultFutureResult<Void>((Void) null).setHandler(doneHandler);
          }
        }
      });
    }
  }
1004242
public void cleanUp(RESTRequest request) {
        //We need to loop through the clients but we don't want to synchronize
        //the entire map, which would block new clients from entering and block existing 
        //clients from continuing their work.  So we iterate and possibly remove by just
        //using the built-in concurrency of ConcurrentHashMap.
        final Iterator<Entry<Integer, ClientNotificationArea>> clients = inboxes.entrySet().iterator();

        while (clients.hasNext()) {
            Entry<Integer, ClientNotificationArea> client = clients.next();

            //Check for time outs
            ClientNotificationArea inbox = client.getValue();
            if (inbox.timedOut()) {
                //cleanup
                inbox.cleanUp(request);

                //Emit the warning
                Tr.warning(tc, "jmx.connector.server.rest.notification.timeout.warning", client.getKey());

                //remove the client inbox from the map (using the Iterator.remove() method)
                clients.remove();
            }
        }

    }
295830
public EventBusHookListener start(Handler<AsyncResult<Void>> doneHandler) {
    eventBus.registerHandler(address, messageHandler, doneHandler);
    return this;
  }
792697
@Override
    public void markAsDown(ConnectionException reason) {
        // Make sure we're not triggering the reconnect process more than once
        if (isReconnecting.compareAndSet(false, true)) {
            
            markedDownCount.incrementAndGet();
            
            if (reason != null && !(reason instanceof TimeoutException)) {
                discardIdleConnections();
            }
            
            listener.onHostDown(this);
            monitor .onHostDown(getHost(), reason);

            retryContext.begin();
            
            try {
                long delay = retryContext.getNextDelay();
                executor.schedule(new Runnable() {
                    @Override
                    public void run() {
                        Thread.currentThread().setName("RetryService : " + host.getName());
                        try {
                            if (activeCount.get() == 0)
                                reconnect();
                            
                            // Created a new connection successfully.
                            try {
                                retryContext.success();
                                if (isReconnecting.compareAndSet(true, false)) {
                                    monitor .onHostReactivated(host, SimpleHostConnectionPool.this);
                                    listener.onHostUp(SimpleHostConnectionPool.this);
                                }
                            }
                            catch (Throwable t) {
                                LOG.error("Error reconnecting client", t);
                            }
                            return;
                        }
                        catch (Throwable t) {
                            // Ignore
                            //t.printStackTrace();
                        }
                        
                        if (!isShutdown()) {
                            long delay = retryContext.getNextDelay();
                            executor.schedule(this, delay, TimeUnit.MILLISECONDS);
                        }
                    }
                }, delay, TimeUnit.MILLISECONDS);
            }
            catch (Exception e) {
                LOG.error("Failed to schedule retry task for " + host.getHostName(), e);
            }
        }
    }
73048
public boolean cleanupDestination() throws SIRollbackException, SIConnectionLostException, SIIncorrectCallException, SIResourceException 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "cleanupDestination");
  
    boolean cleanedUp;

    //Clean up any remote localisations, reallocate messages that are marked as guesses
    cleanedUp = super.cleanupLocalisations();
    //Ensure any cleanup does not occur at the same time the link is being used.
    synchronized(this)
    {        
      if (isToBeDeleted())
      {
        // Clean up any PubSub neighbours that were making use of 
        // the link
        
        messageProcessor.getProxyHandler().cleanupLinkNeighbour(_busName);
        
        // A link can have inbound target stream state without a localisation for
        // the messages to be put onto, as it routes the messages directly onto
        // other destinations in the bus.  Until all the inbound streams are flushed,
        // the link cannot be deleted.
        PtoPInputHandler ptoPInputHandler = (PtoPInputHandler) getInputHandler(ProtocolType.UNICASTINPUT, null, null);
        TargetStreamManager targetStreamManager = ptoPInputHandler.getTargetStreamManager();
        
        if (targetStreamManager.isEmpty())
        {
          cleanedUp = super.cleanupDestination();
        }
      }
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "cleanupDestination", new Boolean(cleanedUp));

    return cleanedUp;
  }
1277045
public void disconnect(Destination d) throws KNXLinkClosedException
	{
		if (detached)
			throw new KNXIllegalStateException("TL detached");
		if (d.getState() != Destination.DESTROYED
			&& d.getState() != Destination.DISCONNECTED)
			disconnectIndicate(getProxy(d), true);
	}
831505
private void cleanup(final String taskId)
  {
    if (!lifecycleLock.awaitStarted(1, TimeUnit.SECONDS)) {
      return;
    }
    final RemoteTaskRunnerWorkItem removed = completeTasks.remove(taskId);
    final Worker worker = removed.getWorker();
    if (removed == null || worker == null) {
      log.makeAlert("WTF?! Asked to cleanup nonexistent task")
         .addData("taskId", taskId)
         .emit();
    } else {
      final String workerId = worker.getHost();
      log.info("Cleaning up task[%s] on worker[%s]", taskId, workerId);
      final String statusPath = JOINER.join(indexerZkConfig.getStatusPath(), workerId, taskId);
      try {
        cf.delete().guaranteed().forPath(statusPath);
      }
      catch (KeeperException.NoNodeException e) {
        log.info("Tried to delete status path[%s] that didn't exist! Must've gone away already?", statusPath);
      }
      catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  }
943726
void notifyAsynchDeletionEnd(AsynchDeletionThread thread)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "notifyAsynchDeletionEnd", thread);

        // Under the ADT lock, we'll notify any waiters and set the running
        // flag to false
        synchronized (deletionThreadLock)
        {
            thread.setRunning(false);
            deletionThreadLock.notifyAll();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "notifyAsynchDeletionEnd");

    }
369978
private DestinationHandler createForeignDestination(DestinationForeignDefinition dfd, String busName) throws SIResourceException, SINotPossibleInCurrentConfigurationException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "createForeignDestination", new Object[] { dfd, busName });

        ForeignDestinationHandler fdh = null;

        //The lock on the destinationManager is taken to stop 2 threads creating the same
        //destination and also to synchronize dynamic deletes with the
        //creation of aliases.  This stops an alias destination being created that targets a
        //destination in the process of being deleted.
        synchronized (this)
        {
            // Create a new DestinationHandler, which is created locked
            fdh = new ForeignDestinationHandler(dfd, messageProcessor, this, findBus(dfd.getBus()), busName);

            DestinationIndex.Type type = new DestinationIndex.Type();
            type.foreignDestination = Boolean.TRUE;
            type.alias = Boolean.FALSE;
            type.local = Boolean.FALSE;
            type.remote = Boolean.FALSE;
            type.queue = new Boolean(!fdh.isPubSub());
            type.state = State.ACTIVE;
            destinationIndex.put(fdh, type);

            fdh.registerControlAdapters();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createForeignDestination", fdh);

        return fdh;
    }
142247
void closeHandle(HelloWorldConnection handle)
   {
      connections.remove((HelloWorldConnectionImpl)handle);

      ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
      event.setConnectionHandle(handle);

      for (ConnectionEventListener cel : listeners)
      {
         cel.connectionClosed(event);
      }
   }
1165774
@Export
	public JsHandlerRegistration addDispatchStoppedHandler(final DispatchStoppedHandler handler) {
		HandlerRegistration registration = GwtCommandDispatcher.getInstance().addDispatchStoppedHandler(
				new org.geomajas.gwt.client.command.event.DispatchStoppedHandler() {

					public void onDispatchStopped(DispatchStoppedEvent event) {
						handler.onDispatchStopped(new org.geomajas.plugin.jsapi.client.event.DispatchStoppedEvent());
					}
				});
		return new JsHandlerRegistration(new HandlerRegistration[] { registration });
	}
934185
public void delete() 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "delete");
    
    

    // Mark the destination for deletion
    try
    {
      // Set the deletion flag in the DH persistently. A transaction per DH??
      LocalTransaction siTran = txManager.createLocalTransaction(true);

      setToBeDeleted(true);
      
      // Adjust the destination lookups in Destination Manager
      destinationManager.getLinkIndex().delete(this);
      
      requestUpdate((Transaction) siTran);
      // commit the transaction
      siTran.commit();
      
      String name = _mqLinkName;
      if (name == null)      
        name = getName();
      SibTr.info(tc, "MQLINK_DEST_DELETE_INFO_CWSIP0064", 
                   new Object[]{name, _mqLinkUuid});   
    }
    catch (MessageStoreException e)
    {
      // No FFDC code needed
      
      SibTr.exception(tc, e);
      
      //throw e;
    }
    catch (SIException e)
    {
      // No FFDC code needed
      
      SibTr.exception(tc, e);
       
      //handleRollback(siTran);
      //        throw e;
    }    

    // Now start the asynch deletion thread to tidy up
    destinationManager.startAsynchDeletion();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "delete");        
  }
885098
private synchronized void doNodeLeft(final String nodeID) {
    log.info(String.format("%s - %s left the cluster", this, nodeID));
    context.run(new Runnable() {
      @Override
      public void run() {
        synchronized (nodes) {
          // If we were the first node to remove the nodes then we need
          // to inform listeners that the node left the cluster over the
          // event bus.
          Collection<String> removedNodes = nodes.remove(nodeID);
          if (removedNodes != null) {
            synchronized (groups) {
              for (final String node : removedNodes) {
                for (final String group : groups.keySet()) {
                  groups.remove(group, node);
                  vertx.runOnContext(new Handler<Void>() {
                    @Override
                    public void handle(Void event) {
                      vertx.eventBus().publish(String.format("%s.leave", group), node);
                    }
                  });
                }
                vertx.runOnContext(new Handler<Void>() {
                  @Override
                  public void handle(Void event) {
                    vertx.eventBus().publish(String.format("%s.leave", cluster), node);
                  }
                });
              }
            }

            // Check for any network masters that left the cluster.
            synchronized (networks) {
              for (final String name : networks) {
                String address = nodeSelectors.get(name);
                if (address != null && removedNodes.contains(address)) {
                  // If the node to which the network was assigned is one of the nodes
                  // that left the cluster then redeploy the network. If no changes
                  // have been made to the network then this will simply result in the
                  // network's manager being redeployed.
                  selectNode(name, new Handler<AsyncResult<String>>() {
                    @Override
                    public void handle(AsyncResult<String> result) {
                      if (result.succeeded() && result.result() != null) {
                        // Just redeploy the network by sending a deploy message to the appropriate node.
                        JsonObject message = new JsonObject()
                            .putString("action", "deploy")
                            .putString("type", "network")
                            .putString("network", name);
                        vertx.eventBus().send(result.result(), message);
                      }
                    }
                  });
                }
              }
            }

            // Redeploy any failed deployments.
            synchronized (deployments) {
              Collection<String> sdeploymentsInfo = deployments.get(cluster);
              for (final String sdeploymentInfo : sdeploymentsInfo) {
                final JsonObject deploymentInfo = new JsonObject(sdeploymentInfo);
                // If the deployment node is equal to the node that left the cluster then
                // remove the deployment from the deployments list and attempt to redeploy it.
                if (deploymentInfo.getString("node").equals(nodeID)) {
                  // If the deployment is an HA deployment then attempt to redeploy it on this node.
                  if (deployments.remove(cluster, sdeploymentInfo) && deploymentInfo.getBoolean("ha", false)) {
                    doRedeploy(deploymentInfo);
                  }
                }
              }
            }
          }
        }
      }
    });
  }
951635
public static void exit(int status) {
    // Embedded H2O path (e.g. inside Hadoop mapper task).
    if( embeddedH2OConfig != null )
      embeddedH2OConfig.exit(status);
    // Flush all cached messages
    Log.flushStdout();

    // Standalone H2O path,p or if the embedded config does not exit
    System.exit(status);
  }
1359515
public static void deleteQueueMapping(DbConn cnx, int id)
    {
        QueryResult qr = cnx.runUpdate("dp_delete_by_id", id);
        if (qr.nbUpdated != 1)
        {
            cnx.setRollbackOnly();
            throw new JqmAdminApiUserException("no item with ID " + id);
        }
    }