@Override public void flush() { flushServiceProxy(eventManager); } }
@Override public void flushRequests() { ServiceProxyUtils.flushServiceProxy(keyValueStoreService); } });
@Override public void flushRequests() { ServiceProxyUtils.flushServiceProxy(keyValueStoreService); } });
private void flushReplicas() { if (!ServiceProxyUtils.flushServiceProxy(replica)) { replica.flush(); } }
@Override public void flush() { eventConnector.flush(); ServiceProxyUtils.flushServiceProxy(eventConnector); } }
private void flushReplicator(final Pair<EndpointDefinition, StatReplicator> statReplicator, final List<Pair<EndpointDefinition, StatReplicator>> badReplicators) { try { ServiceProxyUtils.flushServiceProxy(statReplicator.getSecond()); } catch (Exception exception) { badReplicators.add(statReplicator); logger.info("Replicator failed " + statReplicator, exception); } }
private void flushEventManagerCalls() { final EventManager eventManager = factory.eventManagerProxy(); if (eventManager != null) { ServiceProxyUtils.flushServiceProxy(eventManager); factory.clearEventManagerProxy(); } }
/** * flush events. */ @QueueCallback({QueueCallbackType.LIMIT, QueueCallbackType.EMPTY}) void process() { ServiceProxyUtils.flushServiceProxy(eventManager); } }
/** * flush events. */ @QueueCallback({QueueCallbackType.LIMIT, QueueCallbackType.EMPTY}) void process() { ServiceProxyUtils.flushServiceProxy(recordChannel); } }
/** * flush events. */ @QueueCallback({QueueCallbackType.LIMIT, QueueCallbackType.EMPTY}) void process() { ServiceProxyUtils.flushServiceProxy(eventManager); } }
/** * Start this. */ public void start() { server.setHttpRequestConsumer(proxyService::handleRequest); server.setHttpRequestsIdleConsumer(aVoid -> flushServiceProxy(proxyService)); server.startServer(); }
/** * Send record over record event channel. */ public void addRecord(final Record record) { recordChannel.newRecord(record); ServiceProxyUtils.flushServiceProxy(recordChannel); }
public void process() { time = timer.time(); reactor.process(); processHandler.ifPresent(Runnable::run); stats.clientProxyFlush(); healthServiceClient.ifPresent(ClientProxy::clientProxyFlush); servicesToFlush.forEach((service) -> { try { ServiceProxyUtils.flushServiceProxy(service); } catch (Exception ex) { logger.error("Unable to flush service on behalf of service " + serviceName, ex); } }); }
public boolean hasKey(String key) throws InterruptedException { final CountDownLatch getLatch = new CountDownLatch(1); final AtomicBoolean reference = new AtomicBoolean(); kvStore.hasKey(present -> { reference.set(present); getLatch.countDown(); }, key); Sys.sleep(100); ServiceProxyUtils.flushServiceProxy(kvStore); getLatch.await(2, TimeUnit.SECONDS); return reference.get(); }
public void handleCheckIn() { if (healthServiceAsync == null) { if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) { lastCheckIn.set(Timer.clockTime()); serviceDiscovery.checkInOk(endpointDefinition.getId()); } } else { if (Timer.clockTime() - lastCheckIn.get() > checkInEveryMiliDuration) { lastCheckIn.set(Timer.clockTime()); healthServiceAsync.ok(ok::set); ServiceProxyUtils.flushServiceProxy(healthServiceAsync); if (ok.get()) { serviceDiscovery.checkInOk(endpointDefinition.getId()); } else { serviceDiscovery.checkIn(endpointDefinition.getId(), HealthStatus.FAIL); } ServiceProxyUtils.flushServiceProxy(serviceDiscovery); } } }
public Optional<Todo> getTodoForKey(String key) throws InterruptedException { final CountDownLatch getLatch = new CountDownLatch(1); final AtomicReference<Optional<Todo>> reference = new AtomicReference<>(); kvStore.get(todo -> { reference.set(todo); getLatch.countDown(); }, key); Sys.sleep(100); ServiceProxyUtils.flushServiceProxy(kvStore); getLatch.await(2, TimeUnit.SECONDS); assertNotNull(reference.get()); return reference.get(); }
public Optional<String> getTodoForKeyFromBacking(String key) throws InterruptedException { final CountDownLatch getLatch = new CountDownLatch(1); final AtomicReference<Optional<String>> reference = new AtomicReference<>(); lowLevelKVStore.getString(todo -> { reference.set(todo); getLatch.countDown(); }, key); Sys.sleep(100); ServiceProxyUtils.flushServiceProxy(lowLevelKVStore); getLatch.await(2, TimeUnit.SECONDS); assertNotNull(reference.get()); return reference.get(); }
@Test public void testCheckInOkUsingCheckIn() throws Exception { final CountDownLatch countDownLatch = new CountDownLatch(1); final AtomicBoolean result = new AtomicBoolean(); healthService.register("foo", 1, TimeUnit.SECONDS); healthService.checkIn("foo", HealthStatus.PASS); healthService.findHealthyNodes(names -> { result.set(names.stream().anyMatch(s -> s.equals("foo"))); countDownLatch.countDown(); } ); ServiceProxyUtils.flushServiceProxy(healthService); countDownLatch.await(10, TimeUnit.SECONDS); assertTrue("foo is found among the healthy ", result.get()); }
@Test public void testWithReturn() { final MultiWorkerClient worker = bundle.createLocalProxy(MultiWorkerClient.class, "/workers"); final AtomicInteger callbackCounter = new AtomicInteger(); for (int index = 0; index < 200; index++) { worker.doSomeWork2(integer -> callbackCounter.incrementAndGet()); } ServiceProxyUtils.flushServiceProxy(worker); super.waitForTrigger(30, o -> callbackCounter.get() >= 200); assertEquals(200, callbackCounter.get()); }
@Test public void testSendSimple() throws Exception { final EventManager eventManager = eventServiceQueue.createProxy(EventManager.class); final CountDownLatch latch = new CountDownLatch(1); final AtomicReference<Event<Object>> ref = new AtomicReference<>(); eventManager.register("c1", event -> { latch.countDown(); ref.set(event); }); eventManager.send("c1", "hello"); ServiceProxyUtils.flushServiceProxy(eventManager); latch.await(1, TimeUnit.SECONDS); assertNotNull(ref.get()); }