stmtCallbacks.clear();
for (int i = 0; i < entryCount; i++) // need to use the size of the collection
{
EPStatementHandleCallback handleCallback = (EPStatementHandleCallback) matchArray[i];
EPStatementAgentInstanceHandle handle = handleCallback.getAgentInstanceHandle();
ScheduleHandleCallback callback = handleCallback.getScheduleCallback();
Object entry = stmtCallbacks.get(handle);
// This statement has not been encountered before
if (entry == null)
{
stmtCallbacks.put(handle, callback);
continue;
}
// This statement has been encountered once before
if (entry instanceof ScheduleHandleCallback)
{
ScheduleHandleCallback existingCallback = (ScheduleHandleCallback) entry;
ArrayDeque<ScheduleHandleCallback> entries = new ArrayDeque<ScheduleHandleCallback>();
entries.add(existingCallback);
entries.add(callback);
stmtCallbacks.put(handle, entries);
continue;