Author: richard.opalka(a)jboss.com
Date: 2007-12-06 06:42:59 -0500 (Thu, 06 Dec 2007)
New Revision: 5199
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMMessageRetransmissionConfig.java
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelManagerImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/config/binding/OMFactoryJAXWS.java
stack/native/trunk/src/main/resources/schema/jaxws-config_2_0.xsd
stack/native/trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java
stack/native/trunk/src/test/resources/common/config/jaxws-endpoint-config.xml
stack/native/trunk/src/test/resources/jaxws/wsrm/META-INF/wsrm-jaxws-client-config.xml
Log:
making WS-RM retransmission process configurable
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java 2007-12-06
10:29:09 UTC (rev 5198)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java 2007-12-06
11:42:59 UTC (rev 5199)
@@ -84,14 +84,6 @@
private AtomicLong messageNumber = new AtomicLong();
private AtomicInteger countOfUnassignedMessagesAvailable = new AtomicInteger();
- public void unassignedMessageReceived()
- {
- // we can't use objectLock in the method - possible deadlock
- this.countOfUnassignedMessagesAvailable.addAndGet(1);
- logger.debug("Expected sequence expiration in " +
((System.currentTimeMillis() - this.creationTime) / 1000) + "seconds");
- logger.debug("Unassigned message available in callback handler");
- }
-
public RMSequenceImpl(boolean addrType, RMConfig wsrmConfig)
{
super();
@@ -126,6 +118,19 @@
}
}
+ public void unassignedMessageReceived()
+ {
+ // we can't use objectLock in the method - possible deadlock
+ this.countOfUnassignedMessagesAvailable.addAndGet(1);
+ logger.debug("Expected sequence expiration in " +
((System.currentTimeMillis() - this.creationTime) / 1000) + "seconds");
+ logger.debug("Unassigned message available in callback handler");
+ }
+
+ public final RMConfig getRMConfig()
+ {
+ return this.wsrmConfig;
+ }
+
public final Set<Long> getReceivedInboundMessages()
{
return this.receivedInboundMessages;
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java 2007-12-06
10:29:09 UTC (rev 5198)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMConfig.java 2007-12-06
11:42:59 UTC (rev 5199)
@@ -35,14 +35,22 @@
private RMDeliveryAssuranceConfig deliveryAssurance;
private RMProviderConfig provider;
private RMBackPortsServerConfig backportsServer;
+ private RMMessageRetransmissionConfig messageRetransmission;
private RMMessageStoreConfig messageStore;
private List<RMPortConfig> ports = new LinkedList<RMPortConfig>();
+ public final void setMessageRetransmission(RMMessageRetransmissionConfig
messageRetransmission)
+ {
+ this.messageRetransmission = messageRetransmission;
+ }
+
+ public final RMMessageRetransmissionConfig getMessageRetransmission()
+ {
+ return this.messageRetransmission;
+ }
+
public final void setDeliveryAssurance(RMDeliveryAssuranceConfig deliveryAssurance)
{
- if (deliveryAssurance == null)
- throw new IllegalArgumentException();
-
this.deliveryAssurance = deliveryAssurance;
}
@@ -63,9 +71,6 @@
public final void setProvider(RMProviderConfig provider)
{
- if (provider == null)
- throw new IllegalArgumentException();
-
this.provider = provider;
}
@@ -76,9 +81,6 @@
public final void setMessageStore(RMMessageStoreConfig messageStore)
{
- if (messageStore == null)
- throw new IllegalArgumentException();
-
this.messageStore = messageStore;
}
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMMessageRetransmissionConfig.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMMessageRetransmissionConfig.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMMessageRetransmissionConfig.java 2007-12-06
11:42:59 UTC (rev 5199)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.wsrm.config;
+
+/**
+ * Message retransmission configuration
+ *
+ * @author richard.opalka(a)jboss.com
+ *
+ * @since Dec 6, 2007
+ */
+public final class RMMessageRetransmissionConfig
+{
+
+ private int countOfAttempts;
+ private int retransmissionInterval;
+ private int messageTimeout;
+
+ public final int getCountOfAttempts()
+ {
+ return countOfAttempts;
+ }
+
+ public final void setCountOfAttempts(int countOfAttempts)
+ {
+ this.countOfAttempts = countOfAttempts;
+ }
+
+ public final int getRetransmissionInterval()
+ {
+ return retransmissionInterval;
+ }
+
+ public final void setRetransmissionInterval(int retransmissionInterval)
+ {
+ this.retransmissionInterval = retransmissionInterval;
+ }
+
+ public final int getMessageTimeout()
+ {
+ return messageTimeout;
+ }
+
+ public final void setMessageTimeout(int messageTimeout)
+ {
+ this.messageTimeout = messageTimeout;
+ }
+
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/config/RMMessageRetransmissionConfig.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelManagerImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelManagerImpl.java 2007-12-06
10:29:09 UTC (rev 5198)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelManagerImpl.java 2007-12-06
11:42:59 UTC (rev 5199)
@@ -37,6 +37,7 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.transport.http.HTTPMetadataConstants;
import org.jboss.ws.extensions.wsrm.api.RMException;
+import org.jboss.ws.extensions.wsrm.config.RMMessageRetransmissionConfig;
/**
* WS-RM channel manager ensures message reliable delivery according to sequence
retransmission configuration
@@ -51,8 +52,6 @@
private static final Logger logger = Logger.getLogger(RMChannelManagerImpl.class);
private static RMChannelManager instance = new RMChannelManagerImpl();
private static final ExecutorService rmChannelPool = Executors.newFixedThreadPool(5,
new RMThreadFactory());
- private static final int countOfAttempts = 100;
- private static final int timeToWait = 3;
private static final class RMThreadFactory implements ThreadFactory
{
@@ -89,6 +88,13 @@
public final RMMessage send(RMMessage request) throws Throwable
{
+ RMMessageRetransmissionConfig qos =
RMTransportHelper.getSequence(request).getRMConfig().getMessageRetransmission();
+ if (qos == null)
+ throw new RMException("User must specify message retransmission
configuration in JAX-WS WS-RM config");
+
+ int countOfAttempts = qos.getCountOfAttempts();
+ int inactivityTimeout = qos.getMessageTimeout();
+ int retransmissionInterval = qos.getRetransmissionInterval();
RMChannelResponse result = null;
long startTime = 0L;
long endTime = 0L;
@@ -101,7 +107,7 @@
try
{
startTime = System.currentTimeMillis();
- result = futureResult.get(timeToWait, TimeUnit.SECONDS);
+ result = futureResult.get(inactivityTimeout, TimeUnit.SECONDS);
if (result != null)
{
Throwable t = result.getFault();
@@ -127,13 +133,28 @@
logger.debug("Response message received in " + (endTime -
startTime) + " miliseconds");
break;
}
- Thread.sleep(timeToWait * 1000);
+ try
+ {
+ Thread.sleep(retransmissionInterval * 1000);
+ }
+ catch (InterruptedException ie)
+ {
+ logger.warn(ie.getMessage(), ie);
+ }
}
}
catch (TimeoutException te)
{
endTime = System.currentTimeMillis();
logger.warn("Timeout - response message not received in " +
(endTime - startTime) + " miliseconds");
+ try
+ {
+ Thread.sleep(retransmissionInterval * 1000);
+ }
+ catch (InterruptedException ie)
+ {
+ logger.warn(ie.getMessage(), ie);
+ }
}
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-12-06
10:29:09 UTC (rev 5198)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-12-06
11:42:59 UTC (rev 5199)
@@ -115,8 +115,7 @@
private void setupRMOperations(EndpointMetaData endpointMD)
{
- String rmSpecVersion =
endpointMD.getConfig().getRMMetaData().getProvider().getSpecVersion();
- RMProvider rmProvider = RMProvider.getInstance(rmSpecVersion);
+ RMProvider rmProvider = RMProvider.get();
// register createSequence method
QName createSequenceQName = rmProvider.getConstants().getCreateSequenceQName();
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/config/binding/OMFactoryJAXWS.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/config/binding/OMFactoryJAXWS.java 2007-12-06
10:29:09 UTC (rev 5198)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/config/binding/OMFactoryJAXWS.java 2007-12-06
11:42:59 UTC (rev 5199)
@@ -40,6 +40,7 @@
import org.jboss.ws.extensions.wsrm.RMDeliveryAssuranceFactory;
import org.jboss.ws.extensions.wsrm.config.RMBackPortsServerConfig;
import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig;
+import org.jboss.ws.extensions.wsrm.config.RMMessageRetransmissionConfig;
import org.jboss.ws.extensions.wsrm.config.RMMessageStoreConfig;
import org.jboss.ws.extensions.wsrm.config.RMConfig;
import org.jboss.ws.extensions.wsrm.config.RMPortConfig;
@@ -153,6 +154,27 @@
wsrmConfig.setDeliveryAssurance(deliveryAssurance);
return deliveryAssurance;
}
+ if (localName.equals("message-retransmission"))
+ {
+ int interval = 0, attempts = 0, timeout=0;
+ for (int i = 0; i < countOfAttributes; i++)
+ {
+ String attrLocalName = attrs.getLocalName(i);
+ if (attrLocalName.equals("interval"))
+ interval = Integer.valueOf(attrs.getValue(i));
+ if (attrLocalName.equals("attempts"))
+ attempts = Integer.valueOf(attrs.getValue(i));
+ if (attrLocalName.equals("timeout"))
+ timeout = Integer.valueOf(attrs.getValue(i));
+ }
+
+ RMMessageRetransmissionConfig retransmissionConfig = new
RMMessageRetransmissionConfig();
+ retransmissionConfig.setCountOfAttempts(attempts);
+ retransmissionConfig.setRetransmissionInterval(interval);
+ retransmissionConfig.setMessageTimeout(timeout);
+ wsrmConfig.setMessageRetransmission(retransmissionConfig);
+ return retransmissionConfig;
+ }
if (localName.equals("backports-server"))
{
String host = null, port = null;
Modified: stack/native/trunk/src/main/resources/schema/jaxws-config_2_0.xsd
===================================================================
--- stack/native/trunk/src/main/resources/schema/jaxws-config_2_0.xsd 2007-12-06 10:29:09
UTC (rev 5198)
+++ stack/native/trunk/src/main/resources/schema/jaxws-config_2_0.xsd 2007-12-06 11:42:59
UTC (rev 5199)
@@ -71,7 +71,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
- <xsd:element name="backports-server"
type="tns:backportsServerType" minOccurs="0"
maxOccurs="1">
+ <xsd:element name="backports-server"
type="tns:backportsServerType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Backports server configuration to be used for addressable clients.
@@ -79,14 +79,21 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
- <xsd:element name="provider" type="tns:providerType">
+ <xsd:element name="message-retransmission"
type="tns:messageRetransmissionType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
+ Message retransmission allow users to configure the QoS of WS-RM.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="provider" type="tns:providerType"
minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
WS-RM specification version to be used for reliable messaging.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
- <xsd:element name="message-store"
type="tns:msgStoreType">
+ <xsd:element name="message-store" type="tns:msgStoreType"
minOccurs="0">
<xsd:annotation>
<xsd:documentation>
WS-RM message store to be used for reliable messaging.
@@ -102,6 +109,29 @@
</xsd:element>
</xsd:sequence>
</xsd:complexType>
+ <xsd:complexType name="messageRetransmissionType">
+ <xsd:attribute name="interval" type="xsd:int"
use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Message retransmission interval (in seconds)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="attempts" type="xsd:int"
use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Maximum count of message retransmission attempts.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="timeout" type="xsd:int"
use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Maximum count of seconds to wait for response.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
<xsd:complexType name="backportsServerType">
<xsd:attribute name="host" type="xsd:string"
use="optional">
<xsd:annotation>
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java 2007-12-06
10:29:09 UTC (rev 5198)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/common/config/ConfigFactoryTestCase.java 2007-12-06
11:42:59 UTC (rev 5199)
@@ -28,6 +28,7 @@
import org.jboss.ws.extensions.wsrm.config.RMBackPortsServerConfig;
import org.jboss.ws.extensions.wsrm.config.RMDeliveryAssuranceConfig;
+import org.jboss.ws.extensions.wsrm.config.RMMessageRetransmissionConfig;
import org.jboss.ws.extensions.wsrm.config.RMMessageStoreConfig;
import org.jboss.ws.extensions.wsrm.config.RMConfig;
import org.jboss.ws.extensions.wsrm.config.RMPortConfig;
@@ -158,5 +159,9 @@
RMBackPortsServerConfig backportsServer = wsrmConfig.getBackPortsServer();
assertEquals(backportsServer.getHost(), "realhostname.realdomain");
assertEquals(backportsServer.getPort(), "9999");
+ RMMessageRetransmissionConfig messageRetransmission =
wsrmConfig.getMessageRetransmission();
+ assertEquals(messageRetransmission.getCountOfAttempts(), 50);
+ assertEquals(messageRetransmission.getRetransmissionInterval(), 10);
+ assertEquals(messageRetransmission.getMessageTimeout(), 3);
}
}
Modified: stack/native/trunk/src/test/resources/common/config/jaxws-endpoint-config.xml
===================================================================
---
stack/native/trunk/src/test/resources/common/config/jaxws-endpoint-config.xml 2007-12-06
10:29:09 UTC (rev 5198)
+++
stack/native/trunk/src/test/resources/common/config/jaxws-endpoint-config.xml 2007-12-06
11:42:59 UTC (rev 5199)
@@ -47,6 +47,7 @@
<reliable-messaging>
<delivery-assurance inOrder="true"
quality="AtLeastOnce"/>
<backports-server host="realhostname.realdomain"
port="9999"/>
+ <message-retransmission attempts="50" interval="10"
timeout="3"/>
<provider
specVersion="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
<message-store
Modified:
stack/native/trunk/src/test/resources/jaxws/wsrm/META-INF/wsrm-jaxws-client-config.xml
===================================================================
---
stack/native/trunk/src/test/resources/jaxws/wsrm/META-INF/wsrm-jaxws-client-config.xml 2007-12-06
10:29:09 UTC (rev 5198)
+++
stack/native/trunk/src/test/resources/jaxws/wsrm/META-INF/wsrm-jaxws-client-config.xml 2007-12-06
11:42:59 UTC (rev 5199)
@@ -9,12 +9,8 @@
<client-config>
<config-name>Standard WSRM Client</config-name>
<reliable-messaging>
- <delivery-assurance inOrder="true"
quality="AtLeastOnce"/>
<backports-server port="7777"/>
- <provider
specVersion="http://docs.oasis-open.org/ws-rx/wsrm/200702"/>
- <message-store id="wsrmStoreId"
class="custom.MessageStoreImpl">
- <config-file>META-INF/config.xml</config-file>
- </message-store>
+ <message-retransmission attempts="50" interval="10"
timeout="3"/>
</reliable-messaging>
<post-handler-chains>
<javaee:handler-chain>