.withStorage(storage) .withElectionTimeout(Duration.ofMillis(mConf.getElectionTimeoutMs())) .withHeartbeatInterval(Duration.ofMillis(mConf.getHeartbeatIntervalMs())) .withSnapshotAllowed(mSnapshotAllowed) .withSerializer(createSerializer())
/** * Sets the replica heartbeat interval, returning the replica builder for method chaining. * <p> * The heartbeat interval is the interval at which the replica, if elected leader, should contact * other replicas within the cluster to maintain its leadership. The heartbeat interval should * always be some fraction of {@link #withElectionTimeout(Duration)}. * * @param heartbeatInterval The replica heartbeat interval in milliseconds. * @return The replica builder. * @throws NullPointerException if {@code heartbeatInterval} is null */ public Builder withHeartbeatInterval(Duration heartbeatInterval) { serverBuilder.withHeartbeatInterval(heartbeatInterval); return this; }
/** * Sets the server heartbeat interval, returning the server builder for method chaining. * <p> * The heartbeat interval is the interval at which the server, if elected leader, should contact * other servers within the cluster to maintain its leadership. The heartbeat interval should * always be some fraction of {@link #withElectionTimeout(Duration)}. * * @param heartbeatInterval The server heartbeat interval in milliseconds. * @return The server builder. * @throws NullPointerException if {@code heartbeatInterval} is null */ public Builder withHeartbeatInterval(Duration heartbeatInterval) { builder.withHeartbeatInterval(heartbeatInterval); return this; }
/** * Sets the server heartbeat interval, returning the server builder for method chaining. * <p> * The heartbeat interval is the interval at which the server, if elected leader, should contact * other servers within the cluster to maintain its leadership. The heartbeat interval should * always be some fraction of {@link #withElectionTimeout(Duration)}. * * @param heartbeatInterval The server heartbeat interval in milliseconds. * @return The server builder. * @throws NullPointerException if {@code heartbeatInterval} is null */ public Builder withHeartbeatInterval(Duration heartbeatInterval) { builder.withHeartbeatInterval(heartbeatInterval); return this; }