Class ReplicatorConfig
java.lang.Object
org.cojen.tupl.repl.ReplicatorConfig
- All Implemented Interfaces:
Cloneable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a remote member address for allowing the local member to join the group.Add a remote member address for allowing the local member to join the group.addSeed
(SocketAddress addr) Add a remote member address for allowing the local member to join the group.Set the base file name for the replicator, which must reside in an ordinary file directory.baseFilePath
(String path) Set the base file name for the replicator, which must reside in an ordinary file directory.checksumSockets
(boolean checksums) Pass true to enable CRC checksums for all socket commands written.clone()
createFilePath
(boolean mkdirs) Set true to create the directory for the replication files, if it doesn't already exist.eventListener
(EventListener listener) Set a listener which receives notifications of actions being performed by the replicator.failoverLagTimeoutMillis
(long timeout) Set a timeout for a newly elected leader to be caught up, or else a new election is run.groupToken
(long token) Set a unique group token, which acts as a simple security measure to prevent different replication groups from communicating with each other.groupTokens
(long token, long altToken) Set a unique group token (and an alternate), which acts as a simple security measure to prevent different replication groups from communicating with each other.listenAddress
(SocketAddress addr) Optionally restrict the socket address for accepting connections, which can be a wildcard address.localAddress
(SocketAddress addr) Set the local member socket address and port.localPort
(int port) Set the local member socket port, for accepting connections on any address.Set the desired local member role, which is normal by default, and for the primordial group member.Explicitly specify a connected local socket, intended only for testing.proxyWrites
(boolean proxy) Pass true to proxy writes from the leader, reducing load on the leader, but increasing commit latency a bit.serverSocketFactory
(ServerSocketFactory factory) Set a factory for creating new server-side sockets.socketFactory
(SocketFactory factory) Set a factory for creating new client-side sockets.
-
Constructor Details
-
ReplicatorConfig
public ReplicatorConfig()
-
-
Method Details
-
baseFile
Set the base file name for the replicator, which must reside in an ordinary file directory.- Throws:
IllegalArgumentException
- if file is null
-
baseFilePath
Set the base file name for the replicator, which must reside in an ordinary file directory.- Throws:
IllegalArgumentException
- if path is null
-
createFilePath
Set true to create the directory for the replication files, if it doesn't already exist. Default is true. -
groupToken
Set a unique group token, which acts as a simple security measure to prevent different replication groups from communicating with each other. Connections are accepted when the tokens match.- Throws:
IllegalArgumentException
- if the token is zero
-
groupTokens
Set a unique group token (and an alternate), which acts as a simple security measure to prevent different replication groups from communicating with each other. Connections are accepted when a token matches to any other.- Throws:
IllegalArgumentException
- if either token is zero
-
localPort
Set the local member socket port, for accepting connections on any address. Calling this overrides any explicitly set local address or listen address.- Throws:
UnknownHostException
-
localAddress
Set the local member socket address and port.- Throws:
IllegalArgumentException
- if address is null or a wildcard address
-
listenAddress
Optionally restrict the socket address for accepting connections, which can be a wildcard address.- Throws:
IllegalArgumentException
- if address is null
-
localSocket
Explicitly specify a connected local socket, intended only for testing.- Throws:
UnknownHostException
-
localRole
Set the desired local member role, which is normal by default, and for the primordial group member. Members can join an existing group only by consensus, which implies that the group has a leader. All joining members start out as restoring, and then the role is updated after the replicator has started. Role changes also require consensus.- Throws:
IllegalArgumentException
- if role is null
-
addSeed
Add a remote member address for allowing the local member to join the group. Opening a replicator for the first time without any seeds indicates that a new replication group is to be formed. If the local member is already in a group, the seeds are ignored.- Throws:
IllegalArgumentException
- if addressString is null or malformedUnknownHostException
-
addSeed
Add a remote member address for allowing the local member to join the group. Opening a replicator for the first time without any seeds indicates that a new replication group is to be formed. If the local member is already in a group, the seeds are ignored.- Throws:
IllegalArgumentException
- if hostname is null
-
addSeed
Add a remote member address for allowing the local member to join the group. Opening a replicator for the first time without any seeds indicates that a new replication group is to be formed. If the local member is already in a group, the seeds are ignored.- Throws:
IllegalArgumentException
- if address is null
-
proxyWrites
Pass true to proxy writes from the leader, reducing load on the leader, but increasing commit latency a bit. Default is false. -
checksumSockets
Pass true to enable CRC checksums for all socket commands written. Default is true. -
eventListener
Set a listener which receives notifications of actions being performed by the replicator. -
socketFactory
Set a factory for creating new client-side sockets. -
serverSocketFactory
Set a factory for creating new server-side sockets. -
failoverLagTimeoutMillis
Set a timeout for a newly elected leader to be caught up, or else a new election is run. Default is 1000 milliseconds, and a negative timeout disables the check. -
clone
-