當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。