public abstract class Proposer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Proposer.MaxRetriesException
Exception thrown when a Proposal issue fails because the retry limit has
been exceeded.
|
static interface |
Proposer.Proposal
The Interface defining a Proposal.
|
static interface |
Proposer.ProposalParser |
static interface |
Proposer.RetryPredicate
Interface to determine whether the Proposer should be retry with a new
Proposal or abandon the effort.
|
static class |
Proposer.WinningProposal
Summarizes the results of the election
|
Modifier and Type | Field and Description |
---|---|
protected Elections |
elections |
protected java.util.logging.Formatter |
formatter |
protected java.util.logging.Logger |
logger |
protected IntStat |
phase1NoNonZeroPrio |
Constructor and Description |
---|
Proposer(Elections elections,
NameIdPair nameIdPair)
Initializes a proposer with the set of acceptors identified by the
sockets on which they accept proposals.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Protocol.Value |
choosePhase2Value(java.util.Set<TextProtocol.MessageExchange> exchanges)
Selects the value to be used during Phase2, which if it succeeds will
become the "chosen value".
|
StatGroup |
getProposerStats()
Returns the current proposer statistics.
|
Proposer.WinningProposal |
issueProposal(QuorumPolicy quorumPolicy,
Proposer.RetryPredicate retryPredicate)
Runs an election using the consensus algorithm.
|
protected abstract Proposer.Proposal |
nextProposal()
Creates the next unique Proposal to be used
|
void |
shutDown()
Shut down the proposer and reclaim its resources.
|
protected final Elections elections
protected final IntStat phase1NoNonZeroPrio
protected final java.util.logging.Logger logger
protected final java.util.logging.Formatter formatter
public Proposer(Elections elections, NameIdPair nameIdPair)
public void shutDown()
public StatGroup getProposerStats()
protected abstract Protocol.Value choosePhase2Value(java.util.Set<TextProtocol.MessageExchange> exchanges)
exchanges
- the message exchanges from Phase 1protected abstract Proposer.Proposal nextProposal()
public Proposer.WinningProposal issueProposal(QuorumPolicy quorumPolicy, Proposer.RetryPredicate retryPredicate) throws Proposer.MaxRetriesException, java.lang.InterruptedException
quorumPolicy
- the policy used to determine whether we have a
quorum.retryPredicate
- the interface which determines whether a retry
should be attempted.Proposer.MaxRetriesException
- when a winning proposal could not be
established.java.lang.InterruptedException
Copyright (c) 2004-2012 Oracle. All rights reserved.