001package org.apache.commons.jcs3.auxiliary.remote.behavior;
002
003import java.util.List;
004
005import org.apache.commons.jcs3.auxiliary.remote.RemoteLocation;
006
007/*
008 * Licensed to the Apache Software Foundation (ASF) under one
009 * or more contributor license agreements.  See the NOTICE file
010 * distributed with this work for additional information
011 * regarding copyright ownership.  The ASF licenses this file
012 * to you under the Apache License, Version 2.0 (the
013 * "License"); you may not use this file except in compliance
014 * with the License.  You may obtain a copy of the License at
015 *
016 *   http://www.apache.org/licenses/LICENSE-2.0
017 *
018 * Unless required by applicable law or agreed to in writing,
019 * software distributed under the License is distributed on an
020 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
021 * KIND, either express or implied.  See the License for the
022 * specific language governing permissions and limitations
023 * under the License.
024 */
025
026/**
027 * This specifies what a remote cache configuration object should look like.
028 */
029public interface IRemoteCacheAttributes
030    extends ICommonRemoteCacheAttributes
031{
032    /**
033     * If RECEIVE is false then the remote cache will not register a listener with the remote
034     * server. This allows you to configure a remote server as a repository from which you can get
035     * and to which you put, but from which you do not receive any notifications. That is, you will
036     * not receive updates or removes.
037     * <p>
038     * If you set this option to false, you should set your local memory size to 0.
039     */
040    boolean DEFAULT_RECEIVE = true;
041
042    /**
043     * The number of elements the zombie queue will hold. This queue is used to store events if we
044     * loose our connection with the server.
045     */
046    int DEFAULT_ZOMBIE_QUEUE_MAX_SIZE = 1000;
047
048    /**
049     * Gets the failoverIndex attribute of the IRemoteCacheAttributes object.
050     * <p>
051     * This specifies which server in the list we are listening to if the number is greater than 0
052     * we will try to move to 0 position the primary is added as position 1 if it is present
053     * <p>
054     * @return The failoverIndex value
055     */
056    int getFailoverIndex();
057
058    /**
059     * Sets the failoverIndex attribute of the IRemoteCacheAttributes object
060     * <p>
061     * @param p The new failoverIndex value
062     */
063    void setFailoverIndex( int p );
064
065    /**
066     * Gets the failovers attribute of the IRemoteCacheAttributes object
067     * <p>
068     * @return The failovers value
069     */
070    List<RemoteLocation> getFailovers();
071
072    /**
073     * Sets the failovers attribute of the IRemoteCacheAttributes object
074     * <p>
075     * @param failovers The new failovers value
076     */
077    void setFailovers( List<RemoteLocation> failovers );
078
079    /**
080     * Gets the localPort attribute of the IRemoteCacheAttributes object
081     * <p>
082     * @return The localPort value
083     */
084    int getLocalPort();
085
086    /**
087     * Sets the localPort attribute of the IRemoteCacheAttributes object
088     * <p>
089     * @param p The new localPort value
090     */
091    void setLocalPort( int p );
092
093    /**
094     * Gets the failoverServers attribute of the IRemoteCacheAttributes object
095     * <p>
096     * @return The failoverServers value
097     */
098    String getFailoverServers();
099
100    /**
101     * Sets the failoverServers attribute of the IRemoteCacheAttributes object
102     * <p>
103     * @param s The new failoverServers value
104     */
105    void setFailoverServers( String s );
106
107    /**
108     * The thread pool the remote cache should use. At first this will only be for gets.
109     * <p>
110     * The default name is "remote_cache_client"
111     * <p>
112     * @return the name of the pool
113     */
114    String getThreadPoolName();
115
116    /**
117     * Set the name of the pool to use. Pools should be defined in the cache.ccf.
118     * <p>
119     * @param name
120     */
121    void setThreadPoolName( String name );
122
123    /**
124     * -1 and 0 mean no timeout, this is the default if the timeout is -1 or 0, no threadpool will
125     * be used.
126     * <p>
127     * @return the time in millis
128     */
129    int getGetTimeoutMillis();
130
131    /**
132     * -1 means no timeout, this is the default if the timeout is -1 or 0, no threadpool will be
133     * used. If the timeout is greater than 0 a threadpool will be used for get requests.
134     * <p>
135     * @param millis
136     */
137    void setGetTimeoutMillis( int millis );
138
139    /**
140     * By default this option is true. If you set it to false, you will not receive updates or
141     * removes from the remote server.
142     * <p>
143     * @param receive
144     */
145    void setReceive( boolean receive );
146
147    /**
148     * If RECEIVE is false then the remote cache will not register a listener with the remote
149     * server. This allows you to configure a remote server as a repository from which you can get
150     * and to which you put, but from which you do not receive any notifications. That is, you will
151     * not receive updates or removes.
152     * <p>
153     * If you set this option to false, you should set your local memory size to 0.
154     * <p>
155     * The remote cache manager uses this value to decide whether or not to register a listener.
156     * <p>
157     * It makes no sense to configure a cluster remote cache to no receive.
158     * <p>
159     * Since a non-receiving remote cache client will not register a listener, it will not have a
160     * listener id assigned from the server. As such the remote server cannot determine if it is a
161     * cluster or a normal client. It will assume that it is a normal client.
162     * <p>
163     * @return the receive value.
164     */
165    boolean isReceive();
166
167    /**
168     * The number of elements the zombie queue will hold. This queue is used to store events if we
169     * loose our connection with the server.
170     * <p>
171     * @param zombieQueueMaxSize The zombieQueueMaxSize to set.
172     */
173    void setZombieQueueMaxSize( int zombieQueueMaxSize );
174
175    /**
176     * The number of elements the zombie queue will hold. This queue is used to store events if we
177     * loose our connection with the server.
178     * <p>
179     * @return Returns the zombieQueueMaxSize.
180     */
181    int getZombieQueueMaxSize();
182}