View Javadoc

1   package org.apache.jcs.auxiliary.remote.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  import java.rmi.Remote;
25  
26  import org.apache.jcs.auxiliary.remote.server.behavior.RemoteType;
27  import org.apache.jcs.engine.behavior.ICacheListener;
28  
29  /**
30   * Listens for remote cache event notification ( rmi callback ).
31   */
32  public interface IRemoteCacheListener<K extends Serializable, V extends Serializable>
33      extends ICacheListener<K, V>, Remote
34  {
35      /** SERVER_LISTENER -- for the cluster */
36      public final static int SERVER_LISTENER = 0;
37  
38      /** CLIENT_LISTENER -- these aren't used any longer. remove */
39      public final static int CLIENT_LISTENER = 1;
40  
41      /**
42       * Get the id to be used by this manager.
43       * <p>
44       * @return long
45       * @throws IOException
46       */
47      public long getListenerId()
48          throws IOException;
49  
50      /**
51       * Set the id to be used by this manager. The remote cache server identifies clients by this id.
52       * The value will be set by the server through the remote cache listener.
53       * <p>
54       * @param id
55       * @throws IOException
56       */
57      public void setListenerId( long id )
58          throws IOException;
59  
60      /**
61       * Gets the remoteType attribute of the IRemoteCacheListener object
62       * <p>
63       * @return The remoteType value
64       * @throws IOException
65       */
66      public RemoteType getRemoteType()
67          throws IOException;
68  
69      /**
70       * This is for debugging. It allows the remote cache server to log the address of any listeners
71       * that register.
72       * <p>
73       * @return the local host address.
74       * @throws IOException
75       */
76      public String getLocalHostAddress()
77          throws IOException;
78  
79      /**
80       * Deregisters itself.
81       * <p>
82       * @throws IOException
83       */
84      public void dispose()
85          throws IOException;
86  }