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 org.apache.commons.jcs3.auxiliary.AuxiliaryCache;
023import org.apache.commons.jcs3.engine.behavior.ICacheServiceNonLocal;
024
025/**
026 * This defines the behavior expected of a remote cache client. This extends Auxiliary cache which
027 * in turn extends ICache.
028 * <p>
029 * I'd like generalize this a bit.
030 * </p>
031 */
032public interface IRemoteCacheClient<K, V>
033    extends AuxiliaryCache<K, V>
034{
035    /**
036     * Replaces the current remote cache service handle with the given handle. If the current remote
037     * is a Zombie, the propagate the events that may be queued to the restored service.
038     * <p>
039     * @param remote ICacheServiceNonLocal -- the remote server or proxy to the remote server
040     */
041    void fixCache( ICacheServiceNonLocal<?, ?> remote );
042
043    /**
044     * Gets the listenerId attribute of the RemoteCacheListener object.
045     * <p>
046     * All requests to the remote cache must include a listener id. This allows the server to avoid
047     * sending updates the listener associated with this client.
048     * <p>
049     * @return The listenerId value
050     */
051    long getListenerId();
052
053    /**
054     * This returns the listener associated with this remote cache. TODO we should try to get this
055     * out of the interface.
056     * <p>
057     * @return IRemoteCacheListener
058     */
059    IRemoteCacheListener<K, V> getListener();
060}