public Reactor create(final String name, final Callback callback, final long timeout) { return new DefaultReactor(name, callback, timeout); } }
private ZooKeeperRegistrarService(final Builder builder) { this.client = checkNotNull(builder.zooKeeperClient); this.zooKeeperRegistrar = checkNotNull(builder.zooKeeperRegistrar); this.zkRegistrationSignal = Optional.ofNullable(builder.zkRegistrationSignal); this.retryIntervalPolicy = checkNotNull(builder.retryIntervalPolicy); this.sleeper = checkNotNull(builder.sleeper); this.reactor = new DefaultReactor("zk-client-async-init", new Update()); }
public RetryingZooKeeperNodeWriter(final String name, final ZooKeeperClient client) { this.client = client; this.reactor = new DefaultReactor(name, new Update(), RETRY_INTERVAL_MILLIS); }
private ZooKeeperUpdatingPersistentDirectory(final String name, final ZooKeeperClientProvider provider, final Path stateFile, final String path) throws IOException, InterruptedException { this.provider = provider; this.path = path; this.entries = PersistentAtomicReference.create(stateFile, ENTRIES_TYPE, Suppliers.ofInstance(EMPTY_ENTRIES)); this.reactor = new DefaultReactor(name, new Update(), RETRY_INTERVAL_MILLIS); }
public Supervisor(final Builder builder) { this.job = checkNotNull(builder.job, "job"); this.docker = checkNotNull(builder.dockerClient, "docker"); this.restartPolicy = checkNotNull(builder.restartPolicy, "restartPolicy"); this.metrics = checkNotNull(builder.metrics, "metrics"); this.listener = checkNotNull(builder.listener, "listener"); this.currentCommand = new Nop(); this.containerId = builder.existingContainerId; this.runnerFactory = checkNotNull(builder.runnerFactory, "runnerFactory"); this.statusUpdater = checkNotNull(builder.statusUpdater, "statusUpdater"); this.monitor = checkNotNull(builder.monitor, "monitor"); this.reactor = new DefaultReactor("supervisor-" + job.getId(), new Update(), SECONDS.toMillis(30)); this.reactor.startAsync(); statusUpdater.setContainerId(containerId); this.sleeper = builder.sleeper; }
public PersistentPathChildrenCache(final CuratorFramework curator, final String path, final String clusterId, final Path snapshotFile, final JavaType valueType) throws IOException, InterruptedException { this.curator = curator; this.path = path; this.clusterId = clusterId; this.valueType = valueType; final MapType mapType = Json.typeFactory().constructMapType(HashMap.class, Json.type(String.class), valueType); final Supplier<Map<String, T>> empty = Suppliers.ofInstance(Collections.<String, T>emptyMap()); this.snapshot = PersistentAtomicReference.create(snapshotFile, mapType, empty); this.reactor = new DefaultReactor("zk-ppcc:" + path, new Update(), REFRESH_INTERVAL_MILLIS); curator.getConnectionStateListenable().addListener(new ConnectionListener()); }
public Reactor create(final String name, final Callback callback, final long timeout) { return new DefaultReactor(name, callback, timeout); } }
public ZooKeeperRegistrar(final ZooKeeperClient client, final ZooKeeperRegistrarEventListener eventListener, final RetryIntervalPolicy retryIntervalPolicy) { this.client = client; this.eventListener = eventListener; this.retryIntervalPolicy = retryIntervalPolicy; this.reactor = new DefaultReactor("zk-client-async-init", new Update()); }
public RetryingZooKeeperNodeWriter(final String name, final ZooKeeperClient client) { this.client = client; this.reactor = new DefaultReactor(name, new Update(), RETRY_INTERVAL_MILLIS); }
private ZooKeeperUpdatingPersistentDirectory(final String name, final ZooKeeperClientProvider provider, final Path stateFile, final String path) throws IOException, InterruptedException { this.provider = provider; this.path = path; this.entries = PersistentAtomicReference.create(stateFile, ENTRIES_TYPE, Suppliers.ofInstance(EMPTY_ENTRIES)); this.reactor = new DefaultReactor(name, new Update(), RETRY_INTERVAL_MILLIS); }
public Supervisor(final Builder builder) { this.job = checkNotNull(builder.job, "job"); this.docker = checkNotNull(builder.dockerClient, "docker"); this.restartPolicy = checkNotNull(builder.restartPolicy, "restartPolicy"); this.metrics = checkNotNull(builder.metrics, "metrics"); this.listener = checkNotNull(builder.listener, "listener"); this.currentCommand = new Nop(); this.containerId = builder.existingContainerId; this.runnerFactory = checkNotNull(builder.runnerFactory, "runnerFactory"); this.statusUpdater = checkNotNull(builder.statusUpdater, "statusUpdater"); this.monitor = checkNotNull(builder.monitor, "monitor"); this.reactor = new DefaultReactor("supervisor-" + job.getId(), new Update(), SECONDS.toMillis(30)); this.reactor.startAsync(); statusUpdater.setContainerId(containerId); this.sleeper = builder.sleeper; }
public PersistentPathChildrenCache(final CuratorFramework curator, final String path, final String clusterId, final Path snapshotFile, final JavaType valueType) throws IOException, InterruptedException { this.curator = curator; this.path = path; this.clusterId = clusterId; this.valueType = valueType; final MapType mapType = Json.typeFactory().constructMapType(HashMap.class, Json.type(String.class), valueType); final Supplier<Map<String, T>> empty = Suppliers.ofInstance(Collections.<String, T>emptyMap()); this.snapshot = PersistentAtomicReference.create(snapshotFile, mapType, empty); this.reactor = new DefaultReactor("zk-ppcc:" + path, new Update(), REFRESH_INTERVAL_MILLIS); curator.getConnectionStateListenable().addListener(new ConnectionListener()); }