/** * Read a configuration from a config block. * * @param cfg * configuration to read. * @param name * of the replica being configured. * @return replica configuration for {@code name}. */ public static ReplicaConfig newFromConfig(Config cfg, String name) { return new ReplicaConfig().fromConfig(cfg, name); }
/** * Configure a replica representation. * * @param leader * instance this replica follows. * @param name * unique-ish name identifying this replica for debugging. * @param cfg * how Ketch should treat the replica. */ protected KetchReplica(KetchLeader leader, String name, ReplicaConfig cfg) { this.leader = leader; this.replicaName = name; this.participation = cfg.getParticipation(); this.commitMethod = cfg.getCommitMethod(); this.commitSpeed = cfg.getCommitSpeed(); this.minRetryMillis = cfg.getMinRetry(MILLISECONDS); this.maxRetryMillis = cfg.getMaxRetry(MILLISECONDS); this.staged = new HashMap<>(); this.running = new HashMap<>(); this.waiting = new HashMap<>(); this.queued = new ArrayList<>(4); }
/** * Update the configuration from a config block. * * @param cfg * configuration to read. * @param name * of the replica being configured. * @return {@code this} */ public ReplicaConfig fromConfig(Config cfg, String name) { participation = cfg.getEnum( CONFIG_KEY_REMOTE, name, CONFIG_KEY_TYPE, participation); commitMethod = cfg.getEnum( CONFIG_KEY_REMOTE, name, CONFIG_KEY_COMMIT, commitMethod); commitSpeed = cfg.getEnum( CONFIG_KEY_REMOTE, name, CONFIG_KEY_SPEED, commitSpeed); minRetry = getMillis(cfg, name, "ketch-minRetry", minRetry); //$NON-NLS-1$ maxRetry = getMillis(cfg, name, "ketch-maxRetry", maxRetry); //$NON-NLS-1$ return this; }
ReplicaConfig kc = ReplicaConfig.newFromConfig(cfg, name); if (name.equals(localName)) { replicas.add(new LocalReplica(leader, name, kc));
ReplicaConfig kc = ReplicaConfig.newFromConfig(cfg, name); if (name.equals(localName)) { replicas.add(new LocalReplica(leader, name, kc));
/** * Configure a replica representation. * * @param leader * instance this replica follows. * @param name * unique-ish name identifying this replica for debugging. * @param cfg * how Ketch should treat the replica. */ protected KetchReplica(KetchLeader leader, String name, ReplicaConfig cfg) { this.leader = leader; this.replicaName = name; this.participation = cfg.getParticipation(); this.commitMethod = cfg.getCommitMethod(); this.commitSpeed = cfg.getCommitSpeed(); this.minRetryMillis = cfg.getMinRetry(MILLISECONDS); this.maxRetryMillis = cfg.getMaxRetry(MILLISECONDS); this.staged = new HashMap<>(); this.running = new HashMap<>(); this.waiting = new HashMap<>(); this.queued = new ArrayList<>(4); }
/** * Read a configuration from a config block. * * @param cfg * configuration to read. * @param name * of the replica being configured. * @return replica configuration for {@code name}. */ public static ReplicaConfig newFromConfig(Config cfg, String name) { return new ReplicaConfig().fromConfig(cfg, name); }
/** * Update the configuration from a config block. * * @param cfg * configuration to read. * @param name * of the replica being configured. * @return {@code this} */ public ReplicaConfig fromConfig(Config cfg, String name) { participation = cfg.getEnum( CONFIG_KEY_REMOTE, name, CONFIG_KEY_TYPE, participation); commitMethod = cfg.getEnum( CONFIG_KEY_REMOTE, name, CONFIG_KEY_COMMIT, commitMethod); commitSpeed = cfg.getEnum( CONFIG_KEY_REMOTE, name, CONFIG_KEY_SPEED, commitSpeed); minRetry = getMillis(cfg, name, "ketch-minRetry", minRetry); //$NON-NLS-1$ maxRetry = getMillis(cfg, name, "ketch-maxRetry", maxRetry); //$NON-NLS-1$ return this; }
ReplicaConfig kc = ReplicaConfig.newFromConfig(cfg, name); if (name.equals(localName)) { replicas.add(new LocalReplica(leader, name, kc));
/** * Configure a replica representation. * * @param leader * instance this replica follows. * @param name * unique-ish name identifying this replica for debugging. * @param cfg * how Ketch should treat the replica. */ protected KetchReplica(KetchLeader leader, String name, ReplicaConfig cfg) { this.leader = leader; this.replicaName = name; this.participation = cfg.getParticipation(); this.commitMethod = cfg.getCommitMethod(); this.commitSpeed = cfg.getCommitSpeed(); this.minRetryMillis = cfg.getMinRetry(MILLISECONDS); this.maxRetryMillis = cfg.getMaxRetry(MILLISECONDS); this.staged = new HashMap<>(); this.running = new HashMap<>(); this.waiting = new HashMap<>(); this.queued = new ArrayList<>(4); }
/** * Read a configuration from a config block. * * @param cfg * configuration to read. * @param name * of the replica being configured. * @return replica configuration for {@code name}. */ public static ReplicaConfig newFromConfig(Config cfg, String name) { return new ReplicaConfig().fromConfig(cfg, name); }
/** * Update the configuration from a config block. * * @param cfg * configuration to read. * @param name * of the replica being configured. * @return {@code this} */ public ReplicaConfig fromConfig(Config cfg, String name) { participation = cfg.getEnum( CONFIG_KEY_REMOTE, name, CONFIG_KEY_TYPE, participation); commitMethod = cfg.getEnum( CONFIG_KEY_REMOTE, name, CONFIG_KEY_COMMIT, commitMethod); commitSpeed = cfg.getEnum( CONFIG_KEY_REMOTE, name, CONFIG_KEY_SPEED, commitSpeed); minRetry = getMillis(cfg, name, "ketch-minRetry", minRetry); //$NON-NLS-1$ maxRetry = getMillis(cfg, name, "ketch-maxRetry", maxRetry); //$NON-NLS-1$ return this; }