1 | // Copyright 2004-2007 Jean-Francois Poilpret |
2 | // |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | // you may not use this file except in compliance with the License. |
5 | // You may obtain a copy of the License at |
6 | // |
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | // |
9 | // Unless required by applicable law or agreed to in writing, software |
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | // See the License for the specific language governing permissions and |
13 | // limitations under the License. |
14 | |
15 | package net.sourceforge.hiveevents; |
16 | |
17 | /** |
18 | * Thread-safe implementation of an Event Channel. |
19 | * @author Jean-Francois Poilpret |
20 | */ |
21 | public class SyncChannelImpl<T> extends ChannelImpl<T> |
22 | { |
23 | public SyncChannelImpl(String name, |
24 | int pullConsumerPriority, |
25 | Class<T> clazz, |
26 | boolean logEvents) |
27 | { |
28 | super(name, pullConsumerPriority, clazz, logEvents); |
29 | } |
30 | |
31 | synchronized public void block() |
32 | { |
33 | super.block(); |
34 | } |
35 | |
36 | synchronized public void unblock() |
37 | { |
38 | super.unblock(); |
39 | } |
40 | |
41 | synchronized public void unregisterConsumer(int idConsumer) |
42 | { |
43 | super.unregisterConsumer(idConsumer); |
44 | } |
45 | |
46 | synchronized public void unregisterAllConsumers() |
47 | { |
48 | super.unregisterAllConsumers(); |
49 | } |
50 | |
51 | synchronized public int registerPushConsumer(int priority, |
52 | Filter<T> filter, |
53 | Consumer<T> consumer) |
54 | { |
55 | return super.registerPushConsumer(priority, filter, consumer); |
56 | } |
57 | |
58 | synchronized public int registerPullConsumer(Filter<T> filter) |
59 | { |
60 | return super.registerPullConsumer(filter); |
61 | } |
62 | |
63 | synchronized public void push(T event) |
64 | { |
65 | super.push(event); |
66 | } |
67 | |
68 | synchronized protected ConsumerInfo<T> getConsumer(int idConsumer) |
69 | { |
70 | return super.getConsumer(idConsumer); |
71 | } |
72 | } |