/** * Schedule another micro service check */ public synchronized void scheduleCheck() { TaskExecutor.getInstance().addScheduledTask(new HealthCheck(), period, period, unit); }
private TaskExecutor(){ executor = obtainSession(); } public static TaskExecutor getInstance() { return singleton; }
/** * Pause the microservice and schedule a check */ protected synchronized void setUnhealthy(String why) { if (healthy) { healthy = false; reason = why; resetWatch(); // cancel all tasks in the task executor service TaskExecutor.getInstance().shutDown(); // stop listening for commands and pause data ingestion ConsumeManager.stopConsumption(); // shut down also RabbitMQ Publisher RabbitMQPublisher.shutDown(); // optionally kill the micro service if (kill) System.exit(Main.ERR_HEALTH); // schedule micro service check scheduleCheck(); } }
/** * Nack and optionally schedule a health check */ private void nackAndScheduleHealthCheck() { if (deliveryTag != null) consumer.nackMessage(deliveryTag); if (healthCheck) TaskExecutor.getInstance().executeNow(new HealthCheck()); }
@Override public void run() { logger.trace("We are shutting down UDR micro service"); // shut down executor service TaskExecutor.getInstance().forceShutDown(); // and Consumer (RabbitMQ) ConsumeManager.stopDataAndCommandProcessing(); // don't forget about Publisher (RabbitMQ) RabbitMQPublisher.shutDown(); // as well as db pool manager new DbAccess().shutDown(); } }
public CDRConsumer() { this.executor = TaskExecutor.getInstance(); }
@Override public void consume(String content, ConsumerEntry consumer, Long deliveryTag) { executor.addTask(new CDRProcess(content, consumer, deliveryTag, true)); } }
/** * Pause the microservice and schedule a check */ protected synchronized void setUnhealthy(String why) { if (healthy) { healthy = false; reason = why; resetWatch(); // cancel all tasks in the task executor service TaskExecutor.getInstance().shutDown(); // stop listening for commands and pause data ingestion ConsumeManager.stopDataAndCommandProcessing(); // shut down also RabbitMQ Publisher RabbitMQPublisher.shutDown(); // close the database pool new DbAccess().shutDown(); // optionally kill the micro service if (kill) System.exit(Main.ERR_HEALTH); // schedule micro service check scheduleCheck(); } }
/** * Nack and optionally schedule a health check */ private void nackAndScheduleHealthCheck() { if (deliveryTag != null) consumer.nackMessage(deliveryTag); if (healthCheck) TaskExecutor.getInstance().executeNow(new HealthCheck()); }
@Override public void run() { logger.trace("We are shutting down CDR micro service"); // shut down executor service TaskExecutor.getInstance().forceShutDown(); // and Consumer (RabbitMQ) ConsumeManager.stopDataAndCommandProcessing(); // don't forget about Publisher (RabbitMQ) RabbitMQPublisher.shutDown(); // as well as db pool manager new DbAccess().shutDown(); } }
public BillConsumer() { this.executor = TaskExecutor.getInstance(); }
@Override public void consume(String content, ConsumerEntry consumer, Long deliveryTag) { executor.addTask(new UsageProcess(content, consumer, deliveryTag, true)); } }
/** * Pause the microservice and schedule a check */ protected synchronized void setUnhealthy(String why) { if (healthy) { healthy = false; reason = why; resetWatch(); // cancel all tasks in the task executor service TaskExecutor.getInstance().shutDown(); // stop listening for commands and pause data ingestion ConsumeManager.stopDataAndCommandProcessing(); // shut down also RabbitMQ Publisher RabbitMQPublisher.shutDown(); // close the database pool new DbAccess().shutDown(); // optionally kill the micro service if (kill) System.exit(Main.ERR_HEALTH); // schedule micro service check scheduleCheck(); } }
/** * Nack and optionally schedule a health check */ private void nackAndScheduleHealthCheck() { if (deliveryTag != null) consumer.nackMessage(deliveryTag); if (healthCheck) TaskExecutor.getInstance().executeNow(new HealthCheck()); }
private TaskExecutor(){ executor = obtainSession(); } public static TaskExecutor getInstance() { return singleton; }
/** * Schedule another micro service check */ public synchronized void scheduleCheck() { TaskExecutor.getInstance().addScheduledTask(new HealthCheck(), period, period, unit); }
@Override public void run() { logger.trace("We are shutting down Billing micro service"); // shut down executor service TaskExecutor.getInstance().forceShutDown(); // and Consumer (RabbitMQ) ConsumeManager.stopDataAndCommandProcessing(); // don't forget about Publisher (RabbitMQ) RabbitMQPublisher.shutDown(); // as well as db pool manager new DbAccess().shutDown(); } }
public UsageConsumer() { this.executor = TaskExecutor.getInstance(); }
@Override public void consume(String content, ConsumerEntry consumer, Long deliveryTag) { executor.addTask(new BillProcess(content, consumer, deliveryTag, true)); } }
/** * Pause the microservice and schedule a check */ protected synchronized void setUnhealthy(String why) { if (healthy) { healthy = false; reason = why; resetWatch(); // cancel all tasks in the task executor service TaskExecutor.getInstance().shutDown(); // stop listening for commands and pause data ingestion ConsumeManager.stopDataAndCommandProcessing(); // shut down also RabbitMQ Publisher RabbitMQPublisher.shutDown(); // close the database pool new DbAccess().shutDown(); // optionally kill the micro service if (kill) System.exit(Main.ERR_HEALTH); // schedule micro service check scheduleCheck(); } }