|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sleepycat.je.rep.impl.TextProtocol
public abstract class TextProtocol
SimpleProtocol provides the support for implementing simple low performance
protocols involving replication nodes. The protocol is primarily text based,
and checks group membership and version matches with every message favoring
flexibility over performance.
The base class is primarily responsible for the message formatting and
message envelope validation. The subclasses define the specific messages
that constitute the protocol and the request/response semantics.
Every message has the format:
Nested Class Summary
classTextProtocol.Fail
static classTextProtocol.InvalidMessageException
Used to indicate a message format or invalid content exception.
classTextProtocol.Message
Base message class for all messages exchanged in the protocol.
static classTextProtocol.MessageError
classTextProtocol.MessageExchange
Use to parallelize message exchanges via Futures.
static classTextProtocol.MessageOp
The Operations that are part of the protocol.
classTextProtocol.OK
classTextProtocol.ProtocolError
classTextProtocol.RequestMessage
Base class for all Request messages
classTextProtocol.ResponseMessage
Base classes for response messages.
protected static classTextProtocol.StringFormatable
static classTextProtocol.TOKENS
Represents the tokens on a message line.
protected static interfaceTextProtocol.WireFormatable
Field Summary
protected EnvironmentImplenvImpl
TextProtocol.MessageOpFAIL_RESP
protected Formatterformatter
protected Loggerlogger
protected StringmessagePrefixNocheck
TextProtocol.MessageOpOK_RESP
TextProtocol.MessageOpPROTOCOL_ERROR
static StringSEPARATOR
static StringSEPARATOR_REGEXP
Constructor Summary
TextProtocol(String version,
String groupName,
NameIdPair nameIdPair,
EnvironmentImpl envImpl)
Creates an instance of the Protocol.
Method Summary
intgetOpenTimeout()
intgetReadTimeout()
TextProtocol.RequestMessagegetRequestMessage(SocketChannel channel)
Reads the channel and returns a read request.
protected voidinitializeMessageOps(TextProtocol.MessageOp[] protocolOps)
The messages as defined by the subclass.
intmessageCount()
TextProtocol.Messageparse(String line)
Parses a line into a Request/Response message.
TextProtocol.RequestMessageparseRequest(String requestLine)
Converts a request line into a requestMessage.
(package private) TextProtocol.ResponseMessageparseResponse(String responseLine)
Converts a response line into a ResponseMessage.
TextProtocol.ResponseMessageprocess(Object requestProcessor,
TextProtocol.RequestMessage requestMessage)
protected voidsetTimeouts(RepImpl repImpl,
DurationConfigParam openTimeoutConfig,
DurationConfigParam readTimeoutConfig)
Set the network timeouts associated with uses of this protocol instance.
voidupdateNodeIds(Set<Integer> newMemberIds)
Updates the current set of nodes that constitutes the group.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail
messagePrefixNocheck
protected final String messagePrefixNocheck
SEPARATOR
public static final String SEPARATOR
SEPARATOR_REGEXP
public static final String SEPARATOR_REGEXP
PROTOCOL_ERROR
public final TextProtocol.MessageOp PROTOCOL_ERROR
OK_RESP
public final TextProtocol.MessageOp OK_RESP
FAIL_RESP
public final TextProtocol.MessageOp FAIL_RESP
logger
protected final Logger logger
formatter
protected final Formatter formatter
envImpl
protected final EnvironmentImpl envImpl
Constructor Detail
TextProtocol
public TextProtocol(String version,
String groupName,
NameIdPair nameIdPair,
EnvironmentImpl envImpl)
nameIdPair - a unique identifier for this nodeenvImpl - for logging, may be null
Method Detail
setTimeouts
protected void setTimeouts(RepImpl repImpl,
DurationConfigParam openTimeoutConfig,
DurationConfigParam readTimeoutConfig)
initializeMessageOps
protected void initializeMessageOps(TextProtocol.MessageOp[] protocolOps)
protocolOps - the message ops defined by the subclass.
getOpenTimeout
public int getOpenTimeout()
getReadTimeout
public int getReadTimeout()
messageCount
public int messageCount()
updateNodeIds
public void updateNodeIds(Set<Integer> newMemberIds)
newMemberIds -
parse
public TextProtocol.Message parse(String line)
throws TextProtocol.InvalidMessageException
line - containing the message
TextProtocol.InvalidMessageException
parseResponse
TextProtocol.ResponseMessage parseResponse(String responseLine)
throws TextProtocol.InvalidMessageException
responseLine -
TextProtocol.InvalidMessageException
parseRequest
public TextProtocol.RequestMessage parseRequest(String requestLine)
throws TextProtocol.InvalidMessageException
requestLine -
TextProtocol.InvalidMessageException
getRequestMessage
public TextProtocol.RequestMessage getRequestMessage(SocketChannel channel)
throws IOException
channel - the channel delivering the request
IOException
process
public TextProtocol.ResponseMessage process(Object requestProcessor,
TextProtocol.RequestMessage requestMessage)
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
Copyright (c) 2004-2010 Oracle. All rights reserved.