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


Java SafeIterator.next方法代码示例

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


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

示例1: concurrentSafeQuery

import com.espertech.esper.client.SafeIterator; //导入方法依赖的package包/类
public <T> List<T> concurrentSafeQuery(RowMapper<T> rm) {
	LOG.info("Concurrent safe query being executed");

	if (epStatement.isStopped() || epStatement.isDestroyed()) {
		LOG
				.error("Concurrent safe query was attempted when the statement was stopped or destroyed");
		throw new EsperStatementInvalidStateException(
				"Attempted to execute a concurrent safe query when esper statement resource had state of "
						+ epStatement.getState());
	}

	SafeIterator<EventBean> safeIter = this.epStatement.safeIterator();

	List<T> objectList = new ArrayList<T>();
	try {
		for (; safeIter.hasNext();) {
			EventBean event = safeIter.next();
			objectList.add(rm.mapRow(event));
		}
	} finally {
		safeIter.close();
	}

	LOG.info("Concurrent safe query was completed");
	return objectList;
}
 
开发者ID:sdcuike,项目名称:esper-2015,代码行数:27,代码来源:EsperStatement.java

示例2: handleGetAllEvents

import com.espertech.esper.client.SafeIterator; //导入方法依赖的package包/类
protected List<Object> handleGetAllEvents(String strategyName, String ruleName) {

		EPStatement statement = getServiceProvider(strategyName).getEPAdministrator().getStatement(ruleName);
		List<Object> list = new ArrayList<Object>();
		if (statement != null && statement.isStarted()) {
			SafeIterator<EventBean> it = statement.safeIterator();
			try {
				while (it.hasNext()) {
					EventBean bean = it.next();
					Object underlaying = bean.getUnderlying();
					list.add(underlaying);
				}
			} finally {
				it.close();
			}
		}
		return list;
	}
 
开发者ID:curtiszimmerman,项目名称:AlgoTrader,代码行数:19,代码来源:RuleServiceImpl.java

示例3: handleGetAllEventsProperty

import com.espertech.esper.client.SafeIterator; //导入方法依赖的package包/类
protected List<Object> handleGetAllEventsProperty(String strategyName, String ruleName, String property) throws Exception {

		EPStatement statement = getServiceProvider(strategyName).getEPAdministrator().getStatement(ruleName);
		List<Object> list = new ArrayList<Object>();
		if (statement != null && statement.isStarted()) {
			SafeIterator<EventBean> it = statement.safeIterator();
			try {
				while (it.hasNext()) {
					EventBean bean = it.next();
					Object underlaying = bean.get(property);
					list.add(underlaying);
				}
			} finally {
				it.close();
			}
		}
		return list;
	}
 
开发者ID:curtiszimmerman,项目名称:AlgoTrader,代码行数:19,代码来源:RuleServiceImpl.java

示例4: queryStatement

import com.espertech.esper.client.SafeIterator; //导入方法依赖的package包/类
/**
 * This method is used to query a certain statement from the CEP Engine. The method will return an ArrayList of EventBeans
 * @param StatementName
 * @return ArrayList<EventBean> 
 */
private ArrayList<EventBean> queryStatement(String StatementName) {
	
	long start = System.currentTimeMillis();
	
	// Get the Eventbean iterator
	SafeIterator<EventBean> iterator = getEsperStatement(StatementName).safeIterator();
	ArrayList<EventBean> result = new ArrayList<EventBean>();
	logger.trace("Querying statement: " + StatementName);
	
	
	// Loop over the list and add them to the result list.
	while (iterator.hasNext()) {
		EventBean event = iterator.next();
		result.add(event);
	}

	iterator.close();

	long end = System.currentTimeMillis();
	logger.trace("queryStatement took " + (end - start) + " msecs to process " + StatementName );

	
	// Return result list
	return result;
}
 
开发者ID:sgrotz,项目名称:myopentrader,代码行数:31,代码来源:EsperFactory.java

