public InterestChannelInvoker(ClientInterestChannel delegate, Scheduler scheduler) { // TODO: add invoker metrics to the client super(SerializedTaskInvokerMetrics.dummyMetrics(), scheduler); this.delegate = delegate; }
private void addAndSchedule(InvokerTask<?, ?> invokerTask) { boolean success = taskQueue.add(invokerTask); if (success) { queueSize.incrementAndGet(); metrics.incrementInputSuccess(); metrics.setQueueSize(queueSize.get()); } else { // needed? ConcurrentLinkedDeque never returns false for add metrics.incrementInputFailure(); } if (executorScheduled.compareAndSet(false, true)) { worker.schedule(executeAction); } }
@Override public void call() { executorScheduled.set(false); while (!taskQueue.isEmpty()) { InvokerTask<?, ?> task = taskQueue.poll(); if (task.execute()) { metrics.incrementOutputSuccess(); } else { task.cancel(); metrics.incrementOutputFailure(); } queueSize.getAndDecrement(); metrics.setQueueSize(queueSize.get()); } } };
bind(SerializedTaskInvokerMetrics.class).toInstance(new SerializedTaskInvokerMetrics("registry")); bind(EurekaServerRegistry.class).to(EurekaReadServerRegistry.class);
evictionQueueMetrics.bindMetrics(); SerializedTaskInvokerMetrics registryTaskInvokerMetrics = new SerializedTaskInvokerMetrics("registry"); registryTaskInvokerMetrics.bindMetrics();
protected void shutdown() { worker.unsubscribe(); while (!taskQueue.isEmpty()) { taskQueue.poll().cancel(); } metrics.setQueueSize(0); }
bind(SerializedTaskInvokerMetrics.class).toInstance(new SerializedTaskInvokerMetrics("registry"));
bind(SerializedTaskInvokerMetrics.class).toInstance(new SerializedTaskInvokerMetrics("registry"));