001: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
002:
003: This file is part of the db4o open source object database.
004:
005: db4o is free software; you can redistribute it and/or modify it under
006: the terms of version 2 of the GNU General Public License as published
007: by the Free Software Foundation and as clarified by db4objects' GPL
008: interpretation policy, available at
009: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
010: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
011: Suite 350, San Mateo, CA 94403, USA.
012:
013: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
014: WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: for more details.
017:
018: You should have received a copy of the GNU General Public License along
019: with this program; if not, write to the Free Software Foundation, Inc.,
020: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
021: package com.db4o.config;
022:
023: import com.db4o.messaging.MessageRecipient;
024: import com.db4o.messaging.MessageSender;
025:
026: /**
027: * Client/Server configuration interface.
028: */
029: public interface ClientServerConfiguration {
030: /**
031: * Sets the number of IDs to be pre-allocated in the database for new
032: * objects created on the client.
033: * This setting should be used on the client side. In embedded mode this setting
034: * has no effect.
035: * @param prefetchIDCount
036: * The number of IDs to be prefetched
037: */
038: void prefetchIDCount(int prefetchIDCount);
039:
040: /**
041: * Sets the number of objects to be prefetched for an ObjectSet in C/S mode.
042: * This setting should be used on the server side. In embedded mode this setting
043: * has no effect.
044: * @param prefetchObjectCount
045: * The number of objects to be prefetched
046: */
047: void prefetchObjectCount(int prefetchObjectCount);
048:
049: /**
050: * sets the MessageRecipient to receive Client Server messages. <br>
051: * <br>
052: * This setting should be used on the server side.<br><br>
053: * @param messageRecipient
054: * the MessageRecipient to be used
055: */
056: public void setMessageRecipient(MessageRecipient messageRecipient);
057:
058: /**
059: * returns the MessageSender for this Configuration context.
060: * This setting should be used on the client side.
061: * @return MessageSender
062: */
063: public MessageSender getMessageSender();
064:
065: /**
066: * configures the time a client waits for a message response
067: * from the server. <br>
068: * <br>
069: * Default value: 600000ms (10 minutes)<br>
070: * <br>
071: * It is recommended to use the same values for {@link #timeoutClientSocket(int)}
072: * and {@link #timeoutServerSocket(int)}.
073: * <br>
074: * This setting can be used on both client and server.<br><br>
075: * @param milliseconds
076: * time in milliseconds
077: */
078: public void timeoutClientSocket(int milliseconds);
079:
080: /**
081: * configures the timeout of the serverside socket. <br>
082: * <br>
083: * The serverside handler waits for messages to arrive from the client.
084: * If no more messages arrive for the duration configured in this
085: * setting, the client will be disconnected.
086: * <br>
087: * Clients send PING messages to the server at an interval of
088: * Math.min(timeoutClientSocket(), timeoutServerSocket()) / 2
089: * and the server will respond to keep connections alive.
090: * <br>
091: * Decrease this setting if you want clients to disconnect faster.
092: * <br>
093: * Increase this setting if you have a large number of clients and long
094: * running queries and you are getting disconnected clients that you
095: * would like to wait even longer for a response from the server.
096: * <br>
097: * Default value: 600000ms (10 minutes)<br>
098: * <br>
099: * It is recommended to use the same values for {@link #timeoutClientSocket(int)}
100: * and {@link #timeoutServerSocket(int)}.
101: * <br>
102: * This setting can be used on both client and server.<br><br>
103: * @param milliseconds
104: * time in milliseconds
105: */
106: public void timeoutServerSocket(int milliseconds);
107:
108: /**
109: * configures the client messaging system to be single threaded
110: * or multithreaded.
111: * <br><br>Recommended settings:<br>
112: * - <code>true</code> for low resource systems.<br>
113: * - <code>false</code> for best asynchronous performance and fast
114: * GUI response.
115: * <br><br>Default value:<br>
116: * - .NET Compactframework: <code>true</code><br>
117: * - all other platforms: <code>false</code><br><br>
118: * This setting can be used on both client and server.<br><br>
119: * @param flag the desired setting
120: */
121: public void singleThreadedClient(boolean flag);
122:
123: /**
124: * Configures to batch messages between client and server. By default, batch
125: * mode is enabled.<br><br>
126: * This setting can be used on both client and server.<br><br>
127: * @param flag
128: * false, to turn message batching off.
129: */
130: public void batchMessages(boolean flag);
131:
132: /**
133: * Configures the maximum memory buffer size for batched message. If the
134: * size of batched messages is greater than <code>maxSize</code>, batched
135: * messages will be sent to server.<br><br>
136: * This setting can be used on both client and server.<br><br>
137: * @param maxSize
138: */
139: public void maxBatchQueueSize(int maxSize);
140:
141: }
|