Leaves the cluster.
191033
@Override
  public synchronized CompletableFuture<Void> leave() {
    if (leaveFuture != null)
      return leaveFuture;

    leaveFuture = new CompletableFuture<>();

    context.getThreadContext().executor().execute(() -> {
      // If a join attempt is still underway, cancel the join and complete the join future exceptionally.
      // The join future will be set to null once completed.
      cancelJoinTimer();
      if (joinFuture != null)
        joinFuture.completeExceptionally(new IllegalStateException("failed to join cluster"));

      // If there are no remote members to leave, simply transition the server to INACTIVE.
      if (getActiveMemberStates().isEmpty() && configuration.index() <= context.getCommitIndex()) {
        LOGGER.trace("{} - Single member cluster. Transitioning directly to inactive.", member().address());
        context.transition(CopycatServer.State.INACTIVE);
        leaveFuture.complete(null);
      } else {
        leave(leaveFuture);
      }
    });

    return leaveFuture.whenComplete((result, error) -> leaveFuture = null);
  }
473842
private synchronized void resetViewport(boolean isMoving) {
        isClustering = true;
        clusterTask = new ClusterTask();
        clusterTask.execute(new Boolean[]{isMoving});
    }
164221
synchronized public void removeClusterChangeListener(ClusterEventListener l) {
    if (listeners == null)
      listeners = new Vector();
    listeners.removeElement(l);
  }
549164
def exit(self):
        """"""
        # To ensure all connections are properly closed
        self.client.flush()
        self.client.close()
        # Call the father method
        super(Export, self).exit()
791520
void disconnectEdge_(int edge) {
		int cluster_1 = getEdgeCluster(edge, 0);
		int cluster2 = getEdgeCluster(edge, 1);
		disconnectEdgeFromCluster_(edge, cluster_1);
		disconnectEdgeFromCluster_(edge, cluster2);
	}
1249333
async def leave(self, *, force: bool = False) -> bool:
        

        params = {"force": force}

        await self.docker._query("swarm/leave", method="POST", params=params)

        return True
422449
public synchronized boolean shutdown() {
        if (channel == null) {
            return false;
        }
        Address address = channel.getAddress();
        LOGGER.debug("{0} shutting down clustering service...", address);
        consumers.clear();

        // Mark this as not accepting any more ...
        isOpen.set(false);
        
        try {
            // Disconnect from the channel and close it ...
            channel.disconnect();
            channel.removeChannelListener(listener);
            channel.setReceiver(null);
            channel.close();
            LOGGER.debug("{0} successfully closed main channel", address);
        } finally {
            channel = null;
        }
        membersInCluster.set(1);
        return true;
    }
471764
public CompletableFuture<Void> close() {
    CompletableFuture<Void> future = new CompletableFuture<>();
    threadContext.execute(() -> {
      try {
        clusterMembershipService.removeListener(membershipEventListener);
        primaryElection.removeListener(primaryElectionListener);
        role.close();
      } finally {
        future.complete(null);
      }
    });
    return future.thenRunAsync(() -> threadContext.close());
  }
376415
private static function stop(): Promise
    {
        return call(function () {
            list($exceptions) = yield self::terminate();

            if (!empty($exceptions)) {
                $exception = new MultiReasonException($exceptions);
                $message = \implode('; ', \array_map(function (\Throwable $exception): string {
                    return $exception->getMessage();
                }, $exceptions));
                throw new ClusterException("Stopping failed: " . $message, 0, $exception);
            }
        });
    }
708569
def teardown(cluster_config_file, yes, workers_only, cluster_name):
    """"""
    teardown_cluster(cluster_config_file, yes, workers_only, cluster_name)
