本文整理汇总了Java中com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle类的典型用法代码示例。如果您正苦于以下问题:Java EPStatementAgentInstanceHandle类的具体用法?Java EPStatementAgentInstanceHandle怎么用?Java EPStatementAgentInstanceHandle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EPStatementAgentInstanceHandle类属于com.espertech.esper.core.context.util包,在下文中一共展示了EPStatementAgentInstanceHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeConsumer
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
/**
* Called by the consumer view to indicate it was stopped or destroyed, such that the
* consumer can be deregistered and further dispatches disregard this consumer.
*
* @param namedWindowConsumerView is the consumer representative view
*/
public void removeConsumer(NamedWindowConsumerView namedWindowConsumerView) {
EPStatementAgentInstanceHandle handleRemoved = null;
// Find the consumer view
for (Map.Entry<EPStatementAgentInstanceHandle, List<NamedWindowConsumerView>> entry : consumersNonContext.entrySet()) {
boolean foundAndRemoved = entry.getValue().remove(namedWindowConsumerView);
// Remove the consumer view
if (foundAndRemoved && (entry.getValue().size() == 0)) {
// Remove the handle if this list is now empty
handleRemoved = entry.getKey();
break;
}
}
if (handleRemoved != null) {
Map<EPStatementAgentInstanceHandle, List<NamedWindowConsumerView>> newConsumers = NamedWindowUtil.createConsumerMap(isPrioritized);
newConsumers.putAll(consumersNonContext);
newConsumers.remove(handleRemoved);
consumersNonContext = newConsumers;
}
}
示例2: removeConsumer
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
/**
* Called by the consumer view to indicate it was stopped or destroyed, such that the
* consumer can be deregistered and further dispatches disregard this consumer.
*
* @param namedWindowConsumerView is the consumer representative view
*/
public void removeConsumer(NamedWindowConsumerView namedWindowConsumerView) {
EPStatementAgentInstanceHandle handleRemoved = null;
// Find the consumer view
for (Map.Entry<EPStatementAgentInstanceHandle, List<NamedWindowConsumerView>> entry : consumersInContext.entrySet()) {
boolean foundAndRemoved = entry.getValue().remove(namedWindowConsumerView);
// Remove the consumer view
if (foundAndRemoved && (entry.getValue().size() == 0)) {
// Remove the handle if this list is now empty
handleRemoved = entry.getKey();
break;
}
}
if (handleRemoved != null) {
Map<EPStatementAgentInstanceHandle, List<NamedWindowConsumerView>> newConsumers = NamedWindowUtil.createConsumerMap(tailView.isPrioritized());
newConsumers.putAll(consumersInContext);
newConsumers.remove(handleRemoved);
consumersInContext = newConsumers;
}
// indicate to virtual data window that a consumer was added
VirtualDWView virtualDWView = rootViewInstance.getVirtualDataWindow();
if (virtualDWView != null && handleRemoved != null) {
virtualDWView.getVirtualDataWindow().handleEvent(new VirtualDataWindowEventConsumerRemove(tailView.getEventType().getName(), namedWindowConsumerView, handleRemoved.getStatementHandle().getStatementName(), handleRemoved.getAgentInstanceId()));
}
}
示例3: getDeltaPerConsumer
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
public LinkedHashMap<NamedWindowConsumerView, NamedWindowDeltaData> getDeltaPerConsumer(Object perStmtObj, EPStatementAgentInstanceHandle handle) {
List<NamedWindowConsumerLatch> list = (List<NamedWindowConsumerLatch>) perStmtObj;
LinkedHashMap<NamedWindowConsumerView, NamedWindowDeltaData> deltaPerConsumer = new LinkedHashMap<NamedWindowConsumerView, NamedWindowDeltaData>();
for (NamedWindowConsumerLatch unit : list) {
// for each unit
for (NamedWindowConsumerView consumerView : unit.getDispatchTo().get(handle)) {
// each consumer
NamedWindowDeltaData deltaForConsumer = deltaPerConsumer.get(consumerView);
if (deltaForConsumer == null) {
deltaPerConsumer.put(consumerView, unit.getDeltaData());
} else {
NamedWindowDeltaData aggregated = new NamedWindowDeltaData(deltaForConsumer, unit.getDeltaData());
deltaPerConsumer.put(consumerView, aggregated);
}
}
}
return deltaPerConsumer;
}
示例4: DataCacheExpiringImpl
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
/**
* Ctor.
*
* @param maxAgeSec is the maximum age in seconds
* @param purgeIntervalSec is the purge interval in seconds
* @param cacheReferenceType indicates whether hard, soft or weak references are used in the cache
* @param schedulingService is a service for call backs at a scheduled time, for purging
* @param scheduleSlot slot for scheduling callbacks for this cache
* @param epStatementAgentInstanceHandle is the statements-own handle for use in registering callbacks with services
* @param timeAbacus time abacus
*/
public DataCacheExpiringImpl(double maxAgeSec,
double purgeIntervalSec,
ConfigurationCacheReferenceType cacheReferenceType,
SchedulingService schedulingService,
long scheduleSlot,
EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
TimeAbacus timeAbacus) {
this.maxAgeSec = maxAgeSec;
this.purgeIntervalSec = purgeIntervalSec;
this.schedulingService = schedulingService;
this.scheduleSlot = scheduleSlot;
this.timeAbacus = timeAbacus;
if (cacheReferenceType == ConfigurationCacheReferenceType.HARD) {
this.cache = new HashMap<Object, Item>();
} else if (cacheReferenceType == ConfigurationCacheReferenceType.SOFT) {
this.cache = new ReferenceMap(ReferenceMap.SOFT, ReferenceMap.SOFT);
} else {
this.cache = new WeakHashMap<Object, Item>();
}
this.epStatementAgentInstanceHandle = epStatementAgentInstanceHandle;
}
示例5: getDataCache
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
/**
* Creates a cache implementation for the strategy as defined by the cache descriptor.
*
* @param cacheDesc cache descriptor
* @param epStatementAgentInstanceHandle statement handle for timer invocations
* @param schedulingService scheduling service for time-based caches
* @param scheduleBucket for ordered timer invokation
* @param statementContext statement context
* @param streamNum stream number
* @return data cache implementation
*/
public DataCache getDataCache(ConfigurationDataCache cacheDesc,
StatementContext statementContext,
EPStatementAgentInstanceHandle epStatementAgentInstanceHandle,
SchedulingService schedulingService,
ScheduleBucket scheduleBucket,
int streamNum) {
if (cacheDesc == null) {
return new DataCacheNullImpl();
}
if (cacheDesc instanceof ConfigurationLRUCache) {
ConfigurationLRUCache lruCache = (ConfigurationLRUCache) cacheDesc;
return new DataCacheLRUImpl(lruCache.getSize());
}
if (cacheDesc instanceof ConfigurationExpiryTimeCache) {
ConfigurationExpiryTimeCache expCache = (ConfigurationExpiryTimeCache) cacheDesc;
return makeTimeCache(expCache, statementContext, epStatementAgentInstanceHandle, schedulingService, scheduleBucket, streamNum);
}
throw new IllegalStateException("Cache implementation class not configured");
}
示例6: getSnapshot
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
public Collection<EventBean> getSnapshot(EPStatementAgentInstanceHandle createWindowStmtHandle, Viewable parent) {
createWindowStmtHandle.getStatementAgentInstanceLock().acquireReadLock();
try {
Iterator<EventBean> it = parent.iterator();
if (!it.hasNext()) {
return Collections.EMPTY_LIST;
}
ArrayDeque<EventBean> list = new ArrayDeque<EventBean>();
while (it.hasNext()) {
RevisionEventBeanDeclared fullRevision = (RevisionEventBeanDeclared) it.next();
Object key = fullRevision.getKey();
RevisionStateDeclared state = statePerKey.get(key);
list.add(state.getLastEvent());
}
return list;
} finally {
createWindowStmtHandle.getStatementAgentInstanceLock().releaseReadLock();
}
}
示例7: getSnapshot
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
public Collection<EventBean> getSnapshot(EPStatementAgentInstanceHandle createWindowStmtHandle, Viewable parent) {
createWindowStmtHandle.getStatementAgentInstanceLock().acquireReadLock();
try {
Iterator<EventBean> it = parent.iterator();
if (!it.hasNext()) {
return Collections.EMPTY_LIST;
}
ArrayDeque<EventBean> list = new ArrayDeque<EventBean>();
while (it.hasNext()) {
RevisionEventBeanMerge fullRevision = (RevisionEventBeanMerge) it.next();
Object key = fullRevision.getKey();
RevisionStateMerge state = statePerKey.get(key);
list.add(state.getLastEvent());
}
return list;
} finally {
createWindowStmtHandle.getStatementAgentInstanceLock().releaseReadLock();
}
}
示例8: open
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
public void open(DataFlowOpOpenContext openContext) {
FilterValueSet valueSet;
try {
List<ExprNode> filters = Collections.emptyList();
if (filter != null) {
filters = Collections.singletonList(filter);
}
FilterSpecCompiled spec = FilterSpecCompiler.makeFilterSpec(eventType, eventType.getName(), filters, null,
null, null, new StreamTypeServiceImpl(eventType, eventType.getName(), true, agentInstanceContext.getEngineURI()), null, agentInstanceContext.getStatementContext(), new ArrayList<Integer>());
valueSet = spec.getValueSet(null, null, agentInstanceContext, agentInstanceContext.getEngineImportService(), agentInstanceContext.getAnnotations());
} catch (ExprValidationException ex) {
throw new EPException("Failed to open filter: " + ex.getMessage(), ex);
}
EPStatementAgentInstanceHandle handle = new EPStatementAgentInstanceHandle(agentInstanceContext.getStatementContext().getEpStatementHandle(), agentInstanceContext.getAgentInstanceLock(), 0, new StatementAgentInstanceFilterVersion(), agentInstanceContext.getStatementContext().getFilterFaultHandlerFactory());
callbackHandle = new EPStatementHandleCallback(handle, this);
filterServiceEntry = agentInstanceContext.getStatementContext().getFilterService().add(valueSet, callbackHandle);
}
示例9: processStatementFilterMultiple
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
/**
* Processing multiple filter matches for a statement.
*
* @param handle statement handle
* @param callbackList object containing callbacks
* @param theEvent to process
*/
public void processStatementFilterMultiple(EPStatementAgentInstanceHandle handle, ArrayDeque<FilterHandleCallback> callbackList, EventBean theEvent) {
handle.getStatementAgentInstanceLock().acquireWriteLock();
try {
if (handle.isHasVariables()) {
unisolatedServices.getVariableService().setLocalVersion();
}
handle.getMultiMatchHandler().handle(callbackList, theEvent);
// internal join processing, if applicable
handle.internalDispatch();
} catch (RuntimeException ex) {
unisolatedServices.getExceptionHandlingService().handleException(ex, handle, ExceptionHandlerExceptionType.PROCESS, theEvent);
} finally {
if (handle.isHasTableAccess()) {
unisolatedServices.getTableService().getTableExprEvaluatorContext().releaseAcquiredLocks();
}
handle.getStatementAgentInstanceLock().releaseWriteLock();
}
}
示例10: processStatementFilterSingle
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
/**
* Process a single match.
*
* @param handle statement
* @param handleCallback callback
* @param theEvent event to indicate
*/
public void processStatementFilterSingle(EPStatementAgentInstanceHandle handle, EPStatementHandleCallback handleCallback, EventBean theEvent) {
handle.getStatementAgentInstanceLock().acquireWriteLock();
try {
if (handle.isHasVariables()) {
unisolatedServices.getVariableService().setLocalVersion();
}
handleCallback.getFilterCallback().matchFound(theEvent, null);
// internal join processing, if applicable
handle.internalDispatch();
} catch (RuntimeException ex) {
unisolatedServices.getExceptionHandlingService().handleException(ex, handle, ExceptionHandlerExceptionType.PROCESS, theEvent);
} finally {
if (handle.isHasTableAccess()) {
unisolatedServices.getTableService().getTableExprEvaluatorContext().releaseAcquiredLocks();
}
handleCallback.getAgentInstanceHandle().getStatementAgentInstanceLock().releaseWriteLock();
}
}
示例11: testCreateNoJoin
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
public void testCreateNoJoin() {
EPStatementHandle stmtHande = new EPStatementHandle(1, "id", null, StatementType.SELECT, "text", false, null, 1, false, false, new MultiMatchHandlerFactoryImpl().getDefaultHandler());
EPStatementAgentInstanceHandle stmtAgentHandle = new EPStatementAgentInstanceHandle(stmtHande, new StatementAgentInstanceRWLockImpl(false), -1, null, null);
streams = new EventStream[4];
streams[0] = streamFactoryService.createStream(1, filterSpecs[0], supportFilterService, stmtAgentHandle, false, null, false, false, null, false, 0, false).getFirst();
streams[1] = streamFactoryService.createStream(2, filterSpecs[0], supportFilterService, stmtAgentHandle, false, null, false, false, null, false, 0, false).getFirst();
streams[2] = streamFactoryService.createStream(3, filterSpecs[1], supportFilterService, stmtAgentHandle, false, null, false, false, null, false, 0, false).getFirst();
streams[3] = streamFactoryService.createStream(4, filterSpecs[2], supportFilterService, stmtAgentHandle, false, null, false, false, null, false, 0, false).getFirst();
// Streams are reused
assertSame(streams[0], streams[1]);
assertSame(streams[0], streams[2]);
assertNotSame(streams[0], streams[3]);
// Type is ok
assertEquals(SupportBean.class, streams[0].getEventType().getUnderlyingType());
// 2 filters are active now
assertEquals(2, supportFilterService.getAdded().size());
}
示例12: processHandleMultiple
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
private void processHandleMultiple(EPStatementAgentInstanceHandle handle, Map<NamedWindowConsumerView, NamedWindowDeltaData> deltaPerConsumer, ExprEvaluatorContext exprEvaluatorContext) {
handle.getStatementAgentInstanceLock().acquireWriteLock(statementLockFactory);
try
{
if (handle.isHasVariables())
{
variableService.setLocalVersion();
}
for (Map.Entry<NamedWindowConsumerView, NamedWindowDeltaData> entryDelta : deltaPerConsumer.entrySet())
{
EventBean[] newData = entryDelta.getValue().getNewData();
EventBean[] oldData = entryDelta.getValue().getOldData();
entryDelta.getKey().update(newData, oldData);
}
// internal join processing, if applicable
handle.internalDispatch(exprEvaluatorContext);
}
catch (RuntimeException ex) {
exceptionHandlingService.handleException(ex, handle);
}
finally
{
handle.getStatementAgentInstanceLock().releaseWriteLock(null);
}
}
示例13: processHandle
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
private void processHandle(EPStatementAgentInstanceHandle handle, List<NamedWindowConsumerView> value, EventBean[] newData, EventBean[] oldData, ExprEvaluatorContext exprEvaluatorContext) {
handle.getStatementAgentInstanceLock().acquireWriteLock(statementLockFactory);
try
{
if (handle.isHasVariables())
{
variableService.setLocalVersion();
}
for (NamedWindowConsumerView consumerView : value)
{
consumerView.update(newData, oldData);
}
// internal join processing, if applicable
handle.internalDispatch(exprEvaluatorContext);
}
catch (RuntimeException ex) {
exceptionHandlingService.handleException(ex, handle);
}
finally
{
handle.getStatementAgentInstanceLock().releaseWriteLock(null);
}
}
示例14: getDeltaPerConsumer
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
public LinkedHashMap<NamedWindowConsumerView, NamedWindowDeltaData> getDeltaPerConsumer(Object perStmtObj, EPStatementAgentInstanceHandle handle) {
List<NamedWindowConsumerDispatchUnit> list = (List<NamedWindowConsumerDispatchUnit>) perStmtObj;
LinkedHashMap<NamedWindowConsumerView, NamedWindowDeltaData> deltaPerConsumer = new LinkedHashMap<NamedWindowConsumerView, NamedWindowDeltaData>();
for (NamedWindowConsumerDispatchUnit unit : list) // for each unit
{
for (NamedWindowConsumerView consumerView : unit.getDispatchTo().get(handle)) // each consumer
{
NamedWindowDeltaData deltaForConsumer = deltaPerConsumer.get(consumerView);
if (deltaForConsumer == null)
{
deltaPerConsumer.put(consumerView, unit.getDeltaData());
}
else
{
NamedWindowDeltaData aggregated = new NamedWindowDeltaData(deltaForConsumer, unit.getDeltaData());
deltaPerConsumer.put(consumerView, aggregated);
}
}
}
return deltaPerConsumer;
}
示例15: removeConsumer
import com.espertech.esper.core.context.util.EPStatementAgentInstanceHandle; //导入依赖的package包/类
/**
* Called by the consumer view to indicate it was stopped or destroyed, such that the
* consumer can be deregistered and further dispatches disregard this consumer.
* @param namedWindowConsumerView is the consumer representative view
*/
public void removeConsumer(NamedWindowConsumerView namedWindowConsumerView)
{
EPStatementAgentInstanceHandle handleRemoved = null;
// Find the consumer view
for (Map.Entry<EPStatementAgentInstanceHandle, List<NamedWindowConsumerView>> entry : consumersNonContext.entrySet())
{
boolean foundAndRemoved = entry.getValue().remove(namedWindowConsumerView);
// Remove the consumer view
if ((foundAndRemoved) && (entry.getValue().size() == 0))
{
// Remove the handle if this list is now empty
handleRemoved = entry.getKey();
break;
}
}
if (handleRemoved != null)
{
Map<EPStatementAgentInstanceHandle, List<NamedWindowConsumerView>> newConsumers = NamedWindowUtil.createConsumerMap(isPrioritized);
newConsumers.putAll(consumersNonContext);
newConsumers.remove(handleRemoved);
consumersNonContext = newConsumers;
}
}