001package org.apache.commons.jcs3.auxiliary.remote.behavior; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.io.IOException; 023import java.rmi.Remote; 024 025import org.apache.commons.jcs3.auxiliary.remote.server.behavior.RemoteType; 026import org.apache.commons.jcs3.engine.behavior.ICacheElement; 027import org.apache.commons.jcs3.engine.behavior.ICacheListener; 028 029/** 030 * Listens for remote cache event notification ( rmi callback ). 031 */ 032public interface IRemoteCacheListener<K, V> 033 extends ICacheListener<K, V>, Remote 034{ 035 /** 036 * Get the id to be used by this manager. 037 * <p> 038 * @return long 039 * @throws IOException 040 */ 041 @Override 042 long getListenerId() 043 throws IOException; 044 045 /** 046 * Set the id to be used by this manager. The remote cache server identifies clients by this id. 047 * The value will be set by the server through the remote cache listener. 048 * <p> 049 * @param id 050 * @throws IOException 051 */ 052 @Override 053 void setListenerId( long id ) 054 throws IOException; 055 056 /** 057 * Notifies the subscribers for a cache entry update. 058 * <p> 059 * @param item 060 * @throws IOException 061 */ 062 @Override 063 void handlePut( ICacheElement<K, V> item ) 064 throws IOException; 065 066 /** 067 * Notifies the subscribers for a cache entry removal. 068 * <p> 069 * @param cacheName 070 * @param key 071 * @throws IOException 072 */ 073 @Override 074 void handleRemove( String cacheName, K key ) 075 throws IOException; 076 077 /** 078 * Notifies the subscribers for a cache remove-all. 079 * <p> 080 * @param cacheName 081 * @throws IOException 082 */ 083 @Override 084 void handleRemoveAll( String cacheName ) 085 throws IOException; 086 087 /** 088 * Notifies the subscribers for freeing up the named cache. 089 * <p> 090 * @param cacheName 091 * @throws IOException 092 */ 093 @Override 094 void handleDispose( String cacheName ) 095 throws IOException; 096 097 /** 098 * Gets the remoteType attribute of the IRemoteCacheListener object 099 * <p> 100 * @return The remoteType value 101 * @throws IOException 102 */ 103 RemoteType getRemoteType() 104 throws IOException; 105 106 /** 107 * This is for debugging. It allows the remote cache server to log the address of any listeners 108 * that register. 109 * <p> 110 * @return the local host address. 111 * @throws IOException 112 */ 113 String getLocalHostAddress() 114 throws IOException; 115 116 /** 117 * Deregistered itself. 118 * <p> 119 * @throws IOException 120 */ 121 void dispose() 122 throws IOException; 123}