311092
def remove(self):
        
        LOGGER.debug("Cluster.remove - " + self.name)
        if self.id is None:
            return None
        else:
            params = SessionService.complete_transactional_req({
                'name': self.name
            })

            if MappingService.driver_type != DriverFactory.DRIVER_REST:
                params['OPERATION'] = 'deleteCluster'
                args = {'properties': params}
            else:
                args = {'http_operation': 'GET', 'operation_path': 'delete', 'parameters': params}

            response = ClusterService.requester.call(args)

            if MappingService.driver_type != DriverFactory.DRIVER_REST:
                response = response.get()

            if response.rc != 0:
                LOGGER.warning(
                    'Cluster.remove - Problem while deleting cluster ' + self.name +
                    '. Reason: ' + str(response.response_content) + ' - ' + str(response.error_message) +
                    " (" + str(response.rc) + ")"
                )
                if response.rc == 500 and ArianeMappingOverloadError.ERROR_MSG in response.error_message:
                    raise ArianeMappingOverloadError("Cluster.remove", ArianeMappingOverloadError.ERROR_MSG)
                # traceback.print_stack()
                return self
            else:
                return None
993853
public void leave(final Respoke.TaskCompletionListener completionListener) {
        if (isJoined()) {
            if ((null != groupID) && (groupID.length() > 0)) {
                String urlEndpoint = "/v1/groups";

                JSONArray groupList = new JSONArray();
                groupList.put(groupID);

                JSONObject data = new JSONObject();
                try {
                    data.put("groups", groupList);

                    signalingChannel.sendRESTMessage("delete", urlEndpoint, data, new RespokeSignalingChannel.RESTListener() {
                        @Override
                        public void onSuccess(Object response) {
                            joined = false;

                            Respoke.postTaskSuccess(completionListener);
                        }

                        @Override
                        public void onError(final String errorMessage) {
                            Respoke.postTaskError(completionListener, errorMessage);
                        }
                    });
                } catch (JSONException e) {
                    Respoke.postTaskError(completionListener, "Error encoding group list to json");
                }
            } else {
                Respoke.postTaskError(completionListener, "Group name must be specified");
            }
        } else {
            Respoke.postTaskError(completionListener, "Not a member of this group anymore.");
        }
    }
1352991
def _do_leave(self, leave, in_port, msg):
        """"""
        datapath = msg.datapath
        parser = datapath.ofproto_parser

        self._mcast.setdefault(leave.address, {})
        if in_port in self._mcast[leave.address]:
            self._del_flow_entry(
                datapath, in_port, leave.address)
            del self._mcast[leave.address][in_port]
            actions = []
            for port in self._mcast[leave.address]:
                actions.append(parser.OFPActionOutput(port))
            if len(actions):
                self._set_flow_entry(
                    datapath, actions, self.server_port, leave.address)
            else:
                self._del_flow_entry(
                    datapath, self.server_port, leave.address)
482971
def delete(self, cluster):
        
        if cluster.name not in self.clusters:
            raise ClusterNotFound(
                "Unable to delete non-existent cluster %s" % cluster.name)
        del self.clusters[cluster.name]
1069519
def terminate(cls, cluster_id_label):
        
        conn = Qubole.agent(version=Cluster.api_version)
        data = {"state": "terminate"}
        return conn.put(cls.element_path(cluster_id_label) + "/state", data)
1248594
private void leave(CompletableFuture<Void> future) {
    // Set a timer to retry the attempt to leave the cluster.
    leaveTimeout = raft.getThreadContext().schedule(raft.getElectionTimeout(), () -> {
      leave(future);
    });

    // Attempt to leave the cluster by submitting a LeaveRequest directly to the server state.
    // Non-leader states should forward the request to the leader if there is one. Leader states
    // will log, replicate, and commit the reconfiguration.
    raft.getRaftRole().onLeave(LeaveRequest.builder()
        .withMember(getMember())
        .build()).whenComplete((response, error) -> {
          // Cancel the leave timer.
          cancelLeaveTimer();

          if (error == null && response.status() == RaftResponse.Status.OK) {
            Configuration configuration = new Configuration(response.index(), response.term(), response.timestamp(), response.members());

            // Configure the cluster and commit the configuration as we know the successful response
            // indicates commitment.
            configure(configuration).commit();
            future.complete(null);
          } else {
            // Reset the leave timer.
            leaveTimeout = raft.getThreadContext().schedule(raft.getElectionTimeout(), () -> {
              leave(future);
            });
          }
        });
  }
839946
@Override
   protected void leaving(NodeData node, int level) throws RepositoryException
   {

      try
      {
         contentHandler.endElement(getSvNamespaceUri(), "node", "sv:node");
      }
      catch (SAXException e)
      {
         throw new RepositoryException(e);
      }

   }