01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.async.api;
05:
06: import java.util.Collection;
07:
08: /**
09: * @author steve Interface for handling either single events or multiple events at one time. For more information of
10: * this kind of stuff google SEDA -Staged Event Driven Architecure
11: */
12: public interface EventHandler {
13:
14: /**
15: * Handle one event at a time. Called by the StageController
16: *
17: * @param context
18: * @throws EventHandlerException
19: */
20: public void handleEvent(EventContext context)
21: throws EventHandlerException;
22:
23: /**
24: * Handle multiple events at once in a batch. This can be more performant because it avoids context switching
25: *
26: * @param context
27: * @throws EventHandlerException
28: */
29: public void handleEvents(Collection context)
30: throws EventHandlerException;
31:
32: /**
33: * Initialize the state of the EventHandler
34: *
35: * @param context
36: */
37: public void initializeContext(ConfigurationContext context);
38:
39: /**
40: * Shut down the stage
41: */
42: public void destroy();
43:
44: }
|