当前位置: 首页>>代码示例>>Java>>正文


Java EPStatement.stop方法代码示例

本文整理汇总了Java中com.espertech.esper.client.EPStatement.stop方法的典型用法代码示例。如果您正苦于以下问题:Java EPStatement.stop方法的具体用法?Java EPStatement.stop怎么用?Java EPStatement.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.espertech.esper.client.EPStatement的用法示例。


在下文中一共展示了EPStatement.stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
    isCalled = true;

    // create statement for thread - this can be called multiple times as other threads send SupportBean
    EPStatement stmt = engine.getEPAdministrator().createEPL(
            "select * from " + SupportMarketDataBean.class.getName() + " where volume=" + numThread);
    SupportMTUpdateListener listener = new SupportMTUpdateListener();
    stmt.addListener(listener);

    Object theEvent = new SupportMarketDataBean("", 0, (long) numThread, null);
    engine.getEPRuntime().sendEvent(theEvent);
    stmt.stop();

    EventBean[] eventsReceived = listener.getNewDataListFlattened();

    boolean found = false;
    for (int i = 0; i < eventsReceived.length; i++) {
        if (eventsReceived[i].getUnderlying() == theEvent) {
            found = true;
        }
    }
    Assert.assertTrue(found);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:24,代码来源:StmtListenerRouteCallable.java

