1 package org.apache.commons.jcs.engine.behavior;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.IOException;
23
24 /**
25 * Used to register interest in receiving cache changes. <br>
26 * <br>
27 * Note: server which implements this interface provides a local cache event
28 * notification service, whereas server which implements IRmiCacheWatch provides
29 * a remote cache event notification service.
30 *
31 */
32 public interface ICacheObserver
33 {
34 /**
35 * Subscribes to the specified cache.
36 *
37 * @param cacheName
38 * the specified cache.
39 * @param obj
40 * object to notify for cache changes.
41 * @throws IOException
42 */
43 <K, V> void addCacheListener( String cacheName, ICacheListener<K, V> obj )
44 throws IOException;
45
46 //, CacheNotFoundException;
47
48 /**
49 * Subscribes to all caches.
50 *
51 * @param obj
52 * object to notify for all cache changes.
53 * @throws IOException
54 */
55 <K, V> void addCacheListener( ICacheListener<K, V> obj )
56 throws IOException;
57
58 /**
59 * Unsubscribes from the specified cache.
60 * @param cacheName
61 *
62 * @param obj
63 * existing subscriber.
64 * @throws IOException
65 */
66 <K, V> void removeCacheListener( String cacheName, ICacheListener<K, V> obj )
67 throws IOException;
68
69 /**
70 * Unsubscribes from all caches.
71 *
72 * @param obj
73 * existing subscriber.
74 * @throws IOException
75 */
76 <K, V> void removeCacheListener( ICacheListener<K, V> obj )
77 throws IOException;
78 }