Add this instance to the leadership election and attempt to acquire leadership.

@throws Exception errors
344358
public void start() throws Exception
    {
        Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once");

        startTask.set(AfterConnectionEstablished.execute(client, new Runnable()
                {
                    @Override
                    public void run()
                    {
                        try
                        {
                            internalStart();
                        }
                        finally
                        {
                            startTask.set(null);
                        }
                    }
                }));
    }
1283353
public function afterCreate()
    {
        //setup the user notificatoin setting
        $companySettings = new CompanySettings();
        $companySettings->company_id = $this->getId();
        $companySettings->name = 'notifications';
        $companySettings->value = $this->user->email;
        if (!$companySettings->save()) {
            throw new Exception(current($companySettings->getMessages()));
        }

        //multi user asociation
        $usersAssociatedCompany = new UsersAssociatedCompany();
        $usersAssociatedCompany->users_id = $this->user->getId();
        $usersAssociatedCompany->company_id = $this->getId();
        $usersAssociatedCompany->identify_id = $this->user->getId();
        $usersAssociatedCompany->user_active = 1;
        $usersAssociatedCompany->user_role = 'admin';
        if (!$usersAssociatedCompany->save()) {
            throw new Exception(current($usersAssociatedCompany->getMessages()));
        }

        //now that we setup de company and associated with the user we need to setup this as its default company
        if (!UserConfig::findFirst(['conditions' => 'users_id = ?0 and name = ?1', 'bind' => [$this->user->getId(), self::DEFAULT_COMPANY]])) {
            $userConfig = new UserConfig();
            $userConfig->users_id = $this->user->getId();
            $userConfig->name = self::DEFAULT_COMPANY;
            $userConfig->value = $this->getId();

            if (!$userConfig->save()) {
                throw new Exception(current($userConfig->getMessages()));
            }
        }
    }
187102
@Override
    public void start() throws AtlasException {
        if (!HAConfiguration.isHAEnabled(configuration)) {
            LOG.info("HA is not enabled, no need to start leader election service");
            return;
        }
        cacheActiveStateChangeHandlers();
        serverId = AtlasServerIdSelector.selectServerId(configuration);
        joinElection();
    }
875655
private void addContender(EmbeddedLeaderElectionService service, LeaderContender contender) {
		synchronized (lock) {
			checkState(!shutdown, "leader election service is shut down");
			checkState(!service.running, "leader election service is already started");

			try {
				if (!allLeaderContenders.add(service)) {
					throw new IllegalStateException("leader election service was added to this service multiple times");
				}

				service.contender = contender;
				service.running = true;

				updateLeader().whenComplete((aVoid, throwable) -> {
					if (throwable != null) {
						fatalError(throwable);
					}
				});
			}
			catch (Throwable t) {
				fatalError(t);
			}
		}
	}
357209
public Candidate instantiateForInsert() {
		Candidate entity = new Candidate();
		entity.setCategory(new Category(512973));
		entity.setComments("New lead candidate");
		entity.setEmployeeType("W2");
		entity.setIsDeleted(Boolean.FALSE);
		entity.setIsEditable(Boolean.TRUE);
		entity.setPreferredContact("Email");
		entity.setStatus("New Lead");
		entity.setOwner(new CorporateUser(1));
		entity.setName("");
		entity.setFirstName("");
		entity.setLastName("");
		entity.setUsername(new DateTime().toString());
		entity.setPassword("secret");
		return entity;
	}
617762
public void populate() throws Exception {
        for (int i = 0, cnt = _partition.getIdCount(); i < cnt; i++) {
            int memberId = _partition.getIdStart() + i;
            _partition.set(memberId, createDataForMember(memberId), System.nanoTime());
        }
        _partition.sync();
    }
816657
public void connect() throws Exception {
        if (connection != null && !connection.isConnected()) {
            connection.connect();
            transaction = connection.getModbusTransport().createTransaction();
            setTransaction(transaction);
        }
    }
