Author: arnaudsimon
Date: Mon May 5 02:59:01 2008
New Revision: 653399
URL: http://svn.apache.org/viewvc?rev=653399&view=rev
Log:
QPID-1018: added org.apache.qpid.client.configuration and add io props
Added:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
(contents, props changed)
- copied, changed from r653308,
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/ClientProperties.java
Removed:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/ClientProperties.java
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=653399&r1=653398&r2=653399&view=diff
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
Mon May 5 02:59:01 2008
@@ -23,19 +23,13 @@
import org.apache.qpid.AMQConnectionFailureException;
import org.apache.qpid.AMQException;
import org.apache.qpid.AMQProtocolException;
-import org.apache.qpid.AMQUndeliveredException;
import org.apache.qpid.AMQUnresolvedAddressException;
import org.apache.qpid.client.failover.FailoverException;
-import org.apache.qpid.client.failover.FailoverProtectedOperation;
-import org.apache.qpid.client.failover.FailoverRetrySupport;
import org.apache.qpid.client.protocol.AMQProtocolHandler;
-import org.apache.qpid.client.state.AMQState;
-import org.apache.qpid.client.state.AMQStateManager;
-import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.client.configuration.ClientProperties;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.*;
import org.apache.qpid.jms.BrokerDetails;
-import org.apache.qpid.jms.ChannelLimitReachedException;
import org.apache.qpid.jms.Connection;
import org.apache.qpid.jms.ConnectionListener;
import org.apache.qpid.jms.ConnectionURL;
@@ -355,7 +349,8 @@
else
{
// use the defaul value set for all connections
- _maxPrefetch = ClientProperties.MAX_PREFETCH;
+ _maxPrefetch =
Long.valueOf(System.getProperties().getProperty(ClientProperties.MAX_PREFETCH_PROP_NAME,
+ ClientProperties.MAX_PREFETCH_DEFAULT));
}
if (connectionURL.getOption(ConnectionURL.AMQ_SYNC_PERSISTENCE) !=
null)
@@ -365,7 +360,7 @@
else
{
// use the defaul value set for all connections
- _syncPersistence = ClientProperties.SYNC_PERSISTENT;
+ _syncPersistence =
Boolean.getBoolean(ClientProperties.SYNC_PERSISTENT_PROP_NAME);
}
_failoverPolicy = new FailoverPolicy(connectionURL);
Copied:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
(from r653308,
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/ClientProperties.java)
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java?p2=incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java&p1=incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/ClientProperties.java&r1=653308&r2=653399&rev=653399&view=diff
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/ClientProperties.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
Mon May 5 02:59:01 2008
@@ -16,7 +16,7 @@
* under the License.
*/
-package org.apache.qpid.client;
+package org.apache.qpid.client.configuration;
/**
* This class centralized the Qpid client properties.
@@ -25,12 +25,46 @@
{
/**
+ * This property is currently used within the 0.10 code path only
* The maximum number of pre-fetched messages per destination
+ * This property is used for all the connection unless it is overwritten
by the connectionURL
+ * type: long
*/
- public static long MAX_PREFETCH =
Long.valueOf(System.getProperties().getProperty("max_prefetch", "1000"));
+ public static final String MAX_PREFETCH_PROP_NAME = "max_prefetch";
+ public static final String MAX_PREFETCH_DEFAULT = "1000";
/**
- * When true a sync command is sent after every persistent messages.
+ * When true a sync command is sent after every persistent messages.
+ * type: boolean
*/
- public static boolean SYNC_PERSISTENT =
Boolean.getBoolean("sync_persistence");
+ public static final String SYNC_PERSISTENT_PROP_NAME = "sync_persistence";
+
+ /**
+ * ==========================================================
+ * Those properties are used when the io size should be bounded
+ * ==========================================================
+ */
+
+ /**
+ * When set to true the io layer throttle down producers and consumers
+ * when written or read messages are accumulating and exceeding a certain
size.
+ * This is especially useful when a the producer rate is greater than the
network
+ * speed.
+ * type: boolean
+ */
+ public static final String PROTECTIO_PROP_NAME = "protectio";
+
+ //=== The following properties are only used when the previous one is true.
+ /**
+ * Max size of read messages that can be stored within the MINA layer
+ * type: int
+ */
+ public static final String READ_BUFFER_LIMIT_PROP_NAME =
"qpid.read.buffer.limit";
+ public static final String READ_BUFFER_LIMIT_DEFAULT = "262144";
+ /**
+ * Max size of written messages that can be stored within the MINA layer
+ * type: int
+ */
+ public static final String WRITE_BUFFER_LIMIT_PROP_NAME =
"qpid.read.buffer.limit";
+ public static final String WRITE_BUFFER_LIMIT_DEFAULT = "262144";
}
Propchange:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java?rev=653399&r1=653398&r2=653399&view=diff
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
Mon May 5 02:59:01 2008
@@ -37,6 +37,7 @@
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.client.SSLConfiguration;
+import org.apache.qpid.client.configuration.ClientProperties;
import org.apache.qpid.client.failover.FailoverException;
import org.apache.qpid.client.failover.FailoverHandler;
import org.apache.qpid.client.failover.FailoverState;
@@ -160,11 +161,6 @@
/** Defines the default timeout to use for synchronous protocol commands.
*/
private final long DEFAULT_SYNC_TIMEOUT = 1000 * 30;
- /** Default buffer size for pending messages reads */
- private static final String DEFAULT_READ_BUFFER_LIMIT = "262144";
-
- /** Default buffer size for pending messages writes */
- private static final String DEFAULT_WRITE_BUFFER_LIMIT = "262144";
/**
* Creates a new protocol handler, associated with the specified client
connection instance.
@@ -222,7 +218,7 @@
_logger.error(e.getMessage(), e);
}
- if (Boolean.getBoolean("protectio"))
+ if (Boolean.getBoolean(ClientProperties.PROTECTIO_PROP_NAME))
{
try
{
@@ -232,11 +228,13 @@
session.getFilterChain().addLast("tempExecutorFilterForFilterBuilder", new
ExecutorFilter());
ReadThrottleFilterBuilder readfilter = new
ReadThrottleFilterBuilder();
-
readfilter.setMaximumConnectionBufferSize(Integer.parseInt(System.getProperty("qpid.read.buffer.limit",
DEFAULT_READ_BUFFER_LIMIT)));
+
readfilter.setMaximumConnectionBufferSize(Integer.parseInt(System.getProperty(
+ ClientProperties.READ_BUFFER_LIMIT_PROP_NAME,
ClientProperties.READ_BUFFER_LIMIT_DEFAULT)));
readfilter.attach(chain);
WriteBufferLimitFilterBuilder writefilter = new
WriteBufferLimitFilterBuilder();
-
writefilter.setMaximumConnectionBufferSize(Integer.parseInt(System.getProperty("qpid.write.buffer.limit",
DEFAULT_WRITE_BUFFER_LIMIT)));
+
writefilter.setMaximumConnectionBufferSize(Integer.parseInt(System.getProperty(
+ ClientProperties.WRITE_BUFFER_LIMIT_PROP_NAME,
ClientProperties.WRITE_BUFFER_LIMIT_DEFAULT)));
writefilter.attach(chain);
session.getFilterChain().remove("tempExecutorFilterForFilterBuilder");