mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-331 added the first part of this code, Ozan will complete and issue a pull request
Conflicts: src/main/java/net/openhft/chronicle/hash/replication/AbstractReplication.java src/main/java/net/openhft/chronicle/map/ChannelProvider.java src/main/java/net/openhft/chronicle/map/Replicators.java src/main/java/net/openhft/chronicle/map/TcpReplicator.java
This commit is contained in:
@@ -26,18 +26,22 @@ import java.io.Serializable;
|
||||
*/
|
||||
public abstract class AbstractReplication implements Serializable {
|
||||
private final byte localIdentifier;
|
||||
private final
|
||||
|
||||
@Nullable
|
||||
TcpTransportAndNetworkConfig tcpConfig;
|
||||
private final
|
||||
private final TcpTransportAndNetworkConfig tcpConfig;
|
||||
|
||||
@Nullable
|
||||
UdpTransportConfig udpConfig;
|
||||
private final
|
||||
private final UdpTransportConfig udpConfig;
|
||||
|
||||
@Nullable
|
||||
transient RemoteNodeValidator remoteNodeValidator;
|
||||
private final transient RemoteNodeValidator remoteNodeValidator;
|
||||
|
||||
private final boolean bootstrapOnlyLocalEntries;
|
||||
private final String name;
|
||||
|
||||
@Nullable
|
||||
private final transient ConnectionListener connectionListener;
|
||||
|
||||
// package-private to forbid subclassing from outside of the package
|
||||
AbstractReplication(byte localIdentifier, Builder builder) {
|
||||
this.localIdentifier = localIdentifier;
|
||||
@@ -46,6 +50,7 @@ public abstract class AbstractReplication implements Serializable {
|
||||
remoteNodeValidator = builder.remoteNodeValidator;
|
||||
bootstrapOnlyLocalEntries = builder.bootstrapOnlyLocalEntries;
|
||||
name = builder.name;
|
||||
connectionListener = builder.connectionListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,6 +90,10 @@ public abstract class AbstractReplication implements Serializable {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ConnectionListener connectionListener() {
|
||||
return this.connectionListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder of {@link AbstractReplication} configurations. This class and it's subclasses are
|
||||
* mutable, configuration methods mutate the builder and return it back for convenient
|
||||
@@ -99,6 +108,8 @@ public abstract class AbstractReplication implements Serializable {
|
||||
private TcpTransportAndNetworkConfig tcpConfig = null;
|
||||
private UdpTransportConfig udpConfig = null;
|
||||
private RemoteNodeValidator remoteNodeValidator = null;
|
||||
private ConnectionListener connectionListener = null;
|
||||
|
||||
private boolean bootstrapOnlyLocalEntries = false;
|
||||
private String name = "(unknown)";
|
||||
|
||||
@@ -133,6 +144,13 @@ public abstract class AbstractReplication implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public B connectionListener(@Nullable ConnectionListener connectionListener) {
|
||||
this.connectionListener = connectionListener;
|
||||
return (B) this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Configures if the node, provided with replication, created by this builder, should
|
||||
* replicate only local data, last updated with own identifier, or all data currently
|
||||
|
||||
Reference in New Issue
Block a user