示例2: runAssertionStartStopTwo

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionStartStopTwo(EPServiceProvider epService) {
    String stmtText = "select * from pattern [every(a=" + SupportBean.class.getName() +
            " or b=" + SupportBeanComplexProps.class.getName() + ")]";
    EPStatement statement = epService.getEPAdministrator().createEPL(stmtText);
    SupportUpdateListener updateListener = new SupportUpdateListener();
    statement.addListener(updateListener);

    for (int i = 0; i < 100; i++) {
        sendAndAssert(epService, updateListener);

        statement.stop();

        epService.getEPRuntime().sendEvent(new SupportBean());
        epService.getEPRuntime().sendEvent(SupportBeanComplexProps.makeDefaultBean());
        assertFalse(updateListener.isInvoked());

        statement.start();
    }

    statement.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:ExecPatternStartStop.java

示例3: runAssertionUnmatchedInsertInto

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionUnmatchedInsertInto(EPServiceProvider epService) {
    MyUnmatchedListener listener = new MyUnmatchedListener();
    epService.getEPRuntime().setUnmatchedListener(listener);

    // create insert into
    EPStatement insertInto = epService.getEPAdministrator().createEPL("insert into MyEvent select theString from SupportBean");

    // no statement, should be unmatched
    sendEvent(epService, "E1");
    assertEquals(1, listener.getReceived().size());
    assertEquals("E1", listener.getReceived().get(0).get("theString"));
    listener.reset();

    // stop insert into, now SupportBean itself is unmatched
    insertInto.stop();
    SupportBean theEvent = sendEvent(epService, "E2");
    assertEquals(1, listener.getReceived().size());
    assertSame(theEvent, listener.getReceived().get(0).getUnderlying());
    listener.reset();

    // start insert-into
    sendEvent(epService, "E3");
    assertEquals(1, listener.getReceived().size());
    assertEquals("E3", listener.getReceived().get(0).get("theString"));
    listener.reset();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:27,代码来源:ExecClientUnmatchedListener.java

示例4: tryPattern

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void tryPattern(EPServiceProvider epService, String text,
                        Integer[] intBoxedA,
                        Double[] doubleBoxedA,
                        Integer[] intBoxedB,
                        Double[] doubleBoxedB,
                        boolean[] expected) {
    assertEquals(intBoxedA.length, doubleBoxedA.length);
    assertEquals(intBoxedB.length, doubleBoxedB.length);
    assertEquals(expected.length, doubleBoxedA.length);
    assertEquals(intBoxedA.length, doubleBoxedB.length);

    for (int i = 0; i < intBoxedA.length; i++) {
        EPStatement stmt = epService.getEPAdministrator().createEPL(text);
        SupportUpdateListener listener = new SupportUpdateListener();
        stmt.addListener(listener);

        sendBeanIntDouble(epService, intBoxedA[i], doubleBoxedA[i]);
        sendBeanIntDouble(epService, intBoxedB[i], doubleBoxedB[i]);
        assertEquals("failed at index " + i, expected[i], listener.getAndClearIsInvoked());
        stmt.stop();
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:ExecFilterExpressions.java

示例5: 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();
    }
}
 
开发者ID:oneops,项目名称:oneops,代码行数:9,代码来源:Sensor.java

示例6: runAssertionUngroupedUncorrelatedTwoAggStopStart

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionUngroupedUncorrelatedTwoAggStopStart(EPServiceProvider epService) {
    String stmtText = "select (select avg(id) + max(id) from S1#length(3)) as value from S0";
    EPStatement stmt = epService.getEPAdministrator().createEPL(stmtText);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    sendEventS0(epService, 1);
    assertEquals(null, listener.assertOneGetNewAndReset().get("value"));

    sendEventS1(epService, 100);
    sendEventS0(epService, 2);
    assertEquals(200.0, listener.assertOneGetNewAndReset().get("value"));

    sendEventS1(epService, 200);
    sendEventS0(epService, 3);
    assertEquals(350.0, listener.assertOneGetNewAndReset().get("value"));

    stmt.stop();
    sendEventS1(epService, 10000);
    sendEventS0(epService, 4);
    assertFalse(listener.isInvoked());
    stmt.start();

    sendEventS1(epService, 10);
    sendEventS0(epService, 5);
    assertEquals(20.0, listener.assertOneGetNewAndReset().get("value"));

    stmt.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:30,代码来源:ExecSubselectAggregatedSingleValue.java

示例7: update

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
    log.warn(".update");

    if (count < 10) {
        count++;
        String patternExpr = "not " + SupportBean.class.getName();
        EPStatement patternStmt = epService.getEPAdministrator().createPattern(patternExpr);
        patternStmt.addListener(this);
        patternStmt.stop();
        patternStmt.start();
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:13,代码来源:ExecPatternStartLoop.java

示例8: tryExpr

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void tryExpr(EPServiceProvider epService, String filterExpr, String fieldName, Object[] values, boolean[] isInvoked) {
    String expr = "select * from " + SupportBean.class.getName() + filterExpr;
    EPStatement stmt = epService.getEPAdministrator().createEPL(expr);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    for (int i = 0; i < values.length; i++) {
        sendBean(epService, fieldName, values[i]);
        assertEquals("Listener invocation unexpected for " + filterExpr + " field " + fieldName + "=" + values[i], isInvoked[i], listener.isInvoked());
        listener.reset();
    }

    stmt.stop();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:15,代码来源:ExecFilterInAndBetween.java

示例9: runAssertionNotTimeInterval

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionNotTimeInterval(EPServiceProvider epService) {
    epService.getEPAdministrator().getConfiguration().addEventType("BBB", SupportBean.class);
    epService.getEPAdministrator().getConfiguration().addEventType("AAA", SupportMarketDataBean.class);

    String text = "select A.theString as theString from pattern " +
            "[every A=BBB(intPrimitive=123) -> (timer:interval(30 seconds) and not AAA(volume=123, symbol=A.theString))]";
    EPStatement statement = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    statement.addListener(listener);

    sendTimer(0, epService);
    epService.getEPRuntime().sendEvent(new SupportBean("E1", 123));

    sendTimer(10000, epService);
    epService.getEPRuntime().sendEvent(new SupportBean("E2", 123));

    sendTimer(20000, epService);
    epService.getEPRuntime().sendEvent(new SupportMarketDataBean("E1", 0, 123L, ""));

    sendTimer(30000, epService);
    epService.getEPRuntime().sendEvent(new SupportBean("E3", 123));
    assertFalse(listener.isInvoked());

    sendTimer(40000, epService);
    String[] fields = new String[]{"theString"};
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[]{"E2"});

    statement.stop();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:30,代码来源:ExecPatternOperatorNot.java

示例10: runAssertionTwoStatementsAndStopDestroy

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionTwoStatementsAndStopDestroy(EPServiceProvider epService, SupportConditionHandlerFactory.SupportConditionHandler handler) {
    String expressionOne = "@Name('S1') select * from pattern [every a=SupportBean(theString like 'A%') -> b=SupportBean_A(id=a.theString)]";
    EPStatement stmtOne = epService.getEPAdministrator().createEPL(expressionOne);

    String expressionTwo = "@Name('S2') select * from pattern [every a=SupportBean(theString like 'B%') -> b=SupportBean_B(id=a.theString)]";
    EPStatement stmtTwo = epService.getEPAdministrator().createEPL(expressionTwo);

    epService.getEPRuntime().sendEvent(new SupportBean("A1", 0));
    epService.getEPRuntime().sendEvent(new SupportBean("A2", 0));
    epService.getEPRuntime().sendEvent(new SupportBean("A3", 0));
    epService.getEPRuntime().sendEvent(new SupportBean("B1", 0));
    assertTrue(handler.getContexts().isEmpty());

    epService.getEPRuntime().sendEvent(new SupportBean("B2", 0));
    assertContextEnginePool(epService, stmtTwo, handler.getAndResetContexts(), 4, getExpectedCountMap("S1", 3, "S2", 1));

    epService.getEPRuntime().sendEvent(new SupportBean("A4", 0));
    assertContextEnginePool(epService, stmtOne, handler.getAndResetContexts(), 4, getExpectedCountMap("S1", 3, "S2", 1));

    stmtOne.stop();

    epService.getEPRuntime().sendEvent(new SupportBean("B3", 0));
    epService.getEPRuntime().sendEvent(new SupportBean("B4", 0));
    epService.getEPRuntime().sendEvent(new SupportBean("B5", 0));
    assertTrue(handler.getContexts().isEmpty());

    epService.getEPRuntime().sendEvent(new SupportBean("B6", 0));
    assertContextEnginePool(epService, stmtTwo, handler.getAndResetContexts(), 4, getExpectedCountMap("S1", 0, "S2", 4));

    stmtOne.destroy();

    epService.getEPRuntime().sendEvent(new SupportBean("B7", 0));
    assertContextEnginePool(epService, stmtTwo, handler.getAndResetContexts(), 4, getExpectedCountMap("S2", 4));
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:35,代码来源:ExecPatternOperatorFollowedByMax4Prevent.java

示例11: run

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
public void run(EPServiceProvider epService) throws Exception {

        epService.getEPAdministrator().createEPL("create objectarray schema MyEvent(SubscriberName string, ValueInt float)");
        final String query = "select SubscriberName, avg(ValueInt) "
                + "from MyEvent#groupwin(SubscriberName)#length(4)"
                + "group by SubscriberName output snapshot every 1 events";
        final String query2 = "select SubscriberName, avedev(ValueInt) "
                + "from MyEvent#groupwin(SubscriberName)#length(3) "
                + "group by SubscriberName output snapshot every 1 events";

        final String[] groups = {
            "G_A", "G_A", "G_A", "G_A", "G_B", "G_B", "G_B", "G_B",
            "G_B", "G_B", "G_B", "G_B", "G_B", "G_B", "G_B", "G_B",
            "G_B", "G_B", "G_B", "G_B", "G_C", "G_C", "G_C", "G_C",
            "G_D", "G_A", "G_D", "G_D", "G_A", "G_D", "G_D", "G_D",
            "G_A", "G_A", "G_A", "G_A", "G_C", "G_C", "G_C", "G_C",
            "G_D", "G_A", "G_D", "G_D", "G_D", "G_A", "G_D", "G_D",
            "G_D", "G_E"};

        EPStatement statement = epService.getEPAdministrator().createEPL(query, "myquery");
        EPStatement statement2 = epService.getEPAdministrator().createEPL(query2, "myquery2");
        SupportUpdateListener listener = new SupportUpdateListener();
        statement.addListener(listener);
        statement2.addListener(listener);

        int i = 0;
        for (String csv : groups) {
            Object[] event = {csv, 0f};
            epService.getEPRuntime().sendEvent(event, "MyEvent");
            i++;

            EPStatement stmt = epService.getEPAdministrator().getStatement("myquery");
            if (i % 6 == 0) {
                stmt.stop();
            } else if (i % 6 == 4) {
                stmt.start();
            }
        }
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:40,代码来源:ExecViewGroupWinSharedViewStartStop.java

示例12: tryPattern3Stream

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void tryPattern3Stream(EPServiceProvider epService, String text,
                               Integer[] intBoxedA,
                               Double[] doubleBoxedA,
                               Integer[] intBoxedB,
                               Double[] doubleBoxedB,
                               Integer[] intBoxedC,
                               Double[] doubleBoxedC,
                               boolean[] expected) {
    assertEquals(intBoxedA.length, doubleBoxedA.length);
    assertEquals(intBoxedB.length, doubleBoxedB.length);
    assertEquals(expected.length, doubleBoxedA.length);
    assertEquals(intBoxedA.length, doubleBoxedB.length);
    assertEquals(intBoxedC.length, doubleBoxedC.length);
    assertEquals(intBoxedB.length, doubleBoxedC.length);

    for (int i = 0; i < intBoxedA.length; i++) {
        EPStatement stmt = epService.getEPAdministrator().createEPL(text);
        SupportUpdateListener listener = new SupportUpdateListener();
        stmt.addListener(listener);

        sendBeanIntDouble(epService, intBoxedA[i], doubleBoxedA[i]);
        sendBeanIntDouble(epService, intBoxedB[i], doubleBoxedB[i]);
        sendBeanIntDouble(epService, intBoxedC[i], doubleBoxedC[i]);
        assertEquals("failed at index " + i, expected[i], listener.getAndClearIsInvoked());
        stmt.stop();
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:28,代码来源:ExecFilterExpressions.java

示例13: runAssertionStartStopStatement

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionStartStopStatement(EPServiceProvider epService) {
    String stmtText = "select id from S0 where (select true from S1#length(1000))";

    EPStatement stmt = epService.getEPAdministrator().createEPL(stmtText);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    epService.getEPRuntime().sendEvent(new SupportBean_S0(2));
    assertFalse(listener.isInvoked());

    epService.getEPRuntime().sendEvent(new SupportBean_S1(10));
    epService.getEPRuntime().sendEvent(new SupportBean_S0(2));
    assertEquals(2, listener.assertOneGetNewAndReset().get("id"));

    stmt.stop();
    epService.getEPRuntime().sendEvent(new SupportBean_S0(2));
    assertFalse(listener.isInvoked());

    stmt.start();
    epService.getEPRuntime().sendEvent(new SupportBean_S0(2));
    assertFalse(listener.isInvoked());

    epService.getEPRuntime().sendEvent(new SupportBean_S1(10));
    epService.getEPRuntime().sendEvent(new SupportBean_S0(3));
    assertEquals(3, listener.assertOneGetNewAndReset().get("id"));

    stmt.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:29,代码来源:ExecSubselectUnfiltered.java

示例14: deactivateTransformationRule

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
public void deactivateTransformationRule(final TransformationRule transformationRule) {
	final EPStatement statement = StreamProcessingAdapter.getInstance().getStatement(TransformationRuleLogic.generateStatementName(transformationRule));
	statement.stop();
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:5,代码来源:Broker.java

示例15: runAssertionCreateStartStop

import com.espertech.esper.client.EPStatement; //导入方法依赖的package包/类
private void runAssertionCreateStartStop(EPServiceProvider epService) throws Exception {
    String epl = "@Name('Create-A-Flow') create dataflow MyGraph Emitter -> outstream<?> {}";
    EPStatement stmt = epService.getEPAdministrator().createEPL(epl);

    EPDataFlowRuntime dfruntime = epService.getEPRuntime().getDataFlowRuntime();
    EPAssertionUtil.assertEqualsAnyOrder(new String[]{"MyGraph"}, dfruntime.getDataFlows());
    EPDataFlowDescriptor desc = dfruntime.getDataFlow("MyGraph");
    assertEquals("MyGraph", desc.getDataFlowName());
    assertEquals(EPStatementState.STARTED, desc.getStatementState());
    assertEquals("Create-A-Flow", desc.getStatementName());

    dfruntime.instantiate("MyGraph");

    // test duplicate
    tryInvalidCompile(epService, epl, "Error starting statement: Data flow by name 'MyGraph' has already been declared [");

    // stop - can no longer instantiate but still exists
    stmt.stop();    // not removed
    assertEquals(EPStatementState.STOPPED, dfruntime.getDataFlow("MyGraph").getStatementState());
    tryInvalidCompile(epService, epl, "Error starting statement: Data flow by name 'MyGraph' has already been declared [");
    tryInstantiate(epService, "MyGraph", "Data flow by name 'MyGraph' is currently in STOPPED statement state");
    tryInstantiate(epService, "DUMMY", "Data flow by name 'DUMMY' has not been defined");

    // destroy - should be gone
    stmt.destroy(); // removed, create again
    assertEquals(null, dfruntime.getDataFlow("MyGraph"));
    assertEquals(0, dfruntime.getDataFlows().length);
    tryInstantiate(epService, "MyGraph", "Data flow by name 'MyGraph' has not been defined");
    try {
        stmt.start();
        fail();
    } catch (IllegalStateException ex) {
        assertEquals("Cannot start statement, statement is in destroyed state", ex.getMessage());
    }

    // new one, try start-stop-start
    stmt = epService.getEPAdministrator().createEPL(epl);
    stmt.stop();
    stmt.start();
    dfruntime.instantiate("MyGraph");
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:42,代码来源:ExecDataflowAPICreateStartStopDestroy.java


注:本文中的com.espertech.esper.client.EPStatement.stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。