本文整理汇总了Java中com.espertech.esper.client.EPStatement.destroy方法的典型用法代码示例。如果您正苦于以下问题:Java EPStatement.destroy方法的具体用法?Java EPStatement.destroy怎么用?Java EPStatement.destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.espertech.esper.client.EPStatement
的用法示例。
在下文中一共展示了EPStatement.destroy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addStatementToEngine
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
/**
* Add a EPL statement and a listener to it.
*
* @param stmtName statement name
* @param stmt statement
* @param listenerName statement listener.
*/
private void addStatementToEngine(String stmtName, String stmt, String listenerName) {
EPStatement oldStmt = epService.getEPAdministrator().getStatement(stmtName);
if (oldStmt != null) {
if (stmt.equalsIgnoreCase(oldStmt.getText())) {
return;
} else {
oldStmt.destroy();
}
}
EPStatement statement = epService.getEPAdministrator().createEPL(stmt, stmtName);
if (listenerName != null) {
statement.addListener(listeners.get(listenerName));
}
logger.debug("Loaded to Esper EPL: " + stmt);
}
示例2: removeEventType
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
/**
* deletes Eventype from Esper
*
* @param eventType
* @throws Exception
*/
public void removeEventType(final EapEventType eventType) {
// System.out.println(esperConfiguration.getEventTypeNameUsedBy(eventType.getTypeName()));
final Set<String> names = new HashSet<String>(this.esperConfiguration.getEventTypeNameUsedBy(eventType.getTypeName()));
for (final String statementName : names) {
final EPStatement statement = this.getStatement(statementName);
if (statement != null) {
statement.removeAllListeners();
statement.destroy();
}
final Object ruleOrQuery = this.statementNames.get(statementName);
if (ruleOrQuery != null) {
if (ruleOrQuery instanceof QueryWrapper) {
final QueryWrapper liveQuery = (QueryWrapper) ruleOrQuery;
liveQuery.remove();
} else if (ruleOrQuery instanceof TransformationRule) {
final TransformationRule rule = (TransformationRule) ruleOrQuery;
Broker.getInstance().remove(rule);
} else {
System.err.println("WARNING - Parent of statement '" + statementName + "' is neither transformation rule nor live query.");
}
this.statementNames.remove(statementName);
}
}
this.esperConfiguration.removeEventType(eventType.getTypeName(), true);
}
示例3: runAssertionTakeWhileScalar
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionTakeWhileScalar(EPServiceProvider epService) {
String[] fields = "val0,val1,val2,val3".split(",");
String epl = "select " +
"strvals.takeWhile(x => x != 'E1') as val0," +
"strvals.takeWhile( (x, i) => x != 'E1' and i<2) as val1," +
"strvals.takeWhileLast(x => x != 'E1') as val2," +
"strvals.takeWhileLast( (x, i) => x != 'E1' and i<2) as val3" +
" from SupportCollection";
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
LambdaAssertionUtil.assertTypes(stmt.getEventType(), fields, new Class[]{Collection.class, Collection.class, Collection.class, Collection.class});
epService.getEPRuntime().sendEvent(SupportCollection.makeString("E1,E2,E3,E4"));
LambdaAssertionUtil.assertValuesArrayScalar(listener, "val0");
LambdaAssertionUtil.assertValuesArrayScalar(listener, "val1");
LambdaAssertionUtil.assertValuesArrayScalar(listener, "val2", "E2", "E3", "E4");
LambdaAssertionUtil.assertValuesArrayScalar(listener, "val3", "E3", "E4");
listener.reset();
stmt.destroy();
}
示例4: tryTimeWindow
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void tryTimeWindow(EPServiceProvider epService, String intervalSpec) {
// Set up a time window with a unique view attached
EPStatement stmt = epService.getEPAdministrator().createEPL(
"select irstream * from " + SupportBean.class.getName() +
"#time(" + intervalSpec + ")");
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
sendTimer(epService, 0);
sendEvent(epService);
listener.reset();
sendTimerAssertNotInvoked(epService, listener, 29999 * 1000);
sendTimerAssertInvoked(epService, listener, 30000 * 1000);
stmt.destroy();
}
示例5: runAssertionHavingJoin
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionHavingJoin(EPServiceProvider epService) {
String statementString = "select irstream symbol, sum(price) as mysum from " +
SupportMarketDataBean.class.getName() + "#length(20) as one, " +
SupportBeanString.class.getName() + "#length(100) as two " +
"where one.symbol = two.theString " +
"group by symbol " +
"having sum(price) > 0 " +
"output every 6 events " +
"order by sum(price), symbol";
EPStatement statement = epService.getEPAdministrator().createEPL(statementString);
epService.getEPRuntime().sendEvent(new SupportBeanString("CAT"));
epService.getEPRuntime().sendEvent(new SupportBeanString("IBM"));
epService.getEPRuntime().sendEvent(new SupportBeanString("CMU"));
epService.getEPRuntime().sendEvent(new SupportBeanString("KGB"));
epService.getEPRuntime().sendEvent(new SupportBeanString("DOG"));
tryAssertionHaving(epService, statement);
statement.destroy();
}
示例6: runAssertionAliasesAggregationCompile
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionAliasesAggregationCompile(EPServiceProvider epService) throws Exception {
String statementString = "select symbol, volume, sum(price) as mySum from " +
SupportMarketDataBean.class.getName() + "#length(20) " +
"group by symbol " +
"output every 6 events " +
"order by sum(price), symbol";
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(statementString);
model = (EPStatementObjectModel) SerializableObjectCopier.copy(model);
assertEquals(statementString, model.toEPL());
SupportUpdateListener testListener = new SupportUpdateListener();
EPStatement statement = epService.getEPAdministrator().create(model);
statement.addListener(testListener);
tryAssertionDefault(epService, testListener);
statement.destroy();
}
示例7: runAssertionEqualsAnyArray
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionEqualsAnyArray(EPServiceProvider epService) {
String[] fields = "e,ne".split(",");
String stmtText = "select " +
"longBoxed = any ({1, 1}, intArr, longCol) as e, " +
"longBoxed != any ({1, 1}, intArr, longCol) as ne " +
"from ArrayBean";
EPStatement stmt = epService.getEPAdministrator().createEPL(stmtText);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
SupportBeanArrayCollMap arrayBean = new SupportBeanArrayCollMap(new int[]{1, 1});
arrayBean.setLongCol(Arrays.asList(1L, 1L));
arrayBean.setLongBoxed(1L);
epService.getEPRuntime().sendEvent(arrayBean);
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{true, false});
arrayBean.setIntArr(new int[]{1, 1, 0});
epService.getEPRuntime().sendEvent(arrayBean);
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{true, true});
arrayBean.setLongBoxed(2L);
epService.getEPRuntime().sendEvent(arrayBean);
EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{false, true});
stmt.destroy();
}
示例8: tryAssertionFive
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void tryAssertionFive(EPServiceProvider epService, String expression) {
EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
String[] fields = "valh0,valh1,valh2".split(",");
sendBeanInt(epService, "S00", 1, 1, 1);
EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][]{{"H01", "H11", "H21"}});
sendBeanInt(epService, "S01", 0, 1, 1);
EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
sendBeanInt(epService, "S02", 1, 1, 0);
EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
sendBeanInt(epService, "S03", 1, 1, 2);
EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][]{{"H01", "H11", "H21"}, {"H01", "H11", "H22"}});
sendBeanInt(epService, "S04", 2, 2, 1);
Object[][] result = new Object[][]{{"H01", "H11", "H21"}, {"H02", "H11", "H21"}, {"H01", "H12", "H21"}, {"H02", "H12", "H21"}};
EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, result);
stmt.destroy();
}
示例9: runAssertionNoProps
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionNoProps(EPServiceProvider epService) {
String stmtText =
"insert into MyStream " +
"select es0, es1 " +
"from " +
"pattern [every (es0=" + SupportBean_S0.class.getName() +
" or es1=" + SupportBean_S1.class.getName() + ")]";
epService.getEPAdministrator().createEPL(stmtText);
String stmtTwoText =
"select es0.id as es0id, es1.id as es1id from MyStream#length(10)";
EPStatement statement = epService.getEPAdministrator().createEPL(stmtTwoText);
SupportUpdateListener updateListener = new SupportUpdateListener();
statement.addListener(updateListener);
sendEventsAndAssert(epService, updateListener);
statement.destroy();
}
示例10: runAssertionMinMaxJoin
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionMinMaxJoin(EPServiceProvider epService) {
String epl = "select irstream symbol, " +
"min(volume) as minVol," +
"max(volume) as maxVol," +
"min(distinct volume) as minDistVol," +
"max(distinct volume) as maxDistVol" +
" from " + SupportBeanString.class.getName() + "#length(100) as one, " +
SupportMarketDataBean.class.getName() + "#length(3) as two " +
"where (symbol='DELL' or symbol='IBM' or symbol='GE') " +
" and one.theString = two.symbol " +
"group by symbol";
EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
epService.getEPRuntime().sendEvent(new SupportBeanString(SYMBOL_DELL));
epService.getEPRuntime().sendEvent(new SupportBeanString(SYMBOL_IBM));
tryAssertionMinMax(epService, listener, stmt);
stmt.destroy();
}
示例11: removeStmtFromEngine
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void removeStmtFromEngine(long manifestId, String source, String eplName) {
EPStatement oldStmt = epService.getEPAdministrator().getStatement(eplName);
if (oldStmt != null) {
oldStmt.stop();
oldStmt.removeAllListeners();
oldStmt.destroy();
}
}
示例12: delete
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
@RequestMapping(value = "/statements/{name}", method = RequestMethod.DELETE)
public ResponseEntity<Void> delete(@PathVariable String name) {
EPStatement stmt = epService.getEPAdministrator().getStatement(name);
if (stmt == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
stmt.destroy();
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
示例13: remove
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
/**
* removes query from Esper
*
* @param query
* @return
*/
public void remove(final QueryWrapper query) {
final EPStatement statement = this.getStatement(query.getStatementName());
if (statement != null) {
statement.removeAllListeners();
statement.destroy();
}
this.statementNames.remove(query.getStatementName());
}
示例14: removeTransformationRule
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
/**
* Finds {@link EPStatement} for {@link TransformationRule}, removes the
* listener and destroys the statement. The statement is also removed from
* the map of statments.
*
* @param transformationRule
*/
public void removeTransformationRule(final TransformationRule transformationRule) {
final EPStatement statement = this.getStatement(TransformationRuleLogic.generateStatementName(transformationRule));
if (statement != null) {
statement.removeAllListeners();
statement.destroy();
}
this.statementNames.remove(statement);
}
示例15: runAssertionCaseSyntax2
import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionCaseSyntax2(EPServiceProvider epService) {
String caseExpr = "select case intPrimitive " +
" when longPrimitive then (intPrimitive + longPrimitive) " +
" when doublePrimitive then intPrimitive * doublePrimitive" +
" when floatPrimitive then floatPrimitive / doublePrimitive " +
" else (intPrimitive + longPrimitive + floatPrimitive + doublePrimitive) end as p1 " +
" from " + SupportBean.class.getName() + "#length(10)";
EPStatement stmt = epService.getEPAdministrator().createEPL(caseExpr);
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
assertEquals(Double.class, stmt.getEventType().getPropertyType("p1"));
// intPrimitive = longPrimitive
// case result is intPrimitive + longPrimitive
sendSupportBeanEvent(epService, 2, 2L, 1.0f, 1.0);
EventBean theEvent = listener.assertOneGetNewAndReset();
assertEquals(4.0, theEvent.get("p1"));
// intPrimitive = doublePrimitive
// case result is intPrimitive * doublePrimitive
sendSupportBeanEvent(epService, 5, 1L, 1.0f, 5.0);
theEvent = listener.assertOneGetNewAndReset();
assertEquals(25.0, theEvent.get("p1"));
// intPrimitive = floatPrimitive
// case result is floatPrimitive / doublePrimitive
sendSupportBeanEvent(epService, 12, 1L, 12.0f, 4.0);
theEvent = listener.assertOneGetNewAndReset();
assertEquals(3.0, theEvent.get("p1"));
// all the properties of the event are different
// The else part is computed: 1+2+3+4 = 10
sendSupportBeanEvent(epService, 1, 2L, 3.0f, 4.0);
theEvent = listener.assertOneGetNewAndReset();
assertEquals(10.0, theEvent.get("p1"));
stmt.destroy();
}