Author: richard.opalka(a)jboss.com
Date: 2007-12-03 11:20:00 -0500 (Mon, 03 Dec 2007)
New Revision: 5164
Removed:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/api/RMSequenceType.java
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceManager.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelRequest.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractOneWayTest.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractReqResTest.java
Log:
fix Hudson regression
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2007-12-03
14:40:19 UTC (rev 5163)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/CommonClient.java 2007-12-03
16:20:00 UTC (rev 5164)
@@ -355,10 +355,14 @@
// Get the return object
Object retObj = null;
boolean isWsrmMessage = msgContext.get(RMConstant.REQUEST_CONTEXT) != null;
- Boolean wsrmOneWay = (Boolean)((Map<String,
Object>)msgContext.get(RMConstant.REQUEST_CONTEXT)).get(RMConstant.ONE_WAY_OPERATION);
- wsrmOneWay = wsrmOneWay == null ? Boolean.FALSE : wsrmOneWay.booleanValue();
- if ((oneway == false && handlerPass) || (wsrmOneWay == false))
+ boolean wsrmOneWay = false;
+ if (isWsrmMessage)
{
+ Boolean temp = (Boolean)((Map<String,
Object>)msgContext.get(RMConstant.REQUEST_CONTEXT)).get(RMConstant.ONE_WAY_OPERATION);
+ wsrmOneWay = (temp == null) ? Boolean.FALSE : temp.booleanValue();
+ }
+ if ((oneway == false && handlerPass) || (isWsrmMessage &&
(wsrmOneWay == false)))
+ {
// Verify
if (binding instanceof CommonSOAPBinding)
((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
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-03
14:40:19 UTC (rev 5163)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceImpl.java 2007-12-03
16:20:00 UTC (rev 5164)
@@ -31,6 +31,7 @@
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
@@ -81,7 +82,7 @@
private boolean terminated;
private boolean discarded;
private boolean isFinal;
- private boolean inboundMessageAckRequested;
+ private AtomicBoolean inboundMessageAckRequested = new AtomicBoolean();
private AtomicLong messageNumber = new AtomicLong();
private final Object lock = new Object();
private AtomicInteger countOfUnassignedMessagesAvailable = new AtomicInteger();
@@ -139,19 +140,13 @@
public final void ackRequested(boolean requested)
{
- synchronized (lock)
- {
- this.inboundMessageAckRequested = requested;
- logger.debug("Inbound Sequence: " + this.incomingSequenceId + ",
ack requested. Messages in the queue: " + this.receivedInboundMessages);
- }
+ this.inboundMessageAckRequested.set(requested);
+ logger.debug("Inbound Sequence: " + this.incomingSequenceId + ", ack
requested. Messages in the queue: " + this.receivedInboundMessages);
}
public final boolean isAckRequested()
{
- synchronized (lock)
- {
- return this.inboundMessageAckRequested;
- }
+ return this.inboundMessageAckRequested.get();
}
public final void addReceivedInboundMessage(long messageId)
@@ -309,7 +304,6 @@
// set up method invocation context
requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
props);
requestContext.put(RMConstant.REQUEST_CONTEXT, rmRequestContext);
- requestContext.put(RMConstant.REQUEST_CONTEXT, rmRequestContext);
// call stub method
this.client.invoke(operationQName, new Object[] {},
client.getBindingProvider().getResponseContext());
//RMSequenceManager.getInstance().unregister(this); // TODO: each sequence will
be unregistered by sequence manager
@@ -337,7 +331,8 @@
logger.warn(ie.getMessage(), ie);
}
}
- }*/
+ }
+ */
Map<String, Object> wsrmReqCtx = new HashMap<String, Object>();
wsrmReqCtx.put(RMConstant.ONE_WAY_OPERATION, false);
this.getBindingProvider().getRequestContext().put(RMConstant.REQUEST_CONTEXT,
wsrmReqCtx);
@@ -347,6 +342,7 @@
public final void sendTerminateMessage()
{
sendMessage(RMConstant.TERMINATE_SEQUENCE_WSA_ACTION,
wsrmConstants.getTerminateSequenceQName());
+ RMSequenceManager.getInstance().unregister(this);
}
public final void sendSequenceAcknowledgementMessage()
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceManager.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceManager.java 2007-12-03
14:40:19 UTC (rev 5163)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceManager.java 2007-12-03
16:20:00 UTC (rev 5164)
@@ -25,6 +25,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -45,7 +46,7 @@
private static final Lock classLock = new ReentrantLock();
private final Object instanceLock = new Object();
private final List<RMSequenceImpl> sequences = new
LinkedList<RMSequenceImpl>();
- private boolean destroyed;
+ private AtomicBoolean destroyed = new AtomicBoolean();
private RMSequenceManager()
{
@@ -91,36 +92,36 @@
public void run()
{
- synchronized (instanceLock)
+ while (destroyed.get() == false)
{
- while (this.destroyed == false)
+ synchronized (instanceLock)
{
for (RMSequenceImpl sequence : sequences)
{
logger.debug("Processing outbound sequence " +
sequence.getOutboundId());
+ /*
if (sequence.isAckRequested())
{
- /*
logger.debug("Sending ack for inbound sequence " +
sequence.getInboundId());
Map<String, Object> wsrmReqCtx = new HashMap<String,
Object>();
wsrmReqCtx.put(RMConstant.ONE_WAY_OPERATION, true);
sequence.getBindingProvider().getRequestContext().put(RMConstant.REQUEST_CONTEXT,
wsrmReqCtx);
sequence.sendSequenceAcknowledgementMessage();
sequence.ackRequested(false);
- */
}
+ */
}
+ }
- try
- {
- logger.debug("sleeping for 10 miliseconds");
- instanceLock.wait(10);
- }
- catch (InterruptedException ie)
- {
- logger.warn(ie);
- }
+ try
+ {
+ logger.debug("sleeping for 10 miliseconds");
+ Thread.sleep(10);
}
+ catch (InterruptedException ie)
+ {
+ logger.warn(ie);
+ }
}
}
@@ -130,15 +131,12 @@
try
{
instance = null;
+ this.destroyed.set(true);
+ logger.debug("destroyed");
}
finally
{
classLock.unlock();
}
- synchronized (this.instanceLock)
- {
- this.destroyed = true;
- logger.debug("destroyed");
- }
}
}
Deleted:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/api/RMSequenceType.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/api/RMSequenceType.java 2007-12-03
14:40:19 UTC (rev 5163)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/api/RMSequenceType.java 2007-12-03
16:20:00 UTC (rev 5164)
@@ -1,41 +0,0 @@
-/*
- * 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.api;
-
-/**
- * Sequence type
- *
- * @author richard.opalka(a)jboss.com
- *
- * @since Nov 28, 2007
- */
-public enum RMSequenceType
-{
- /**
- * Simplex sequences are used for one way message exchange patterns only
- */
- SIMPLEX,
- /**
- * Duplex sequences are used for both one way and request replay exchange patterns
- */
- DUPLEX
-}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelRequest.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelRequest.java 2007-12-03
14:40:19 UTC (rev 5163)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelRequest.java 2007-12-03
16:20:00 UTC (rev 5164)
@@ -83,14 +83,14 @@
callbackHandler.addUnassignedMessageListener(sequence);
}
}
- boolean oneWay = (backPort != null); // TODO: backport support
+ boolean oneWay = RMTransportHelper.isOneWayOperation(rmRequest);
Client client = new Client(locator, JBOSSWS_SUBSYSTEM,
rmRequest.getMetadata().getContext(REMOTING_CONFIGURATION_CONTEXT));
client.connect();
client.setMarshaller(RMMarshaller.getInstance());
- if (!oneWay)
+ if ((false == oneWay) && (null == backPort))
client.setUnMarshaller(RMUnMarshaller.getInstance());
Map<String, Object> remotingInvocationContext =
rmRequest.getMetadata().getContext(REMOTING_INVOCATION_CONTEXT);
@@ -101,7 +101,7 @@
MessageTrace.traceMessage("Outgoing RM Request Message",
rmRequest.getPayload());
RMMessage rmResponse = null;
- if (oneWay)
+ if (oneWay && (null == backPort))
{
client.invokeOneway(rmRequest.getPayload(), remotingInvocationContext,
false);
}
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractOneWayTest.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractOneWayTest.java 2007-12-03
14:40:19 UTC (rev 5163)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractOneWayTest.java 2007-12-03
16:20:00 UTC (rev 5164)
@@ -36,7 +36,6 @@
import org.jboss.ws.extensions.wsrm.api.RMAddressingType;
import org.jboss.ws.extensions.wsrm.api.RMProvider;
import org.jboss.ws.extensions.wsrm.api.RMSequence;
-import org.jboss.ws.extensions.wsrm.api.RMSequenceType;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.test.ws.jaxws.wsrm.OneWayServiceIface;
@@ -90,7 +89,7 @@
if (emulatorOn)
{
RMProvider wsrmProvider = (RMProvider)proxy;
- sequence = wsrmProvider.createSequence(getAddressingType(),
RMSequenceType.SIMPLEX);
+ sequence = wsrmProvider.createSequence(getAddressingType());
System.out.println("Created sequence with id=" +
sequence.getOutboundId());
}
setAddrProps(proxy, "http://useless/action1", serviceURL);
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractReqResTest.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractReqResTest.java 2007-12-03
14:40:19 UTC (rev 5163)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractReqResTest.java 2007-12-03
16:20:00 UTC (rev 5164)
@@ -42,7 +42,6 @@
import org.jboss.ws.extensions.wsrm.api.RMAddressingType;
import org.jboss.ws.extensions.wsrm.api.RMProvider;
import org.jboss.ws.extensions.wsrm.api.RMSequence;
-import org.jboss.ws.extensions.wsrm.api.RMSequenceType;
/**
* Reliable JBoss WebService client invoking req/res methods
@@ -172,7 +171,7 @@
if (emulatorOn)
{
RMProvider wsrmProvider = (RMProvider)proxyObject;
- sequence = wsrmProvider.createSequence(getAddressingType(),
RMSequenceType.DUPLEX);
+ sequence = wsrmProvider.createSequence(getAddressingType());
System.out.println("Created sequence with outbound id=" +
sequence.getOutboundId());
System.out.println("Created sequence with inbound id=" +
sequence.getInboundId());
}