|
|||||||||
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
class
TextProtocol.Fail
static class
TextProtocol.InvalidMessageException
Used to indicate a message format or invalid content exception.
class
TextProtocol.Message
Base message class for all messages exchanged in the protocol.
static class
TextProtocol.MessageError
class
TextProtocol.MessageExchange
Use to parallelize message exchanges via Futures.
static class
TextProtocol.MessageOp
The Operations that are part of the protocol.
class
TextProtocol.OK
class
TextProtocol.ProtocolError
class
TextProtocol.RequestMessage
Base class for all Request messages
class
TextProtocol.ResponseMessage
Base classes for response messages.
protected static class
TextProtocol.StringFormatable
static class
TextProtocol.TOKENS
Represents the tokens on a message line.
protected static interface
TextProtocol.WireFormatable
Field Summary
protected EnvironmentImpl
envImpl
TextProtocol.MessageOp
FAIL_RESP
protected Formatter
formatter
protected Logger
logger
protected String
messagePrefixNocheck
TextProtocol.MessageOp
OK_RESP
TextProtocol.MessageOp
PROTOCOL_ERROR
static String
SEPARATOR
static String
SEPARATOR_REGEXP
Constructor Summary
TextProtocol(String version,
String groupName,
NameIdPair nameIdPair,
EnvironmentImpl envImpl)
Creates an instance of the Protocol.
Method Summary
int
getOpenTimeout()
int
getReadTimeout()
TextProtocol.RequestMessage
getRequestMessage(SocketChannel channel)
Reads the channel and returns a read request.
protected void
initializeMessageOps(TextProtocol.MessageOp[] protocolOps)
The messages as defined by the subclass.
int
messageCount()
TextProtocol.Message
parse(String line)
Parses a line into a Request/Response message.
TextProtocol.RequestMessage
parseRequest(String requestLine)
Converts a request line into a requestMessage.
(package private) TextProtocol.ResponseMessage
parseResponse(String responseLine)
Converts a response line into a ResponseMessage.
TextProtocol.ResponseMessage
process(Object requestProcessor,
TextProtocol.RequestMessage requestMessage)
protected void
setTimeouts(RepImpl repImpl,
DurationConfigParam openTimeoutConfig,
DurationConfigParam readTimeoutConfig)
Set the network timeouts associated with uses of this protocol instance.
void
updateNodeIds(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.