class EsperStatement implements EsperStatementOperations {

	public <T> List<T> concurrentUnsafeQuery(ParameterizedEsperRowMapper<T> rm) {
		LOG.info("Concurrent unsafe query being executed");

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

		Iterator<EventBean> safeIter = this.epStatement.iterator();

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

		LOG.info("Concurrent unsafe query was completed");
		return objectList;
	}

}

class TestEsperStatement {

    private EsperTemplate template;
    private EsperStatement statement;
    private ParameterizedEsperRowMapper<SampleEvent> rowMapper;

    @Test
    public void testConcurrencyUnsafeQuery() throws Exception {


        SampleEvent event = new SampleEvent();
        template.sendEvent(event);

        List<SampleEvent> events = statement.concurrentUnsafeQuery(this.rowMapper);

        assertEquals(events.size(), 1);
        assertEquals(events.get(0), event);
    }

}