You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2005/11/20 10:22:57 UTC
svn commit: r345729 - in
/webservices/sandesha/trunk/src/org/apache/sandesha2: ./ client/ handlers/
storage/inmemory/ util/ workers/
Author: chamikara
Date: Sun Nov 20 01:21:42 2005
New Revision: 345729
URL: http://svn.apache.org/viewcvs?rev=345729&view=rev
Log:
Changes due to refactoring of Axis2.
Bug fixes.
Modified:
webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java
webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java Sun Nov 20 01:21:42 2005
@@ -25,7 +25,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.miheaders.RelatesTo;
+import org.apache.axis2.addressing.RelatesTo;
import org.apache.axis2.context.AbstractContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.soap.SOAPEnvelope;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java Sun Nov 20 01:21:42 2005
@@ -6,8 +6,9 @@
*/
package org.apache.sandesha2.client;
-import org.apache.axis2.clientapi.AsyncResult;
-import org.apache.axis2.clientapi.Callback;
+import org.apache.axis2.client.AsyncResult;
+import org.apache.axis2.client.Callback;
+
public class SandeshaCallback extends Callback {
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java Sun Nov 20 01:21:42 2005
@@ -19,9 +19,9 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.clientapi.CallbackReceiver;
-import org.apache.axis2.clientapi.ListenerManager;
-import org.apache.axis2.clientapi.MEPClient;
+import org.apache.axis2.client.CallbackReceiver;
+import org.apache.axis2.client.ListenerManager;
+import org.apache.axis2.client.MEPClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java Sun Nov 20 01:21:42 2005
@@ -22,6 +22,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.axis2.soap.SOAPBody;
@@ -80,11 +81,15 @@
//context.setProperty (Constants.SANDESHA_DEBUG_MODE,"on");
- Object debug = context.getProperty(Constants.SANDESHA_DEBUG_MODE);
- if (debug != null && "on".equals(debug)) {
- System.out.println("DEBUG: SandeshaGlobalInHandler got a '"
+ ServiceContext serviceContext = msgContext.getServiceContext();
+ Object debug = null;
+ if (serviceContext!=null) {
+ debug = serviceContext.getProperty(Constants.SANDESHA_DEBUG_MODE);
+ if (debug != null && "on".equals(debug)) {
+ System.out.println("DEBUG: SandeshaGlobalInHandler got a '"
+ SandeshaUtil.getMessageTypeString(rmMessageContext
.getMessageType()) + "' message.");
+ }
}
//Dropping duplicates
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Sun Nov 20 01:21:42 2005
@@ -21,6 +21,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.engine.AxisEngine;
@@ -91,11 +92,15 @@
throw new AxisFault("Cant initialize the message");
}
- Object debug = context.getProperty(Constants.SANDESHA_DEBUG_MODE);
- if (debug != null && "on".equals(debug)) {
- System.out.println("DEBUG: SandeshaInHandler got a '"
+ ServiceContext serviceContext = msgCtx.getServiceContext();
+ Object debug = null;
+ if (serviceContext!=null) {
+ debug = serviceContext.getProperty(Constants.SANDESHA_DEBUG_MODE);
+ if (debug != null && "on".equals(debug)) {
+ System.out.println("DEBUG: SandeshaInHandler got a '"
+ SandeshaUtil.getMessageTypeString(rmMsgCtx
.getMessageType()) + "' message.");
+ }
}
MsgProcessor msgProcessor = MsgProcessorFactory
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java Sun Nov 20 01:21:42 2005
@@ -20,12 +20,13 @@
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.clientapi.ListenerManager;
+import org.apache.axis2.client.ListenerManager;
import org.apache.axis2.context.AbstractContext;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.OperationContext;
import org.apache.axis2.context.OperationContextFactory;
+import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.description.ParameterImpl;
@@ -121,11 +122,15 @@
msgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE, "true");
- Object debug = context.getProperty(Constants.SANDESHA_DEBUG_MODE);
- if (debug != null && "on".equals(debug)) {
- System.out.println("DEBUG: SandeshaOutHandler got a '"
- + SandeshaUtil.getMessageTypeString(rmMsgCtx
- .getMessageType()) + "' message.");
+ ServiceContext serviceContext = msgCtx.getServiceContext();
+ Object debug = null;
+ if (serviceContext!=null) {
+ debug = serviceContext.getProperty(Constants.SANDESHA_DEBUG_MODE);
+ if (debug != null && "on".equals(debug)) {
+ System.out.println("DEBUG: SandeshaOutHandler got a '"
+ + SandeshaUtil.getMessageTypeString(rmMsgCtx
+ .getMessageType()) + "' message.");
+ }
}
//TODO recheck
@@ -243,7 +248,11 @@
"true");
seqPropMgr.insert(responseCreateSeqAdded);
- String acksTo = (String) context.getProperty(Constants.AcksTo);
+ String acksTo = null;
+ if (serviceContext!=null) {
+ acksTo = (String) serviceContext.getProperty(Constants.AcksTo);
+ }
+
if (acksTo==null)
acksTo = Constants.WSA.NS_URI_ANONYMOUS;
@@ -608,17 +617,21 @@
} else {
//client side
- Object obj = msg.getSystemContext().getProperty(
+
+ ServiceContext serviceContext = msg.getServiceContext();
+ if (serviceContext!=null) {
+ Object obj = serviceContext.getProperty(
Constants.LAST_MESSAGE);
- if (obj != null && "true".equals(obj)) {
- lastMessage = true;
- sequence.setLastMessage(new LastMessage(factory));
- //saving the last message no.
- SequencePropertyBean lastOutMsgBean = new SequencePropertyBean(
+ if (obj != null && "true".equals(obj)) {
+ lastMessage = true;
+ sequence.setLastMessage(new LastMessage(factory));
+ //saving the last message no.
+ SequencePropertyBean lastOutMsgBean = new SequencePropertyBean(
tempSequenceId,
Constants.SequenceProperties.LAST_OUT_MESSAGE,
new Long(messageNumber));
- sequencePropertyMgr.insert(lastOutMsgBean);
+ sequencePropertyMgr.insert(lastOutMsgBean);
+ }
}
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java Sun Nov 20 01:21:42 2005
@@ -111,8 +111,10 @@
Iterator iterator = table.values().iterator();
RetransmitterBean temp;
+
while (iterator.hasNext()) {
temp = (RetransmitterBean) iterator.next();
+
if (temp.isSend()) {
long timeToSend = temp.getTimeToSend();
@@ -122,43 +124,100 @@
}
}
}
-
- //temp hack for microsoft
- sort (beans);
- return sort(beans);
+// beans = sort (beans);
+// beans = reverse (beans);
+
+ return beans;
}
+ private ArrayList reverse (ArrayList beans) {
+ ArrayList newBeans = new ArrayList ();
+ int count = beans.size();
+
+
+ for (int i=count;i>0;i--) {
+ newBeans.add(beans.get((i-1)));
+ }
+
+ return newBeans;
+ }
+
+ //FIXME - not complete
+ //SENDER SORTING
+ //--------------
+ //Sender Sorting is used to arrange the messages that get sent.
+ //This sending order may get dsturbed due to network latencies.
+ //But doing the sort here, could improve the server preformance when network latencies are low (this is the common case).
+ //Sender sorting will be enabled, when invocation type is InOrder.
private ArrayList sort (ArrayList beans) {
ArrayList newBeans = new ArrayList ();
HashMap tempHash = new HashMap ();
- Iterator iter = beans.iterator();
- while (iter.hasNext()){
- RetransmitterBean bean = (RetransmitterBean) iter.next();
- if (bean.getMessageNumber()>0)
- tempHash.put(new Long (bean.getMessageNumber()),bean);
- else
+ Iterator iter1 = beans.iterator();
+ while (iter1.hasNext()) {
+ RetransmitterBean bean = (RetransmitterBean) iter1.next();
+ if (!(bean.getMessageNumber()>0)) {
newBeans.add(bean);
+ }
}
- long tempNo = 1;
- RetransmitterBean tempBean = (RetransmitterBean) tempHash.get(new Long (tempNo));
- while (tempBean!=null) {
- newBeans.add(tempBean);
- tempNo++;
- tempBean = (RetransmitterBean) tempHash.get(new Long (tempNo));
+ Iterator iter2 = beans.iterator();
+ long maxMsgNo = 0;
+ long minMsgNo = 0;
+ while (iter2.hasNext()) {
+ RetransmitterBean bean = (RetransmitterBean) iter2.next();
+
+ if (bean.getMessageNumber()>0) {
+ maxMsgNo = bean.getMessageNumber();
+ minMsgNo = bean.getMessageNumber();
+ break;
+ }
}
+ //finding Max and Min msg numbers present in the current list.
+ while (iter2.hasNext()){
+ RetransmitterBean bean = (RetransmitterBean) iter2.next();
+ long msgNo = bean.getMessageNumber();
+ if (msgNo>0) {
+ //tempHash.put(new Long (bean.getMessageNumber()),bean);
+ if (msgNo>maxMsgNo)
+ maxMsgNo = msgNo;
+
+ if (msgNo<minMsgNo)
+ minMsgNo = msgNo;
+ }
+ }
+
+ for (long msgNo=minMsgNo;msgNo<=maxMsgNo;msgNo++) {
+ ArrayList beansOfMsgNo = findBeansWithMsgNo(beans,msgNo);
+ Iterator iter = beansOfMsgNo.iterator();
+ while (iter.hasNext()) {
+
+ }
+ }
return newBeans;
}
+
+ private ArrayList findBeansWithMsgNo (ArrayList list, long msgNo) {
+ ArrayList beans = new ArrayList ();
+
+ Iterator it = list.iterator();
+ while (it.hasNext()) {
+ RetransmitterBean bean = (RetransmitterBean) it.next();
+ if (bean.getMessageNumber()==msgNo)
+ beans.add(bean);
+ }
+
+ return beans;
+ }
public boolean update(RetransmitterBean bean) {
if (!table.contains(bean))
return false;
- return table.put(bean.getMessageId(), bean) != null;
+ return true; //No need to update. Being a reference does the job:) //table.put(bean.getMessageId(), bean) != null;
}
}
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java Sun Nov 20 01:21:42 2005
@@ -157,14 +157,17 @@
CreateSequence createSequencePart = new CreateSequence(factory);
//Adding sequence offer - if present
- String offeredSequence = (String) context
+ ServiceContext serviceContext = applicationMsgContext.getServiceContext();
+ if (serviceContext!=null) {
+ String offeredSequence = (String) serviceContext
.getProperty(Constants.OFFERED_SEQUENCE_ID);
- if (offeredSequence != null && !"".equals(offeredSequence)) {
- SequenceOffer offerPart = new SequenceOffer(factory);
- Identifier identifier = new Identifier(factory);
- identifier.setIndentifer(offeredSequence);
- offerPart.setIdentifier(identifier);
- createSequencePart.setSequenceOffer(offerPart);
+ if (offeredSequence != null && !"".equals(offeredSequence)) {
+ SequenceOffer offerPart = new SequenceOffer(factory);
+ Identifier identifier = new Identifier(factory);
+ identifier.setIndentifer(offeredSequence);
+ offerPart.setIdentifier(identifier);
+ createSequencePart.setSequenceOffer(offerPart);
+ }
}
//TODO decide - where to send create seq. Acksto or replyTo
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java Sun Nov 20 01:21:42 2005
@@ -22,6 +22,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.engine.AxisEngine;
import org.apache.sandesha2.Constants;
import org.apache.sandesha2.RMMsgContext;
@@ -134,15 +135,18 @@
new AxisEngine(msgToInvoke.getSystemContext())
.receive(msgToInvoke);
- Object debug = context
- .getProperty(Constants.SANDESHA_DEBUG_MODE);
- if (debug != null && "on".equals(debug)) {
- System.out
+ ServiceContext serviceContext = msgToInvoke.getServiceContext();
+ Object debug = null;
+ if (serviceContext!=null) {
+ debug = serviceContext.getProperty(Constants.SANDESHA_DEBUG_MODE);
+ if (debug != null && "on".equals(debug)) {
+ System.out
.println("DEBUG: Invoker invoking a '"
+ SandeshaUtil
.getMessageTypeString(rmMsg
.getMessageType())
+ "' message.");
+ }
}
//deleting the message entry.
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java?rev=345729&r1=345728&r2=345729&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Sun Nov 20 01:21:42 2005
@@ -21,6 +21,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.sandesha2.Constants;
@@ -77,14 +78,17 @@
updateMessage(msgCtx);
- Object debug = context
- .getProperty(Constants.SANDESHA_DEBUG_MODE);
- if (debug != null && "on".equals(debug)) {
- System.out.println("DEBUG: Sender is sending a '"
+ ServiceContext serviceContext = msgCtx.getServiceContext();
+ Object debug = null;
+ if (serviceContext!=null) {
+ debug = serviceContext.getProperty(Constants.SANDESHA_DEBUG_MODE);
+ if (debug != null && "on".equals(debug)) {
+ System.out.println("DEBUG: Sender is sending a '"
+ SandeshaUtil
.getMessageTypeString(rmMsgCtx
.getMessageType())
+ "' message.");
+ }
}
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org