示例5: call

import com.espertech.esper.client.SafeIterator; //导入方法依赖的package包/类
public Object call() throws Exception {
    try {
        for (int loop = 0; loop < numRepeats; loop++) {
            log.info(".call Thread " + Thread.currentThread().getId() + " sending event " + loop);
            String id = Long.toString(threadNum * 100000000 + loop);
            SupportBean bean = new SupportBean(id, 0);
            engine.getEPRuntime().sendEvent(bean);

            for (int i = 0; i < stmt.length; i++) {
                log.info(".call Thread " + Thread.currentThread().getId() + " starting iterator " + loop);
                SafeIterator<EventBean> it = stmt[i].safeIterator();
                boolean found = false;
                for (; it.hasNext(); ) {
                    EventBean theEvent = it.next();
                    if (theEvent.get("theString").equals(id)) {
                        found = true;
                    }
                }
                it.close();
                Assert.assertTrue(found);
                log.info(".call Thread " + Thread.currentThread().getId() + " end iterator " + loop);
            }
        }
    } catch (AssertionFailedError ex) {
        log.error("Assertion error in thread " + Thread.currentThread().getId(), ex);
        return false;
    } catch (Throwable t) {
        log.error("Error in thread " + Thread.currentThread().getId(), t);
        return false;
    }
    return true;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:33,代码来源:StmtIterateCallable.java

示例6: concurrentSafeQueryForObject

import com.espertech.esper.client.SafeIterator; //导入方法依赖的package包/类
public <T> T concurrentSafeQueryForObject(RowMapper<T> rm) {
	LOG.info("Concurrent safe query for object being executed");

	if (epStatement.isStopped() || epStatement.isDestroyed()) {
		LOG
				.error("Concurrent safe query for object was attempted when the statement was stopped or destroyed");
		throw new EsperStatementInvalidStateException(
				"Attempted to execute a concurrent safe query for object when esper statement resource had state of "
						+ epStatement.getState());
	}

	SafeIterator<EventBean> safeIter = this.epStatement.safeIterator();

	T result = null;
	try {
		// Only retrieve the last result
		while (safeIter.hasNext()) {
			EventBean event = safeIter.next();
			if (!safeIter.hasNext()) {
				result = rm.mapRow(event);
			}

		}
	} finally {
		safeIter.close();
	}

	LOG.info("Concurrent safe query for object was completed");
	return result;
}
 
开发者ID:sdcuike,项目名称:esper-2015,代码行数:31,代码来源:EsperStatement.java

示例7: call

import com.espertech.esper.client.SafeIterator; //导入方法依赖的package包/类
public Object call() throws Exception
{
    try
    {
        for (int loop = 0; loop < numRepeats; loop++)
        {
            log.info(".call Thread " + Thread.currentThread().getId() + " sending event " + loop);
            String id = Long.toString(threadNum * 100000000 + loop);
            SupportBean bean = new SupportBean(id, 0);
            engine.getEPRuntime().sendEvent(bean);

            for (int i = 0; i < stmt.length; i++)
            {
                log.info(".call Thread " + Thread.currentThread().getId() + " starting iterator " + loop);
                SafeIterator<EventBean> it = stmt[i].safeIterator();
                boolean found = false;
                for (;it.hasNext();)
                {
                    EventBean theEvent = it.next();
                    if (theEvent.get("theString").equals(id))
                    {
                        found = true;
                    }
                }
                it.close();
                Assert.assertTrue(found);
                log.info(".call Thread " + Thread.currentThread().getId() + " end iterator " + loop);
            }
        }
    }
    catch (AssertionFailedError ex)
    {
        log.fatal("Assertion error in thread " + Thread.currentThread().getId(), ex);
        return false;
    }
    catch (Throwable t)
    {
        log.fatal("Error in thread " + Thread.currentThread().getId(), t);
        return false;
    }
    return true;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:43,代码来源:StmtIterateCallable.java


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