View Javadoc

1   package org.apache.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  import java.io.Serializable;
24  
25  /***
26   * Used to receive a cache event notification.
27   * <p>
28   * Note: objects which implement this interface are local listeners to cache changes, whereas
29   * objects which implement IRmiCacheListener are remote listeners to cache changes.
30   */
31  public interface ICacheListener
32  {
33      /***
34       * Notifies the subscribers for a cache entry update.
35       * <p>
36       * @param item
37       * @throws IOException
38       */
39      public void handlePut( ICacheElement item )
40          throws IOException;
41  
42      /***
43       * Notifies the subscribers for a cache entry removal.
44       * <p>
45       * @param cacheName
46       * @param key
47       * @throws IOException
48       */
49      public void handleRemove( String cacheName, Serializable key )
50          throws IOException;
51  
52      /***
53       * Notifies the subscribers for a cache remove-all.
54       * <p>
55       * @param cacheName
56       * @throws IOException
57       */
58      public void handleRemoveAll( String cacheName )
59          throws IOException;
60  
61      /***
62       * Notifies the subscribers for freeing up the named cache.
63       * <p>
64       * @param cacheName
65       * @throws IOException
66       */
67      public void handleDispose( String cacheName )
68          throws IOException;
69  
70      /***
71       * sets unique identifier of listener home
72       * <p>
73       * @param id The new listenerId value
74       * @throws IOException
75       */
76      public void setListenerId( long id )
77          throws IOException;
78  
79      /***
80       * Gets the listenerId attribute of the ICacheListener object
81       * <p>
82       * @return The listenerId value
83       * @throws IOException
84       */
85      public long getListenerId()
86          throws IOException;
87  }