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
This commit is contained in:
@@ -26,17 +26,21 @@ 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;
|
||||
|
||||
@Nullable
|
||||
private final transient ConnectionListener connectionListener;
|
||||
|
||||
// package-private to forbid subclassing from outside of the package
|
||||
AbstractReplication(byte localIdentifier, Builder builder) {
|
||||
this.localIdentifier = localIdentifier;
|
||||
@@ -44,6 +48,7 @@ public abstract class AbstractReplication implements Serializable {
|
||||
udpConfig = builder.udpConfig;
|
||||
remoteNodeValidator = builder.remoteNodeValidator;
|
||||
bootstrapOnlyLocalEntries = builder.bootstrapOnlyLocalEntries;
|
||||
connectionListener = builder.connectionListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,6 +83,10 @@ public abstract class AbstractReplication implements Serializable {
|
||||
return bootstrapOnlyLocalEntries;
|
||||
}
|
||||
|
||||
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
|
||||
@@ -92,6 +101,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;
|
||||
|
||||
// package-private to forbid subclassing from outside of the package
|
||||
@@ -125,6 +136,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