45613
@Override
    public <E extends Exception> void add(Iteration<? extends Statement, E> statements, Resource... contexts) throws RepositoryException, E {
        while(statements.hasNext()){
            Statement st = statements.next();
            add(st.getSubject(), st.getPredicate(), st.getObject(), mergeResource(st.getContext(), contexts));
        }
    }
862310
private void electedTruncationLeader() throws Exception {
        loggingLog.info("This node was selected as the leader for snapshot truncation");
        m_truncationSnapshotScanTask = m_es.scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                try {
                    scanTruncationSnapshots();
                } catch (Exception e) {
                    loggingLog.error("Error during scan and group of truncation snapshots");
                }
            }
        }, 0, 1, TimeUnit.HOURS);
        try {
            // TRAIL [TruncSnap:1] elected as leader
            truncationRequestExistenceCheck();
            userSnapshotRequestExistenceCheck(false);
        } catch (Exception e) {
            VoltDB.crashLocalVoltDB("Error while accepting snapshot daemon leadership", true, e);
        }
    }
665255
void sendProposedEpoch() throws IOException {
    Message message = MessageBuilder
                      .buildProposedEpoch(persistence.getProposedEpoch(),
                                          persistence.getAckEpoch(),
                                          persistence.getLastSeenConfig(),
                                          getSyncTimeoutMs());
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sends {} to leader {}", TextFormat.shortDebugString(message),
                this.electedLeader);
    }
    sendMessage(this.electedLeader, message);
  }
1296622
public function create() {
        $migration = $this->getMessages();
        if (!$migration) {
            $this->db()->insert($this->table, array('migration' => get_class($this), 'state' => false));
        } else {
            throw new \Exception('Migration ' .  get_class($this) . ' already created');
        }
    }
313111
public void         add(Type type, String message, Throwable exception)
    {
        String          queueMessage = message;
        if ( (type == Type.ERROR) && (exception != null) )
        {
            queueMessage += " (" + getExceptionMessage(exception) + ")";
        }

        if ( type.addToUI() )
        {
            while ( queue.size() > windowSizeLines )  // NOTE: due to concurrency, this may make the queue shorter than MAX - that's OK (and in some cases longer)
            {
                queue.remove();
            }
            queue.add(new Message(queueMessage, type));
        }
        type.log(message, exception);
    }
1108722
protected function setupCredential()
    {
        if (null === $this->credential) {
            throw new Exception\RuntimeException(
                'A credential value was not provided prior to authentication with CredentialRepository'
                . ' authentication adapter'
            );
        }

        $this->authenticationResultInfo = [
            'code' => AuthenticationResult::FAILURE,
            'identity' => $this->identity,
            'messages' => []
        ];
    }
425202
public void commit() throws HandlerException {
        if (_isInitiator) {
            try {
                _userTx.commit();
            } catch (SystemException se) {
                throw CommonKnowledgeMessages.MESSAGES.userTransactionCommitFailedSystem(se);
            } catch (HeuristicRollbackException hre) {
                throw CommonKnowledgeMessages.MESSAGES.userTransactionCommitFailedRollback(hre);
            } catch (HeuristicMixedException hme) {
                throw CommonKnowledgeMessages.MESSAGES.userTransactionCommitFailedMixed(hme);
            } catch (RollbackException re) {
                throw CommonKnowledgeMessages.MESSAGES.userTransactionCommitFailed(re);
            }
        }
    }
174352
@Override
	public void onCommunicationException(Throwable error) {
		addMessage(MESSAGES.commandCommunicationError() + error.getMessage(), ERRORMESSAGE_STYLE);
	}
1242461
public function add($exception) {
        if($this->checkException($exception) === FALSE) {
            trigger_error(
                'Only subclasses of \Exception and implementations of \Throwable can be aggregated!',
                E_USER_ERROR
            );
        }

        $this->collection[] = $exception;
    }
869701
public void add(Entry entry) throws LdapException {
        CoreSession session = this.service.getAdminSession();
        session.add(entry);

    }