當前位置: 首頁>>代碼示例>>Java>>正文


Java RemoveEvent類代碼示例

本文整理匯總了Java中org.wso2.siddhi.core.event.remove.RemoveEvent的典型用法代碼示例。如果您正苦於以下問題:Java RemoveEvent類的具體用法?Java RemoveEvent怎麽用?Java RemoveEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RemoveEvent類屬於org.wso2.siddhi.core.event.remove包,在下文中一共展示了RemoveEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
public void processEvent(InListEvent listEvent) {
    acquireLock();
    try {
        if (!async && siddhiContext.isDistributedProcessingEnabled()) {
            long expireTime = System.currentTimeMillis() + timeToKeep;
            for (int i = 0, activeEvents = listEvent.getActiveEvents(); i < activeEvents; i++) {
                window.put(new RemoveEvent(listEvent.getEvent(i), expireTime));
            }
        } else {
            window.put(new RemoveListEvent(EventConverter.toRemoveEventArray(listEvent.getEvents(), listEvent.getActiveEvents(), System.currentTimeMillis() + timeToKeep)));
        }
        nextProcessor.process(listEvent);
    } finally {
        releaseLock();
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:18,代碼來源:TimeWindowProcessor.java

示例2: init

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
protected void init(Expression[] parameters, QueryPostProcessingElement nextProcessor, AbstractDefinition streamDefinition, String elementId, boolean async, SiddhiContext siddhiContext) {
    if (parameters[0] instanceof IntConstant) {
        timeToKeep = ((IntConstant) parameters[0]).getValue();
    } else {
        timeToKeep = ((LongConstant) parameters[0]).getValue();
    }

    oldEventList = new ArrayList<RemoveEvent>();
    if (this.siddhiContext.isDistributedProcessingEnabled()) {
        newEventList = this.siddhiContext.getHazelcastInstance().getList(elementId + "-newEventList");
    } else {
        newEventList = new ArrayList<InEvent>();
    }

    if (this.siddhiContext.isDistributedProcessingEnabled()) {
        window = new SchedulerSiddhiQueueGrid<StreamEvent>(elementId, this, this.siddhiContext, this.async);
    } else {
        window = new SchedulerSiddhiQueue<StreamEvent>(this);
    }
    //Ordinary scheduling
    window.schedule();

}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:25,代碼來源:TimeBatchWindowProcessor.java

示例3: init

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
protected void init(Expression[] parameters, QueryPostProcessingElement nextProcessor, AbstractDefinition streamDefinition, String elementId, boolean async, SiddhiContext siddhiContext) {
    lengthToKeep = ((IntConstant) parameters[0]).getValue();

    if (this.siddhiContext.isDistributedProcessingEnabled()) {
        window = new SiddhiQueueGrid<StreamEvent>(elementId, this.siddhiContext, this.async);
    } else {
        window = new SiddhiQueue<StreamEvent>();
    }
    oldEventList = new ArrayList<RemoveEvent>();
    if (this.siddhiContext.isDistributedProcessingEnabled()) {
        newEventList = this.siddhiContext.getHazelcastInstance().getList(elementId + "-newEventList");
    } else {
        newEventList = new ArrayList<InEvent>();
    }

}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:18,代碼來源:LengthBatchWindowProcessor.java

示例4: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
public void processEvent(InListEvent listEvent) {
    acquireLock();
    try {
        long currentTime = (Long) listEvent.getEvent(listEvent.getActiveEvents() - 1).getData(timeStampAttributePosition);
        removeExpiredEvent(currentTime);
        long expireTime = currentTime + timeToKeep;
        if (!async && siddhiContext.isDistributedProcessingEnabled()) {
            for (int i = 0, activeEvents = listEvent.getActiveEvents(); i < activeEvents; i++) {
                window.put(new RemoveEvent(listEvent.getEvent(i), expireTime));
            }
        } else {
            window.put(new RemoveListEvent(EventConverter.toRemoveEventArray(listEvent.getEvents(), listEvent.getActiveEvents(), expireTime)));
        }
        nextProcessor.process(listEvent);
    } finally {
        releaseLock();
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:20,代碼來源:ExternalTimeWindowProcessor.java

示例5: add

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
public void add(StreamEvent item) {
    if (item instanceof AtomicEvent) {
        if (cacheList.size() >= limit) {
            cacheList.remove(0);
        }
        cacheList.add(new RemoveEvent((Event) item, Long.MAX_VALUE));
    } else {
        for (int i = 0, size = ((ListEvent) item).getActiveEvents(); i < size; i++) {
            if (cacheList.size() >= limit) {
                cacheList.remove(0);
            }
            cacheList.add(new RemoveEvent(((ListEvent) item).getEvent(i), Long.MAX_VALUE));
        }
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:17,代碼來源:BasicCacheManager.java

示例6: put

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
/**
 * Every event that expires before next polling time will be put into a single group.
 * If an event receives which expires after the next polling time, a new group will be
 * created and subsequent messages will be put into that group and update next polling
 * time. In this way separate groups will be created for messages which expires before
 * a particular polling time. And since this is a FIFO queue the group that has to be
 * pop-ed out in the next pol will always at the peek of the queue
 * @param streamEvent
 */
@Override
public synchronized void put(T streamEvent) {
   long expiryTime = ((RemoveEvent)streamEvent).getExpiryTime();

    if (!pairQueue.isEmpty() && nextPollTime >= expiryTime) {
        lastPair.getTwo().add(streamEvent);
    } else {
        LinkedBlockingQueue<T> eventsList = new LinkedBlockingQueue<T>();
        eventsList.add(streamEvent);
        Pair<Long, LinkedBlockingQueue<T>> eventPair = new Pair<Long, LinkedBlockingQueue<T>>(nextPollTime, eventsList);
        pairQueue.add(eventPair);
        lastPair = eventPair;

        updateNextPollTime(nextPollTime);
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:26,代碼來源:TimeStampSiddhiQueue.java

示例7: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
protected void processEvent(StreamEvent event) {
    acquireLock();
    try {
        RemoveEvent removeEvent = new RemoveEvent(event,System.currentTimeMillis());
        removeEvent.setOnAfterWindowData(((InnerStreamEvent)event).getOnAfterWindowData());
        window.add(removeEvent);
        if (window.size() > lengthToKeep) {
            next.process(window.remove(0));
        }
        next.process(event);
    } finally {
        releaseLock();
    }

}
 
開發者ID:sacjaya,項目名稱:siddhi-3,代碼行數:17,代碼來源:LengthWindowProcessor.java

示例8: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
protected void processEvent(InEvent event) {
    acquireLock();
    try {
        window.put(new RemoveEvent(event, Long.MAX_VALUE));
        if (window.size() > lengthToKeep) {
            nextProcessor.process((Event) window.poll());
        }
        nextProcessor.process(event);
    } finally {
        releaseLock();
    }

}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:15,代碼來源:LengthWindowProcessor.java

示例9: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
protected void processEvent(InEvent event) {
    acquireLock();
    try {
        sortedWindow.add(new RemoveEvent(event, Long.MAX_VALUE));
        if (sortedWindow.size() > lengthToKeep) {
            Collections.sort(sortedWindow, eventComparator);
            nextProcessor.process(new RemoveEvent(sortedWindow.remove(sortedWindow.size()-1), System.currentTimeMillis()));
        }
        nextProcessor.process(event);
    } finally {
        releaseLock();
    }

}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:16,代碼來源:SortWindowProcessor.java

示例10: restoreState

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
protected void restoreState(Object[] data) {
    window.restoreState((Object[]) data[0]);
    oldEventList = ((ArrayList<RemoveEvent>) data[1]);
    newEventList = ((ArrayList<InEvent>) data[2]);
    window.reSchedule();
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:8,代碼來源:TimeBatchWindowProcessor.java

示例11: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
protected void processEvent(InEvent event) {
    acquireLock();
    try {
        StreamEvent oldEvent = map.put(generateKey(event), new RemoveEvent(event, Long.MAX_VALUE));
        if (oldEvent != null) {
            nextProcessor.process((AtomicEvent) oldEvent);
        }
        nextProcessor.process(event);
    } finally {
        releaseLock();
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:14,代碼來源:UniqueWindowProcessor.java

示例12: processLengthBatchWindow

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
private void processLengthBatchWindow(InEvent event) {
    newEventList.add(event);
    if (log.isDebugEnabled()) {
        log.debug("newEventList size " + newEventList.size() + " with event " + event);
    }
    if (newEventList.size() == lengthToKeep) {

        //sending old events
        oldEventList.clear();
        while (true) {
            RemoveEvent oldEvent = (RemoveEvent) window.poll();
            if (oldEvent == null) {
                break;
            } else {
                oldEvent.setExpiryTime(System.currentTimeMillis());
                oldEventList.add(oldEvent);
            }
        }
        if (oldEventList.size() > 0) {
            nextProcessor.process(new RemoveListEvent(oldEventList.toArray(new RemoveEvent[oldEventList.size()])));
            oldEventList.clear();
        }

        InEvent[] inEvents = newEventList.toArray(new InEvent[newEventList.size()]);
        for (InEvent inEvent : inEvents) {
            window.put(new RemoveEvent(inEvent, -1));
        }
        nextProcessor.process(new InListEvent(inEvents));

        newEventList.clear();
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:33,代碼來源:LengthBatchWindowProcessor.java

示例13: processEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
protected void processEvent(InEvent event) {
    acquireLock();
    try {
        StreamEvent oldEvent = map.putIfAbsent(generateKey(event), new RemoveEvent(event, Long.MAX_VALUE));
        if (oldEvent == null) {
            nextProcessor.process(event);
        }
    } finally {
        releaseLock();
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:13,代碼來源:FirstUniqueWindowProcessor.java

示例14: removeExpiredEvent

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
private void removeExpiredEvent(long currentTime) {
    while (true) {
        RemoveEvent expiredEvent = (RemoveEvent) window.peek();
        if (expiredEvent != null && expiredEvent.getExpiryTime() < currentTime) {
            nextProcessor.process((AtomicEvent) window.poll());
        } else {
            break;
        }
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:11,代碼來源:ExternalTimeWindowProcessor.java

示例15: toString

import org.wso2.siddhi.core.event.remove.RemoveEvent; //導入依賴的package包/類
@Override
public String toString() {
    return "Event{" +
            "streamId='" + streamId + '\'' +
            ", timeStamp=" + timeStamp +
            ", data=" + (data == null ? null : Arrays.asList(data)) +
            ", type=" + ((this instanceof InStream) ? "new" : ((this instanceof RemoveEvent) ? "remove" : "other"))+
            '}';
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:10,代碼來源:Event.java


注:本文中的org.wso2.siddhi.core.event.remove.RemoveEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。