Class AbstractReplicator
- java.lang.Object
-
- com.moilioncircle.redis.replicator.AbstractReplicatorListener
-
- com.moilioncircle.redis.replicator.AbstractReplicator
-
- All Implemented Interfaces:
Replicator,ReplicatorListener,ReplicatorRegister,Closeable,AutoCloseable
- Direct Known Subclasses:
RedisAofReplicator,RedisMixReplicator,RedisRdbReplicator,RedisScanReplicator,RedisSocketReplicator
public abstract class AbstractReplicator extends AbstractReplicatorListener implements Replicator
- Since:
- 2.1.0
- Version:
- 2.1.1
- Author:
- Leon Chen
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<CommandName,CommandParser<? extends Command>>commandsprotected Configurationconfigurationprotected AtomicReference<Status>connectedprotected RedisInputStreaminputStreamprotected Map<ModuleKey,ModuleParser<? extends Module>>modulesprotected RdbVisitorrdbVisitor-
Fields inherited from class com.moilioncircle.redis.replicator.AbstractReplicatorListener
closeListeners, eventListeners, exceptionListeners, rawByteListeners, statusListeners
-
-
Constructor Summary
Constructors Constructor Description AbstractReplicator()
-
Method Summary
-
Methods inherited from class com.moilioncircle.redis.replicator.AbstractReplicatorListener
addCloseListener, addEventListener, addExceptionListener, addRawByteListener, addStatusListener, doCloseListener, doEventListener, doExceptionListener, doStatusListener, removeCloseListener, removeEventListener, removeExceptionListener, removeRawByteListener, removeStatusListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.moilioncircle.redis.replicator.ReplicatorListener
addCloseListener, addEventListener, addExceptionListener, addRawByteListener, addStatusListener, removeCloseListener, removeEventListener, removeExceptionListener, removeRawByteListener, removeStatusListener
-
-
-
-
Field Detail
-
configuration
protected Configuration configuration
-
inputStream
protected RedisInputStream inputStream
-
rdbVisitor
protected RdbVisitor rdbVisitor
-
connected
protected final AtomicReference<Status> connected
-
modules
protected final Map<ModuleKey,ModuleParser<? extends Module>> modules
-
commands
protected final Map<CommandName,CommandParser<? extends Command>> commands
-
-
Method Detail
-
getCommandParser
public CommandParser<? extends Command> getCommandParser(CommandName command)
- Specified by:
getCommandParserin interfaceReplicatorRegister
-
addCommandParser
public <T extends Command> void addCommandParser(CommandName command, CommandParser<T> parser)
- Specified by:
addCommandParserin interfaceReplicatorRegister
-
removeCommandParser
public CommandParser<? extends Command> removeCommandParser(CommandName command)
- Specified by:
removeCommandParserin interfaceReplicatorRegister
-
getModuleParser
public ModuleParser<? extends Module> getModuleParser(String moduleName, int moduleVersion)
- Specified by:
getModuleParserin interfaceReplicatorRegister
-
addModuleParser
public <T extends Module> void addModuleParser(String moduleName, int moduleVersion, ModuleParser<T> parser)
- Specified by:
addModuleParserin interfaceReplicatorRegister
-
removeModuleParser
public ModuleParser<? extends Module> removeModuleParser(String moduleName, int moduleVersion)
- Specified by:
removeModuleParserin interfaceReplicatorRegister
-
submitEvent
public void submitEvent(Event event)
-
setStatus
protected void setStatus(Status next)
-
verbose
public boolean verbose()
- Specified by:
verbosein interfaceReplicatorRegister
-
getStatus
public Status getStatus()
- Specified by:
getStatusin interfaceReplicatorRegister
-
getConfiguration
public Configuration getConfiguration()
- Specified by:
getConfigurationin interfaceReplicatorRegister
-
setRdbVisitor
public void setRdbVisitor(RdbVisitor rdbVisitor)
- Specified by:
setRdbVisitorin interfaceReplicatorRegister
-
getRdbVisitor
public RdbVisitor getRdbVisitor()
- Specified by:
getRdbVisitorin interfaceReplicatorRegister
-
builtInCommandParserRegister
public void builtInCommandParserRegister()
- Specified by:
builtInCommandParserRegisterin interfaceReplicatorRegister
-
open
public void open() throws IOException- Specified by:
openin interfaceReplicator- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReplicator- Throws:
IOException
-
doOpen
protected void doOpen() throws IOException- Throws:
IOException
-
doClose
protected void doClose() throws IOException- Throws:
IOException
-
-