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 org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
23  
24  /***
25   * This specifies what a remote cache configuration object should look like.
26   */
27  public interface IRemoteCacheAttributes
28      extends AuxiliaryCacheAttributes
29  {
30      /***
31       * A remote cache is either a local cache or a cluster cache.
32       */
33      public static final int LOCAL = 0;
34  
35      /***
36       * A remote cache is either a local cache or a cluster cache.
37       */
38      public static final int CLUSTER = 1;
39  
40      /*** The default timeout for the custom RMI socket facfory */
41      public static final int DEFAULT_RMI_SOCKET_FACTORY_TIMEOUT_MILLIS = 10000;
42  
43      /***
44       * If RECEIVE is false then the remote cache will not register a listener with the remote
45       * server. This allows you to configure a remote server as a repository from which you can get
46       * and to which you put, but from which you do not reveive any notifications. That is, you will
47       * not receive updates or removes.
48       * <p>
49       * If you set this option to false, you should set your locl memory size to 0.
50       */
51      public static final boolean DEFAULT_RECEIVE = true;
52  
53      /***
54       * The number of elements the zombie queue will hold. This queue is used to store events if we
55       * loose our conenction with the server.
56       */
57      public static final int DEFAULT_ZOMBIE_QUEUE_MAX_SIZE = 1000;
58  
59      /***
60       * Gets the remoteTypeName attribute of the IRemoteCacheAttributes object
61       * <p>
62       * @return The remoteTypeName value
63       */
64      public String getRemoteTypeName();
65  
66      /***
67       * Sets the remoteTypeName attribute of the IRemoteCacheAttributes object
68       * <p>
69       * @param s The new remoteTypeName value
70       */
71      public void setRemoteTypeName( String s );
72  
73      /***
74       * Gets the remoteType attribute of the IRemoteCacheAttributes object
75       * <p>
76       * @return The remoteType value
77       */
78      public int getRemoteType();
79  
80      /***
81       * Sets the remoteType attribute of the IRemoteCacheAttributes object
82       * <p>
83       * @param p The new remoteType value
84       */
85      public void setRemoteType( int p );
86  
87      /***
88       * Gets the failoverIndex attribute of the IRemoteCacheAttributes object.
89       * <p>
90       * This specifies which server in the list we are listening to if the number is greater than 0
91       * we will try to move to 0 position the primary is added as position 1 if it is present
92       * <p>
93       * @return The failoverIndex value
94       */
95      public int getFailoverIndex();
96  
97      /***
98       * Sets the failoverIndex attribute of the IRemoteCacheAttributes object
99       * <p>
100      * @param p The new failoverIndex value
101      */
102     public void setFailoverIndex( int p );
103 
104     /***
105      * Gets the failovers attribute of the IRemoteCacheAttributes object
106      * <p>
107      * @return The failovers value
108      */
109     public String[] getFailovers();
110 
111     /***
112      * Sets the failovers attribute of the IRemoteCacheAttributes object
113      * <p>
114      * @param f The new failovers value
115      */
116     public void setFailovers( String[] f );
117 
118     /***
119      * Gets the remoteServiceName attribute of the IRemoteCacheAttributes object
120      * <p>
121      * @return The remoteServiceName value
122      */
123     public String getRemoteServiceName();
124 
125     /***
126      * Sets the remoteServiceName attribute of the IRemoteCacheAttributes object
127      * <p>
128      * @param s The new remoteServiceName value
129      */
130     public void setRemoteServiceName( String s );
131 
132     /***
133      * Gets the remoteHost attribute of the IRemoteCacheAttributes object
134      * <p>
135      * @return The remoteHost value
136      */
137     public String getRemoteHost();
138 
139     /***
140      * Sets the remoteHost attribute of the IRemoteCacheAttributes object
141      * <p>
142      * @param s The new remoteHost value
143      */
144     public void setRemoteHost( String s );
145 
146     /***
147      * Gets the remotePort attribute of the IRemoteCacheAttributes object
148      * <p>
149      * @return The remotePort value
150      */
151     public int getRemotePort();
152 
153     /***
154      * Sets the remotePort attribute of the IRemoteCacheAttributes object
155      * <p>
156      * @param p The new remotePort value
157      */
158     public void setRemotePort( int p );
159 
160     /***
161      * Gets the localPort attribute of the IRemoteCacheAttributes object
162      * <p>
163      * @return The localPort value
164      */
165     public int getLocalPort();
166 
167     /***
168      * Sets the localPort attribute of the IRemoteCacheAttributes object
169      * <p>
170      * @param p The new localPort value
171      */
172     public void setLocalPort( int p );
173 
174     /***
175      * Gets the clusterServers attribute of the IRemoteCacheAttributes object
176      * <p>
177      * @return The clusterServers value
178      */
179     public String getClusterServers();
180 
181     /***
182      * Sets the clusterServers attribute of the IRemoteCacheAttributes object
183      * <p>
184      * @param s The new clusterServers value
185      */
186     public void setClusterServers( String s );
187 
188     /***
189      * Gets the failoverServers attribute of the IRemoteCacheAttributes object
190      * <p>
191      * @return The failoverServers value
192      */
193     public String getFailoverServers();
194 
195     /***
196      * Sets the failoverServers attribute of the IRemoteCacheAttributes object
197      * <p>
198      * @param s The new failoverServers value
199      */
200     public void setFailoverServers( String s );
201 
202     /***
203      * Gets the removeUponRemotePut attribute of the IRemoteCacheAttributes object
204      * <p>
205      * @return The removeUponRemotePut value
206      */
207     public boolean getRemoveUponRemotePut();
208 
209     /***
210      * Sets the removeUponRemotePut attribute of the IRemoteCacheAttributes object
211      * <p>
212      * @param r The new removeUponRemotePut value
213      */
214     public void setRemoveUponRemotePut( boolean r );
215 
216     /***
217      * Gets the getOnly attribute of the IRemoteCacheAttributes object
218      * <p>
219      * @return The getOnly value
220      */
221     public boolean getGetOnly();
222 
223     /***
224      * Sets the getOnly attribute of the IRemoteCacheAttributes object
225      * <p>
226      * @param r The new getOnly value
227      */
228     public void setGetOnly( boolean r );
229 
230     /***
231      * Should cluster updates be propogated to the locals
232      * <p>
233      * @return The localClusterConsistency value
234      */
235     public boolean getLocalClusterConsistency();
236 
237     /***
238      * Should cluster updates be propogated to the locals
239      * <p>
240      * @param r The new localClusterConsistency value
241      */
242     public void setLocalClusterConsistency( boolean r );
243 
244     /***
245      * The thread pool the remote cache should use. At first this will only be for gets.
246      * <p>
247      * The default name is "remote_cache_client"
248      * <p>
249      * @return
250      */
251     public abstract String getThreadPoolName();
252 
253     /***
254      * Set the anme of the pool to use. Pools should be defined in the cache.ccf.
255      * <p>
256      * @param name
257      */
258     public abstract void setThreadPoolName( String name );
259 
260     /***
261      * -1 and 0 mean no timeout, this is the default if the timeout is -1 or 0, no threadpool will
262      * be used.
263      * <p>
264      * @return
265      */
266     public abstract int getGetTimeoutMillis();
267 
268     /***
269      * -1 means no timeout, this is the default if the timeout is -1 or 0, no threadpool will be
270      * used. If the timeout is greater than 0 a threadpool will be used for get requests.
271      * <p>
272      * @param millis
273      */
274     public abstract void setGetTimeoutMillis( int millis );
275 
276     /***
277      * This sets a general timeout on the rmi socket factory. By default the socket factory will
278      * block forever.
279      * <p>
280      * We have a default setting. The default rmi behavior should never be used.
281      * <p>
282      * @return int milliseconds
283      */
284     public abstract int getRmiSocketFactoryTimeoutMillis();
285 
286     /***
287      * This sets a general timeout on the rmi socket factory. By default the socket factory will
288      * block forever.
289      * <p>
290      * @param rmiSocketFactoryTimeoutMillis
291      */
292     public abstract void setRmiSocketFactoryTimeoutMillis( int rmiSocketFactoryTimeoutMillis );
293 
294     /***
295      * By default this option is true. If you set it to false, you will not receive updates or
296      * removes from the remote server.
297      * <p>
298      * @param receive
299      */
300     public void setReceive( boolean receive );
301 
302     /***
303      * If RECEIVE is false then the remote cache will not register a listener with the remote
304      * server. This allows you to configure a remote server as a repository from which you can get
305      * and to which you put, but from which you do not reveive any notifications. That is, you will
306      * not receive updates or removes.
307      * <p>
308      * If you set this option to false, you should set your locl memory size to 0.
309      * <p>
310      * The remote cache manager uses this value to decide whether or not to register a listener.
311      * <p>
312      * It makes no sense to configure a cluster remote cache to no receive.
313      * <p>
314      * Since a non-receiving remote cache client will not register a listener, it will not have a
315      * listener id assigned from the server. As such the remote server cannot determine if it is a
316      * cluster or a normal client. It will assume that it is a normal client.
317      * <p>
318      * @return the receive value.
319      */
320     public boolean isReceive();
321 
322     /***
323      * The number of elements the zombie queue will hold. This queue is used to store events if we
324      * loose our conenction with the server.
325      * <p>
326      * @param zombieQueueMaxSize The zombieQueueMaxSize to set.
327      */
328     public void setZombieQueueMaxSize( int zombieQueueMaxSize );
329 
330     /***
331      * The number of elements the zombie queue will hold. This queue is used to store events if we
332      * loose our conenction with the server.
333      * <p>
334      * @return Returns the zombieQueueMaxSize.
335      */
336     public int getZombieQueueMaxSize();
337 }