ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mckie...@apache.org
Subject svn commit: r576399 - in /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers: Invoker.java WorkerLock.java
Date Mon, 17 Sep 2007 12:31:23 GMT
Author: mckierna
Date: Mon Sep 17 05:31:22 2007
New Revision: 576399

URL: http://svn.apache.org/viewvc?rev=576399&view=rev
Log:
potential NPE in populateRMMsgContext

Modified:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/Invoker.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/WorkerLock.java

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/Invoker.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/Invoker.java?rev=576399&r1=576398&r2=576399&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/Invoker.java
(original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/Invoker.java
Mon Sep 17 05:31:22 2007
@@ -120,11 +120,15 @@
 							work = contextMgr.wrapWithContext(work, invoker.getContext());
 						}
 						
-						threadPool.execute(work);
-					
-						//adding the workId to the lock after assigning it to a thread makes sure 
-						//that all the workIds in the Lock are handled by threads.
-			            getWorkerLock().addWork(workId, worker);
+						try {
+							// Try and set the lock up before we start the thread, but roll it back
+							// if we hit any problems
+							if(worker.getLock().addWork(workId, worker)){
+								threadPool.execute(work);
+							}
+						} catch(Exception e) {
+							worker.getLock().removeWork(workId);
+						}
 
 						long msgNumber = invoker.getMsgNo();
 						//if necessary, update the "next message number" bean under this transaction

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/WorkerLock.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/WorkerLock.java?rev=576399&r1=576398&r2=576399&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/WorkerLock.java
(original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/WorkerLock.java
Mon Sep 17 05:31:22 2007
@@ -26,9 +26,10 @@
 
 	}
 	
-  public synchronized void addWork (String work, Object owner) {
-    if(locks.containsKey(work)) return;
+  public synchronized boolean addWork (String work, Object owner) {
+    if(locks.containsKey(work)) return false;
     locks.put(work, owner);
+	return true;
   }
 	
 	public synchronized void removeWork (String work) {



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Mime
View raw message