Stores the last voted server.

@param vote The server vote.
437659
public synchronized void storeVote(MemberId vote) {
    log.trace("Store vote {}", vote);
    metadataBuffer.writeString(8, vote != null ? vote.id() : null).flush();
  }
402279
private void storeResult( double[] result2, int[] id ) throws SchemaException {
        outData = new HashMap<Integer, double[]>();
        for( int i = 0; i < result2.length; i++ ) {
            outData.put(id[i], new double[]{checkResultValue(result2[i])});
        }
    }
908145
public void setLeader(MemberId leader) {
    if (!Objects.equals(this.leader, leader)) {
      if (leader == null) {
        this.leader = null;
      } else {
        // If a valid leader ID was specified, it must be a member that's currently a member of the
        // ACTIVE members configuration. Note that we don't throw exceptions for unknown members. It's
        // possible that a failure following a configuration change could result in an unknown leader
        // sending AppendRequest to this server. Simply configure the leader if it's known.
        DefaultRaftMember member = cluster.getMember(leader);
        if (member != null) {
          this.leader = leader;
          log.info("Found leader {}", member.memberId());
          electionListeners.forEach(l -> l.accept(member));
        }
      }

      this.lastVotedFor = null;
      meta.storeVote(null);
    }
  }
444346
public function flush()
    {
        $this->_result = null;
        $this->_lastResult = array();
        $this->_lastQuery = null;
        $this->_lastQueryHash = null;
    }
821303
def vote(value, voted_by)
      mark = Vote.new(value: value, voted_by_id: voted_by.id, voter_type: voted_by.class.name)
      add_vote_mark(mark)
    end
405351
private void flushComplete(long lastIndexedOffset) {
        this.aggregator.reset();
        this.aggregator.setLastIndexedOffset(lastIndexedOffset);
        this.connector.notifyIndexOffsetChanged(this.aggregator.getLastIndexedOffset());
        log.debug("{}: FlushComplete (State={}).", this.traceObjectId, this.aggregator);
    }
890435
public function update()
    {
        if ($this->currentVote) {
            $vote = $this->currentVote->getCurrentVote();
            $this->currentVote->update(time());

            switch ($vote->getStatus()) {
                case Vote::STATUS_CANCEL:
                    $this->dispatcher->dispatch("votemanager.votecancelled",
                        [$vote->getPlayer(), $vote->getType(), $vote]);
                    $this->currentVote = null;
                    $this->reset();
                    break;
                case Vote::STATUS_FAILED:
                    $this->dispatcher->dispatch("votemanager.votefailed",
                        [$vote->getPlayer(), $vote->getType(), $vote]);
                    $this->currentVote = null;
                    $this->reset();
                    break;
                case Vote::STATUS_PASSED:
                    $this->dispatcher->dispatch("votemanager.votepassed",
                        [$vote->getPlayer(), $vote->getType(), $vote]);
                    $this->currentVote = null;
                    $this->reset();
                    break;
            }
        }
    }
698414
def vote(session, nick, pid, response):
    """"""
    if not response:
        return "You have to vote something!"
    if response == "n" or response == "nay":
        response = "no"
    elif response == "y" or response == "aye":
        response = "yes"
    poll = get_open_poll(session, pid)
    if poll is None:
        return "That poll doesn't exist or isn't active. Use !poll list to see valid polls"
    old_vote = get_response(session, pid, nick)
    if old_vote is None:
        session.add(Poll_responses(pid=pid, response=response, voter=nick))
        return "%s voted %s." % (nick, response)
    else:
        if response == old_vote.response:
            return "You've already voted %s." % response
        else:
            msg = "%s changed their vote from %s to %s." % (nick, old_vote.response, response)
            old_vote.response = response
            return msg
533507
def vote(self, identifier, weight=100.0):
        ''' 
        '''
        for num_of_retries in range(default.max_retry):
            try:
                self.steem_instance().vote(identifier, 
                    weight, self.mainaccount)
                self.msg.message("voted for " + identifier)
                time.sleep(5)
            except Exception as e:
                if re.search(r'You have already voted in a similar way', str(e)):
                    self.msg.error_message('''Already voted on 
                                        {}'''.format(identifier))
                    return "already voted"
                else:
                    self.util.retry('''COULD NOT VOTE ON 
                                    {}'''.format(identifier), 
                                    e, num_of_retries, default.wait_time)
                    self.s = None
            else:
                return True
1372175
ServerContext setTerm(long term) {
    if (term > this.term) {
      this.term = term;
      this.leader = 0;
      this.lastVotedFor = 0;
      meta.storeTerm(this.term);
      meta.storeVote(this.lastVotedFor);
      LOGGER.debug("{} - Set term {}", cluster.member().address(), term);
    }
    return this;
  }
269171
public function saveVote($user, $parentId, $parentType, $voteType = "like")
    {
        $vote = $this->findAllWhere("parentId = ? AND parentType = ? AND user = ?", [$parentId, $parentType, $user])[0];

        if ($vote != null) {
            $vote->setDb($this->db);
        }

        if ($vote == null) {
            $vote = $this;
        }

        $vote->user = $user;
        $vote->parentId = $parentId;
        $vote->parentType = $parentType;
        $vote->upVote = 1;
        $vote->downVote = null;

        if ($voteType == "downVote") {
            $vote->upVote = null;
            $vote->downVote = 1;
        }



        $vote->save();
        return true;
    }
661952
@Override
    public ServiceInstance vote() {
        List<ModelServiceInstance> instances = getServiceInstanceList();
        if(instances == null || instances.isEmpty()){
            return null;
        }
        int i = index.getAndIncrement();
        int pos = i % instances.size();
        ModelServiceInstance instance = instances.get(pos);
        return ServiceInstanceUtils.transferFromModelServiceInstance(instance);
    }
372787
private void setLastApplied(long lastApplied) {
    // lastApplied should be either equal to or one greater than this.lastApplied.
    if (lastApplied > this.lastApplied) {
      Assert.arg(lastApplied == this.lastApplied + 1, "lastApplied must be sequential");

      this.lastApplied = lastApplied;

      // Update the index for each session. This will be used to trigger queries that are awaiting the
      // application of specific indexes to the state machine. Setting the session index may cause query
      // callbacks to be called and queries to be evaluated.
      for (ServerSessionContext session : executor.context().sessions().sessions.values()) {
        session.setLastApplied(lastApplied);
      }

      // Take a state machine snapshot if necessary.
      takeSnapshot();

      // Install a state machine snapshot if necessary.
      installSnapshot();
    } else {
      Assert.arg(lastApplied == this.lastApplied, "lastApplied cannot be decreased");
    }
  }
1317952
public void reset(MemberId leader, Collection<MemberId> servers) {
    selector.reset(leader, servers);
  }
781118
public function persistPoll()
    {
        $data = '<?php return '.var_export($this->poll, true).';';
        file_put_contents($this->directory . '/poll.php', $data);
    }
518693
def _set_final_freeness(self, flag):
        
        if flag:
            self.state.memory.store(self.heap_base + self.heap_size - self._chunk_size_t_size, ~CHUNK_P_MASK)
        else:
            self.state.memory.store(self.heap_base + self.heap_size - self._chunk_size_t_size, CHUNK_P_MASK)
421862
public void setResult(R result) {
        try {
            lock.lock();
            this.result = result;
            notifyHaveResult();
        }
        finally {
            lock.unlock();
        }
    }