public void destroy() { if (LOG.isInfoEnabled()) { LOG.info("Esper statement [" + epl + "] being destroyed"); } this.epStatement.destroy(); if (LOG.isInfoEnabled()) { LOG.info("Esper statement [" + epl + "] destroyed"); } }
public synchronized void removeConsumer() { if (0 == consumers.decrementAndGet()) { statement.stop(); statement.destroy(); } }
public void recreateSchema(int eplId, Schema schema) { EPStatement schemaState = schemaStateMap.get(eplId); if(schemaState != null) schemaState.destroy(); String schemaSql = schema.getCreateSchemaSql(); schemaState = this.admin.createEPL(schemaSql); if(schemaState != null) schemaStateMap.put(schema.getId(), schemaState); LOG.info("Recreate Schema : " + schemaSql); }
public void destory(Object id, String type) { if ("method".equals(type) && id != null) { Method md = this.allMethods.get(id); if(md != null) this.configuration.removeImport(md.getMethodName()); } else if ("epl".equals(type)) { if(eplStateMap.containsKey(id) && !eplStateMap.get(id).isDestroyed()) { eplStateMap.get(id).destroy(); eplStateMap.remove(id); } } else if ("db".equals(type)) { this.configuration.getDatabaseReferences().remove(id); } else if ("schema".equals(type)) { if(schemaStateMap.containsKey(id) && !schemaStateMap.get(id).isDestroyed()) { schemaStateMap.get(id).destroy(); schemaStateMap.remove(id); } } }
/** * Removes all statements and listeners from the esper engine, */ public void removeFromEngine() { for (EPStatement epst : this.epStatements.values()) { if (logger.isDebugEnabled()) logger.debug("Removing statement: \n\t" + epst.getText()); epst.removeAllListeners(); epst.destroy(); } /* destroy this complete engine - its independent */ this.epService.destroy(); }
public void recreateSchema(int schemaId, Schema schema) { List<EPStatement> schemaStates = schemaStateMap.get(schemaId); for(EPStatement schemaState : schemaStates) { if(schemaState != null && !schemaState.isDestroyed()) schemaState.destroy(); groupKeyMap.get(schema.getId()).clear(); } addSchemas(schema.getId()); }
public void destory(Object id, String type) { if ("method".equals(type) && id != null) { Method md = this.allMethods.get(id); if(md != null) this.configuration.removeImport(md.getMethodName()); LOG.info("Remove Method : " + md.getMethodName()); } else if ("epl".equals(type)) { if(eplStateMap.containsKey(id) && !eplStateMap.get(id).isDestroyed()) { eplStateMap.get(id).destroy(); LOG.info("Destroy Method : " + eplStateMap.get(id).getText()); eplStateMap.remove(id); } } else if ("db".equals(type)) { if(this.configuration.getDatabaseReferences().containsKey(id)) { this.configuration.getDatabaseReferences().remove(id); LOG.info("Remove Data Source : " + this.configuration.getDatabaseReferences().get(id)); } } else if ("schema".equals(type)) { if(schemaStateMap.containsKey(id)) { List<EPStatement> epStatementList = schemaStateMap.get(id); for(EPStatement ePStatement: epStatementList) { if(!ePStatement.isDestroyed()) { LOG.info("Destroy Data Schema : " + schemaStateMap.get(id)); ePStatement.destroy(); } } } schemaStateMap.remove(id); } }
@Override public void onDelete(Trigger object) { log.debug("Destroying EPSstatement:{}",epStatement.getName()); epService.getEPAdministrator().getStatement(epStatement.getName()).destroy(); } }
public void recreateEpl(int eplId, Epl epl) { EPStatement epStatement = eplStateMap.get(eplId); if(epStatement != null && !epStatement.isDestroyed()) { epStatement.removeAllListeners(); epStatement.destroy(); } String eplSql = epl.getEplSql(); String[] eplSqls = eplSql.trim().split(";"); for(int i = 0; i < eplSqls.length; i++) { if(!StringUtils.isBlank(eplSqls[i])) { if(i == eplSqls.length - 1) { epStatement = this.admin.createEPL(eplSqls[i].trim()); LOG.info("Add statistic epl : " + eplSql); if(epStatement != null) eplStateMap.put(epl.getId(), epStatement); } else { admin.createEPL(eplSqls[i].trim()); } } } epStatement.addListener(new StatisticListener(epl, collector)); LOG.info("Recreate statistic epl : " + eplSql); }
public void recreateEpl(int eplId, AlarmEpl epl) { EPStatement epStatement = eplStateMap.get(eplId); if(epStatement != null) { epStatement.removeAllListeners(); epStatement.destroy(); } String eplSql = epl.getEplSql(); epStatement = this.admin.createEPL(eplSql); epStatement.addListener(new AlertListener(epl.getAlarmEplId(), epl.getEplId(), epl.getEplName(), epl.getAlarm())); if(epStatement != null) eplStateMap.put(epl.getAlarmEplId(), epStatement); LOG.info("Recreate EPl : " + eplSql); }
@Override public void discard() { LOG.info("Removing existing statements"); for(EPStatement epStatement : epStatements) { epService.getEPAdministrator().getStatement(epStatement.getName()).removeAllListeners(); epService.getEPAdministrator().getStatement(epStatement.getName()).stop(); epService.getEPAdministrator().getStatement(epStatement.getName()).destroy(); } epStatements.clear(); for(String eventName : eventTypeNames) { try { epService.getEPAdministrator().getConfiguration().removeEventType(eventName, false); } catch (ConfigurationException ce) { LOG.error("Event type used in another statement which is still running, skipping..."); } } queue.interrupt(); }