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 com.tc.stats.Monitorable;
07:
08: import java.util.Collection;
09: import java.util.List;
10:
11: /**
12: * @author steve
13: */
14: public interface Sink extends Monitorable {
15: /**
16: * The context may or may not be added to the sink depending on the state of the sink. The
17: * implementation can make the decision based on various factors.
18: *
19: * @param context
20: * @return
21: */
22: public boolean addLossy(EventContext context);
23:
24: /**
25: * Add More than one context at a time. This is more efficient then adding one at a time
26: *
27: * @param contexts
28: */
29: public void addMany(Collection contexts);
30:
31: /**
32: * Add a event to the Sink (no, really!)
33: *
34: * @param context
35: */
36: public void add(EventContext context);
37:
38: /**
39: * The predicate allows the Sink to reject the EventContext rather than handle it
40: *
41: * @param predicate
42: */
43: public void setAddPredicate(AddPredicate predicate);
44:
45: /**
46: * Get the predicate (I hate the useless javadocs)
47: *
48: * @return
49: */
50: public AddPredicate getPredicate();
51:
52: /**
53: * returns the current size of the queue
54: *
55: * @return
56: */
57: public int size();
58:
59: public void clear();
60:
61: public void pause(List pauseEvents);
62:
63: public void unpause();
64: }
|