001 package org.apache.jcs.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
022
023 /**
024 * This specifies what a remote cache configuration object should look like.
025 */
026 public interface IRemoteCacheAttributes
027 extends ICommonRemoteCacheAttributes
028 {
029 /**
030 * If RECEIVE is false then the remote cache will not register a listener with the remote
031 * server. This allows you to configure a remote server as a repository from which you can get
032 * and to which you put, but from which you do not receive any notifications. That is, you will
033 * not receive updates or removes.
034 * <p>
035 * If you set this option to false, you should set your local memory size to 0.
036 */
037 boolean DEFAULT_RECEIVE = true;
038
039 /**
040 * The number of elements the zombie queue will hold. This queue is used to store events if we
041 * loose our connection with the server.
042 */
043 int DEFAULT_ZOMBIE_QUEUE_MAX_SIZE = 1000;
044
045 /**
046 * Gets the failoverIndex attribute of the IRemoteCacheAttributes object.
047 * <p>
048 * This specifies which server in the list we are listening to if the number is greater than 0
049 * we will try to move to 0 position the primary is added as position 1 if it is present
050 * <p>
051 * @return The failoverIndex value
052 */
053 int getFailoverIndex();
054
055 /**
056 * Sets the failoverIndex attribute of the IRemoteCacheAttributes object
057 * <p>
058 * @param p The new failoverIndex value
059 */
060 void setFailoverIndex( int p );
061
062 /**
063 * Gets the failovers attribute of the IRemoteCacheAttributes object
064 * <p>
065 * @return The failovers value
066 */
067 String[] getFailovers();
068
069 /**
070 * Sets the failovers attribute of the IRemoteCacheAttributes object
071 * <p>
072 * @param f The new failovers value
073 */
074 void setFailovers( String[] f );
075
076 /**
077 * Gets the localPort attribute of the IRemoteCacheAttributes object
078 * <p>
079 * @return The localPort value
080 */
081 int getLocalPort();
082
083 /**
084 * Sets the localPort attribute of the IRemoteCacheAttributes object
085 * <p>
086 * @param p The new localPort value
087 */
088 void setLocalPort( int p );
089
090 /**
091 * Gets the failoverServers attribute of the IRemoteCacheAttributes object
092 * <p>
093 * @return The failoverServers value
094 */
095 String getFailoverServers();
096
097 /**
098 * Sets the failoverServers attribute of the IRemoteCacheAttributes object
099 * <p>
100 * @param s The new failoverServers value
101 */
102 void setFailoverServers( String s );
103
104 /**
105 * The thread pool the remote cache should use. At first this will only be for gets.
106 * <p>
107 * The default name is "remote_cache_client"
108 * <p>
109 * @return the name of the pool
110 */
111 String getThreadPoolName();
112
113 /**
114 * Set the name of the pool to use. Pools should be defined in the cache.ccf.
115 * <p>
116 * @param name
117 */
118 void setThreadPoolName( String name );
119
120 /**
121 * -1 and 0 mean no timeout, this is the default if the timeout is -1 or 0, no threadpool will
122 * be used.
123 * <p>
124 * @return the time in millis
125 */
126 int getGetTimeoutMillis();
127
128 /**
129 * -1 means no timeout, this is the default if the timeout is -1 or 0, no threadpool will be
130 * used. If the timeout is greater than 0 a threadpool will be used for get requests.
131 * <p>
132 * @param millis
133 */
134 void setGetTimeoutMillis( int millis );
135
136 /**
137 * By default this option is true. If you set it to false, you will not receive updates or
138 * removes from the remote server.
139 * <p>
140 * @param receive
141 */
142 void setReceive( boolean receive );
143
144 /**
145 * If RECEIVE is false then the remote cache will not register a listener with the remote
146 * server. This allows you to configure a remote server as a repository from which you can get
147 * and to which you put, but from which you do not receive any notifications. That is, you will
148 * not receive updates or removes.
149 * <p>
150 * If you set this option to false, you should set your local memory size to 0.
151 * <p>
152 * The remote cache manager uses this value to decide whether or not to register a listener.
153 * <p>
154 * It makes no sense to configure a cluster remote cache to no receive.
155 * <p>
156 * Since a non-receiving remote cache client will not register a listener, it will not have a
157 * listener id assigned from the server. As such the remote server cannot determine if it is a
158 * cluster or a normal client. It will assume that it is a normal client.
159 * <p>
160 * @return the receive value.
161 */
162 boolean isReceive();
163
164 /**
165 * The number of elements the zombie queue will hold. This queue is used to store events if we
166 * loose our connection with the server.
167 * <p>
168 * @param zombieQueueMaxSize The zombieQueueMaxSize to set.
169 */
170 void setZombieQueueMaxSize( int zombieQueueMaxSize );
171
172 /**
173 * The number of elements the zombie queue will hold. This queue is used to store events if we
174 * loose our connection with the server.
175 * <p>
176 * @return Returns the zombieQueueMaxSize.
177 */
178 int getZombieQueueMaxSize();
179 }