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