com.sleepycat.je.rep.elections
Class Acceptor

java.lang.Object
  extended by java.lang.Thread
      extended by com.sleepycat.je.utilint.StoppableThread
          extended by com.sleepycat.je.rep.elections.ElectionAgentThread
              extended by com.sleepycat.je.rep.elections.Acceptor
All Implemented Interfaces:
ExceptionListenerUser, Runnable

public class Acceptor
extends ElectionAgentThread

Plays the role of Acceptor in the consensus algorithm. It runs in its own thread listening for and responding to messages sent by Proposers.


Nested Class Summary
static interface Acceptor.SuggestionGenerator
           
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static String SERVICE_NAME
           
 
Fields inherited from class com.sleepycat.je.rep.elections.ElectionAgentThread
channelQueue, formatter, logger, protocol
 
Fields inherited from class com.sleepycat.je.utilint.StoppableThread
envImpl
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Acceptor(Protocol protocol, RepNode repNode, Acceptor.SuggestionGenerator suggestionGenerator)
          Creates an Acceptor
 
Method Summary
(package private)  TextProtocol.ResponseMessage process(Protocol.Accept accept)
          Responds to Accept request
(package private)  TextProtocol.ResponseMessage process(Protocol.Propose propose)
          Responds to a Propose request.
 void run()
          The Acceptor thread body.
 
Methods inherited from class com.sleepycat.je.rep.elections.ElectionAgentThread
getLogger, initiateSoftShutdown, shutdown
 
Methods inherited from class com.sleepycat.je.utilint.StoppableThread
cleanup, getSavedShutdownException, getTotalCpuTime, getTotalUserTime, isShutdown, saveShutdownException, setExceptionListener, shutdownDone, shutdownThread
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SERVICE_NAME

public static final String SERVICE_NAME
See Also:
Constant Field Values
Constructor Detail

Acceptor

public Acceptor(Protocol protocol,
                RepNode repNode,
                Acceptor.SuggestionGenerator suggestionGenerator)
Creates an Acceptor

Method Detail

run

public void run()
The Acceptor thread body.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

process

TextProtocol.ResponseMessage process(Protocol.Propose propose)
Responds to a Propose request.

Parameters:
propose - the request proposal
Returns:
the response: a Promise if the request was accepted, a Reject otherwise.

process

TextProtocol.ResponseMessage process(Protocol.Accept accept)
Responds to Accept request

Parameters:
accept - the request
Returns:
an Accepted or Reject response as appropriate.


Copyright (c) 2004-2010 Oracle. All rights reserved.