01: /*
02: * Copyright (c) 2001 by Matt Welsh and The Regents of the University of
03: * California. All rights reserved.
04: *
05: * Permission to use, copy, modify, and distribute this software and its
06: * documentation for any purpose, without fee, and without written agreement is
07: * hereby granted, provided that the above copyright notice and the following
08: * two paragraphs appear in all copies of this software.
09: *
10: * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
11: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
12: * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
13: * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14: *
15: * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
16: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17: * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
18: * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
19: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
20: *
21: * Author: Matt Welsh <mdw@cs.berkeley.edu>
22: *
23: */
24:
25: package seda.sandStorm.api;
26:
27: /**
28: * Enqueue predicates allow users to specify a method that will
29: * 'screen' elements being enqueued onto a sink, either accepting or
30: * rejecting them. This mechanism can be used to implement many interesting
31: * load-conditioning policies, for example, simple thresholding, rate
32: * control, credit-based flow control, and so forth. Note that the enqueue
33: * predicate runs in the context of the <b>caller of enqueue()</b>, which
34: * means it must be simple and fast.
35: *
36: * @author Matt Welsh
37: * @see SinkIF
38: *
39: */
40: public interface EnqueuePredicateIF {
41:
42: /**
43: * Tests the given element for acceptance onto the queue.
44: *
45: * @param element The <code>QueueElementIF</code> to enqueue
46: * @return True if the sink accepts the element; false otherwise.
47: */
48: public boolean accept(QueueElementIF element);
49:
50: }
|