/** * @param replica * @param externalizable * @param tcpReplicatorBuilder * @param maxEntrySizeBytes used to check that the last entry will fit into the buffer, it can not * be smaller than the size of and entry, if it is set smaller the buffer will over flow, it * can be larger then the entry, but setting it too large reduces the workable space in the * buffer. * @throws IOException */ TcpReplicator( @NotNull final Replica replica, @NotNull final EntryExternalizable externalizable, @NotNull final TcpReplicatorBuilder tcpReplicatorBuilder, final int maxEntrySizeBytes) throws IOException { super("TcpSocketReplicator-" + replica.identifier(), tcpReplicatorBuilder, maxEntrySizeBytes); serverInetSocketAddress = tcpReplicatorBuilder.serverInetSocketAddress(); heartBeatInterval = tcpReplicatorBuilder.heartBeatInterval(MILLISECONDS); long throttleBucketInterval = tcpReplicatorBuilder.throttleBucketInterval(MILLISECONDS); selectorTimeout = Math.min(heartBeatInterval, throttleBucketInterval); packetSize = tcpReplicatorBuilder.packetSize(); endpoints = tcpReplicatorBuilder.endpoints(); this.replica = replica; this.localIdentifier = replica.identifier(); this.maxEntrySizeBytes = maxEntrySizeBytes; this.externalizable = externalizable; start(); }