01: /*
02: Copyright (C) 2004 David Bucciarelli (davibu@interfree.it)
03:
04: This program is free software; you can redistribute it and/or
05: modify it under the terms of the GNU General Public License
06: as published by the Free Software Foundation; either version 2
07: of the License, or (at your option) any later version.
08:
09: This program is distributed in the hope that it will be useful,
10: but WITHOUT ANY WARRANTY; without even the implied warranty of
11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: GNU General Public License for more details.
13:
14: You should have received a copy of the GNU General Public License
15: along with this program; if not, write to the Free Software
16: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: */
18:
19: package org.homedns.dade.jcgrid.server;
20:
21: import java.io.*;
22: import java.util.*;
23:
24: import org.homedns.dade.jcgrid.*;
25:
26: public class GridNodeServerConfig extends GridNodeConfig implements
27: Cloneable {
28: public final static int NETWORK_TIMEOUT = 30 * 1000;
29:
30: private int maxConnections;
31: private long maxCacheSize;
32:
33: public GridNodeServerConfig(Properties prop) {
34: super (prop);
35:
36: maxConnections = Integer.parseInt(prop.getProperty(
37: "grid.server.maxconnections", "32"));
38: maxCacheSize = Long.parseLong(prop.getProperty(
39: "grid.server.cache.size", Long
40: .toString(64 * 1024 * 1024)));
41: }
42:
43: public GridNodeServerConfig() {
44: super (GridNodeConfig.TYPE_SERVER);
45:
46: maxConnections = 32;
47: maxCacheSize = 64 * 1024 * 1024;
48: }
49:
50: public Object clone() {
51: GridNodeServerConfig cfg = (GridNodeServerConfig) super .clone();
52: cfg.maxConnections = maxConnections;
53: cfg.maxCacheSize = maxCacheSize;
54:
55: return cfg;
56: }
57:
58: public Properties toProperties() {
59: Properties prop = super .toProperties();
60:
61: prop.put("grid.server.maxconnections", Integer
62: .toString(maxConnections));
63: prop.put("grid.server.cache.size", Long.toString(maxCacheSize));
64:
65: return prop;
66: }
67:
68: //------------------------------- Get & Set --------------------------------
69:
70: public int getMaxConnections() {
71: return maxConnections;
72: }
73:
74: public void setMaxConnections(int serverMaxConnections) {
75: maxConnections = serverMaxConnections;
76: }
77:
78: public long getMaxCacheSize() {
79: return maxCacheSize;
80: }
81:
82: public void setMaxCacheSize(long serverMaxCacheSize) {
83: maxCacheSize = serverMaxCacheSize;
84: }
85: }
|