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


Java Drop类代码示例

本文整理汇总了Java中com.espertech.esper.client.annotation.Drop的典型用法代码示例。如果您正苦于以下问题:Java Drop类的具体用法?Java Drop怎么用?Java Drop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Drop类属于com.espertech.esper.client.annotation包,在下文中一共展示了Drop类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: analyzeAnnotations

import com.espertech.esper.client.annotation.Drop; //导入依赖的package包/类
/**
 * Analyze the annotations and return priority and drop settings.
 * @param annotations to analyze
 * @return analysis result
 */
public static AnnotationAnalysisResult analyzeAnnotations(Annotation[] annotations)
{
    boolean preemptive = false;
    int priority = 0;
    boolean hasPrioritySetting = false;
    for (Annotation annotation : annotations)
    {
        if (annotation instanceof Priority)
        {
            priority = ((Priority) annotation).value();
            hasPrioritySetting = true;
        }
        if (annotation instanceof Drop)
        {
            preemptive = true;
        }
    }
    if (!hasPrioritySetting && preemptive)
    {
        priority = 1;
    }
    return new AnnotationAnalysisResult(priority, preemptive);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:29,代码来源:StatementContextFactoryDefault.java

示例2: testSchedulingPriority

import com.espertech.esper.client.annotation.Drop; //导入依赖的package包/类
@Priority(10)
@Drop
public void testSchedulingPriority()
{
    sendTimer(0,epService);
    EPStatement stmt = epService.getEPAdministrator().createEPL("@Priority(1) select 1 as prio from pattern [every timer:interval(10)]", "s1");
    stmt.addListener(listener);

    stmt = epService.getEPAdministrator().createEPL("@Priority(3) select 3 as prio from pattern [every timer:interval(10)]", "s3");
    stmt.addListener(listener);

    stmt = epService.getEPAdministrator().createEPL("@Priority(2) select 2 as prio from pattern [every timer:interval(10)]", "s2");
    stmt.addListener(listener);

    stmt = epService.getEPAdministrator().createEPL("@Priority(4) select 4 as prio from pattern [every timer:interval(10)]", "s4");
    stmt.addListener(listener);

    sendTimer(10000, epService);
    assertPrio(null, new int[] {4, 3, 2, 1});

    epService.getEPAdministrator().getStatement("s2").destroy();
    stmt = epService.getEPAdministrator().createEPL("select 0 as prio from pattern [every timer:interval(10)]", "s0");
    stmt.addListener(listener);

    sendTimer(20000, epService);
    assertPrio(null, new int[] {4, 3, 1, 0});

    stmt = epService.getEPAdministrator().createEPL("@Priority(2) select 2 as prio from pattern [every timer:interval(10)]", "s2");
    stmt.addListener(listener);

    sendTimer(30000, epService);
    assertPrio(null, new int[] {4, 3, 2, 1, 0});

    stmt = epService.getEPAdministrator().createEPL("@Priority(3) select 3 as prio from pattern [every timer:interval(10)]", "s2");
    stmt.addListener(listener);

    sendTimer(40000, epService);
    assertPrio(null, new int[] {4, 3, 3, 2, 1, 0});
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:40,代码来源:TestPriorityAndDropInstructions.java

示例3: runAssertionSchedulingPriority

import com.espertech.esper.client.annotation.Drop; //导入依赖的package包/类
@Priority(10)
@Drop
private void runAssertionSchedulingPriority(EPServiceProvider epService) {
    sendTimer(0, epService);
    EPStatement stmt = epService.getEPAdministrator().createEPL("@Priority(1) select 1 as prio from pattern [every timer:interval(10)]", "s1");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    stmt = epService.getEPAdministrator().createEPL("@Priority(3) select 3 as prio from pattern [every timer:interval(10)]", "s3");
    stmt.addListener(listener);

    stmt = epService.getEPAdministrator().createEPL("@Priority(2) select 2 as prio from pattern [every timer:interval(10)]", "s2");
    stmt.addListener(listener);

    stmt = epService.getEPAdministrator().createEPL("@Priority(4) select 4 as prio from pattern [every timer:interval(10)]", "s4");
    stmt.addListener(listener);

    sendTimer(10000, epService);
    assertPrio(listener, null, new int[]{4, 3, 2, 1});

    epService.getEPAdministrator().getStatement("s2").destroy();
    stmt = epService.getEPAdministrator().createEPL("select 0 as prio from pattern [every timer:interval(10)]", "s0");
    stmt.addListener(listener);

    sendTimer(20000, epService);
    assertPrio(listener, null, new int[]{4, 3, 1, 0});

    stmt = epService.getEPAdministrator().createEPL("@Priority(2) select 2 as prio from pattern [every timer:interval(10)]", "s2");
    stmt.addListener(listener);

    sendTimer(30000, epService);
    assertPrio(listener, null, new int[]{4, 3, 2, 1, 0});

    stmt = epService.getEPAdministrator().createEPL("@Priority(3) select 3 as prio from pattern [every timer:interval(10)]", "s2");
    stmt.addListener(listener);

    sendTimer(40000, epService);
    assertPrio(listener, null, new int[]{4, 3, 3, 2, 1, 0});

    epService.getEPAdministrator().destroyAllStatements();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:42,代码来源:ExecClientPriorityAndDropInstructions.java

示例4: initialize

import com.espertech.esper.client.annotation.Drop; //导入依赖的package包/类
private NullableObject<InternalEventRouterPreprocessor> initialize(EventType eventType) {
    EventTypeSPI eventTypeSPI = (EventTypeSPI) eventType;
    List<InternalEventRouterEntry> desc = new ArrayList<InternalEventRouterEntry>();

    // determine which ones to process for this types, and what priority and drop
    Set<String> eventPropertiesWritten = new HashSet<String>();
    for (Map.Entry<UpdateDesc, IRDescEntry> entry : descriptors.entrySet()) {
        boolean applicable = entry.getValue().getEventType() == eventType;
        if (!applicable) {
            if (eventType.getDeepSuperTypes() != null) {
                for (Iterator<EventType> it = eventType.getDeepSuperTypes(); it.hasNext(); ) {
                    if (it.next() == entry.getValue().getEventType()) {
                        applicable = true;
                        break;
                    }
                }
            }
        }

        if (!applicable) {
            continue;
        }

        int priority = 0;
        boolean isDrop = false;
        Annotation[] annotations = entry.getValue().getAnnotations();
        for (int i = 0; i < annotations.length; i++) {
            if (annotations[i] instanceof Priority) {
                priority = ((Priority) annotations[i]).value();
            }
            if (annotations[i] instanceof Drop) {
                isDrop = true;
            }
        }

        List<String> properties = new ArrayList<String>();
        ExprNode[] expressions = new ExprNode[entry.getKey().getAssignments().size()];
        for (int i = 0; i < entry.getKey().getAssignments().size(); i++) {
            OnTriggerSetAssignment assignment = entry.getKey().getAssignments().get(i);
            Pair<String, ExprNode> assignmentPair = ExprNodeUtilityRich.checkGetAssignmentToProp(assignment.getExpression());
            expressions[i] = assignmentPair.getSecond();
            properties.add(assignmentPair.getFirst());
            eventPropertiesWritten.add(assignmentPair.getFirst());
        }
        EventBeanWriter writer = eventTypeSPI.getWriter(properties.toArray(new String[properties.size()]));
        desc.add(new InternalEventRouterEntry(priority, isDrop, entry.getValue().getOptionalWhereClauseEvaluator(), expressions, writer, entry.getValue().getWideners(), entry.getValue().getOutputView(), entry.getValue().getAgentInstanceLock(), entry.getValue().hasSubselect));
    }

    EventBeanCopyMethod copyMethod = eventTypeSPI.getCopyMethod(eventPropertiesWritten.toArray(new String[eventPropertiesWritten.size()]));
    if (copyMethod == null) {
        return new NullableObject<>(null);
    }
    return new NullableObject<>(new InternalEventRouterPreprocessor(copyMethod, desc));
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:55,代码来源:InternalEventRouterImpl.java

示例5: initialize

import com.espertech.esper.client.annotation.Drop; //导入依赖的package包/类
private NullableObject<InternalEventRouterPreprocessor> initialize(EventType eventType)
{
    EventTypeSPI eventTypeSPI = (EventTypeSPI) eventType;
    List<InternalEventRouterEntry> desc = new ArrayList<InternalEventRouterEntry>();

    // determine which ones to process for this types, and what priority and drop
    Set<String> eventPropertiesWritten = new HashSet<String>();
    for (Map.Entry<UpdateDesc, IRDescEntry> entry : descriptors.entrySet())
    {
        boolean applicable = entry.getValue().getEventType() == eventType;
        if (!applicable)
        {
            if (eventType.getDeepSuperTypes() != null)
            {
                for (Iterator<EventType> it = eventType.getDeepSuperTypes(); it.hasNext();)
                {
                    if (it.next() == entry.getValue().getEventType())
                    {
                        applicable = true;
                        break;
                    }
                }
            }
        }

        if (!applicable)
        {
            continue;
        }

        int priority = 0;
        boolean isDrop = false;
        Annotation[] annotations = entry.getValue().getAnnotations();
        for (int i = 0; i < annotations.length; i++)
        {
            if (annotations[i] instanceof Priority)
            {
                priority = ((Priority) annotations[i]).value();
            }
            if (annotations[i] instanceof Drop)
            {
                isDrop = true;
            }
        }

        List<String> properties = new ArrayList<String>();
        ExprNode[] expressions = new ExprNode[entry.getKey().getAssignments().size()];
        for (int i = 0; i < entry.getKey().getAssignments().size(); i++)
        {
            OnTriggerSetAssignment assignment = entry.getKey().getAssignments().get(i);
            expressions[i] = assignment.getExpression();
            properties.add(assignment.getVariableName());
            eventPropertiesWritten.add(assignment.getVariableName());
        }
        EventBeanWriter writer = eventTypeSPI.getWriter(properties.toArray(new String[properties.size()]));
        desc.add(new InternalEventRouterEntry(priority, isDrop, entry.getKey().getOptionalWhereClause(), expressions, writer, entry.getValue().getWideners(), entry.getValue().getOutputView(), entry.getValue().getAgentInstanceLock(), entry.getValue().hasSubselect));
    }

    EventBeanCopyMethod copyMethod = eventTypeSPI.getCopyMethod(eventPropertiesWritten.toArray(new String[eventPropertiesWritten.size()]));
    if (copyMethod == null)
    {
        return new NullableObject<InternalEventRouterPreprocessor>(null);
    }
    return new NullableObject<InternalEventRouterPreprocessor>(new InternalEventRouterPreprocessor(copyMethod, desc));
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:66,代码来源:InternalEventRouterImpl.java


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