private void removeExecutionPlanConfiguration(String name, int tenantId) { Map<String, ExecutionPlan> executionPlanMap = tenantSpecificExecutionPlans.get(tenantId); if (executionPlanMap != null && executionPlanMap.containsKey(name)) { ExecutionPlan executionPlan = executionPlanMap.remove(name); executionPlan.shutdown(); ExecutionPlanConfiguration executionPlanConfiguration = executionPlan.getExecutionPlanConfiguration(); // releasing junction listeners. for (SiddhiEventConsumer eventConsumer : executionPlan.getSiddhiEventConsumers()) { EventProcessorValueHolder.getEventStreamService().unsubscribe(eventConsumer, tenantId); } for (EventProducer eventProducer : executionPlan.getEventProducers()) { EventProcessorValueHolder.getEventStreamService().unsubscribe(eventProducer, tenantId); } } }
public void deactivateActiveExecutionPlanConfigurations(String streamId, int tenantId) { List<String> toDeactivateExecutionPlan = new ArrayList<String>(); Map<String, ExecutionPlan> executionPlanMap = tenantSpecificExecutionPlans.get(tenantId); if (executionPlanMap != null) { for (ExecutionPlan executionPlan : executionPlanMap.values()) { boolean done = false; for (EventProducer eventProducer : executionPlan.getEventProducers()) { if (eventProducer.getStreamId().equals(streamId)) { toDeactivateExecutionPlan.add(executionPlan.getName()); done = true; break; } } if (!done) { for (SiddhiEventConsumer eventConsumer : executionPlan.getSiddhiEventConsumers()) { if (eventConsumer.getStreamId().equals(streamId)) { toDeactivateExecutionPlan.add(executionPlan.getName()); break; } } } } } if (toDeactivateExecutionPlan.size() > 0) { for (String name : toDeactivateExecutionPlan) { ExecutionPlanConfigurationFile executionPlanConfigurationFile = getExecutionPlanConfigurationFileByPlanName(name, tenantId); try { EventProcessorConfigurationFilesystemInvoker.reload( executionPlanConfigurationFile.getFileName(), executionPlanConfigurationFile.getAxisConfiguration()); } catch (Exception e) { log.error( "Exception occurred while trying to deploy the Execution Plan configuration file : " + new File(executionPlanConfigurationFile.getFileName()).getName()); } } } }