You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ha...@apache.org on 2013/01/11 06:03:00 UTC

svn commit: r1431889 - in /ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime: EH_ALARM.java READWRITELOCK.java SCOPEACT.java

Author: hadrian
Date: Fri Jan 11 05:03:00 2013
New Revision: 1431889

URL: http://svn.apache.org/viewvc?rev=1431889&view=rev
Log:
ODE-979. Remove anonymous ChannelListener implementations in bpel-runtime (ongoing)

Modified:
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/READWRITELOCK.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java?rev=1431889&r1=1431888&r2=1431889&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_ALARM.java Fri Jan 11 05:03:00 2013
@@ -23,16 +23,20 @@ import org.apache.ode.bpel.explang.Evalu
 import org.apache.ode.bpel.explang.EvaluationException;
 import org.apache.ode.bpel.o.OEventHandler;
 import org.apache.ode.bpel.o.OScope;
+import org.apache.ode.bpel.runtime.channels.EventHandlerControl;
 import org.apache.ode.bpel.runtime.channels.EventHandlerControlChannel;
 import org.apache.ode.bpel.runtime.channels.EventHandlerControlChannelListener;
 import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.bpel.runtime.channels.ParentScope;
 import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
 import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
+import org.apache.ode.bpel.runtime.channels.Termination;
 import org.apache.ode.bpel.runtime.channels.TerminationChannel;
 import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
 import org.apache.ode.bpel.runtime.channels.TimerResponseChannel;
 import org.apache.ode.bpel.runtime.channels.TimerResponseChannelListener;
 import org.apache.ode.jacob.ChannelListener;
+import org.apache.ode.jacob.ReceiveProcess;
 import org.apache.ode.jacob.SynchChannel;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -210,9 +214,7 @@ class EH_ALARM extends BpelJacobRunnable
         }
 
         public void run() {
-            object(false,new ParentScopeChannelListener(_activity.parent){
-                private static final long serialVersionUID = -3357030137175178040L;
-
+            object(false,new ReceiveProcess<ParentScopeChannel, ParentScope>(_activity.parent, new ParentScope() {
                 public void compensate(OScope scope, SynchChannel ret) {
                     _psc.compensate(scope,ret);
                     instance(ACTIVE.this);
@@ -244,24 +246,24 @@ class EH_ALARM extends BpelJacobRunnable
 
                 public void cancelled() { completed(null, CompensationHandler.emptySet()); }
                 public void failure(String reason, Element data) { completed(null, CompensationHandler.emptySet()); }
-            }.or(new EventHandlerControlChannelListener(_cc) {
-                private static final long serialVersionUID = -3873619538789039424L;
-
+            }){
+                private static final long serialVersionUID = -3357030137175178040L;
+            }.or(new ReceiveProcess<EventHandlerControlChannel, EventHandlerControl>(_cc, new EventHandlerControl() {
                 public void stop() {
                     _stopped = true;
                     instance(ACTIVE.this);
                 }
-
-            }.or(new TerminationChannelListener(_tc) {
-                private static final long serialVersionUID = -4566956567870652885L;
-
+            }){
+                private static final long serialVersionUID = -3873619538789039424L;
+            }.or(new ReceiveProcess<TerminationChannel, Termination>(_tc, new Termination() {
                 public void terminate() {
                     replication(_activity.self).terminate();
                     _stopped = true;
                     instance(ACTIVE.this);
                 }
+            }){
+                private static final long serialVersionUID = -4566956567870652885L;
             })));
-
         }
     }
 }

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/READWRITELOCK.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/READWRITELOCK.java?rev=1431889&r1=1431888&r2=1431889&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/READWRITELOCK.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/READWRITELOCK.java Fri Jan 11 05:03:00 2013
@@ -22,9 +22,11 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
 
+import org.apache.ode.bpel.runtime.channels.ReadWriteLock;
 import org.apache.ode.bpel.runtime.channels.ReadWriteLockChannel;
 import org.apache.ode.bpel.runtime.channels.ReadWriteLockChannelListener;
 import org.apache.ode.jacob.JacobRunnable;
+import org.apache.ode.jacob.ReceiveProcess;
 import org.apache.ode.jacob.SynchChannel;
 
 /**
@@ -55,9 +57,7 @@ public class READWRITELOCK extends Jacob
 
     @Override
     public void run() {
-        object(new ReadWriteLockChannelListener(_self) {
-            private static final long serialVersionUID = -8644268413754259515L;
-
+        object(new ReceiveProcess<ReadWriteLockChannel, ReadWriteLock>(_self, new ReadWriteLock() {
             public void readLock(SynchChannel s) {
                 switch (_status) {
                 case UNLOCKED:
@@ -72,11 +72,9 @@ public class READWRITELOCK extends Jacob
                 case WRITELOCK:
                     _waiters.add(new Waiter(s, false));
                     break;
-
                 }
 
                 instance(READWRITELOCK.this);
-
             }
 
             public void writeLock(SynchChannel s) {
@@ -108,7 +106,7 @@ public class READWRITELOCK extends Jacob
                         _status = w.write ? Status.WRITELOCK : Status.READLOCK;
                         w.synch.ret();
 
-                        if (_status == Status.READLOCK)
+                        if (_status == Status.READLOCK) {
                             for (Iterator<Waiter> i = _waiters.iterator(); i.hasNext();) {
                                 Waiter w1 = i.next();
                                 if (w1.write)
@@ -117,12 +115,14 @@ public class READWRITELOCK extends Jacob
                                 w1.synch.ret();
                                 i.remove();
                             }
+                        }
                     }
                 }
 
                 instance(READWRITELOCK.this);
             }
-
+        }) {
+            private static final long serialVersionUID = -8644268413754259515L;
         });
     }
 
@@ -136,6 +136,4 @@ public class READWRITELOCK extends Jacob
             write = w;
         }
     }
-
-  
 }

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java?rev=1431889&r1=1431888&r2=1431889&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java Fri Jan 11 05:03:00 2013
@@ -33,6 +33,7 @@ import org.apache.ode.bpel.o.OLink;
 import org.apache.ode.bpel.o.OScope;
 import org.apache.ode.bpel.o.OScope.Variable;
 import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.bpel.runtime.channels.LinkStatus;
 import org.apache.ode.bpel.runtime.channels.LinkStatusChannel;
 import org.apache.ode.bpel.runtime.channels.LinkStatusChannelListener;
 import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
@@ -178,9 +179,7 @@ public class SCOPEACT extends ACTIVITY {
                 if (_statuses.containsKey(m.getKey()))
                     continue;
             
-                mlset.add(new LinkStatusChannelListener(m.getValue().pub) {
-                    private static final long serialVersionUID = 1568144473514091593L;
-
+                mlset.add(new ReceiveProcess<LinkStatusChannel, LinkStatus>(m.getValue().pub, new LinkStatus() {
                     public void linkStatus(boolean value) {
                         _statuses.put(m.getKey(), value);
                         if (_status != null)
@@ -190,7 +189,8 @@ public class SCOPEACT extends ACTIVITY {
                             instance(LINKSTATUSINTERCEPTOR.this);
 
                     }
-
+                }) {
+                    private static final long serialVersionUID = 1568144473514091593L;
                 });
             }
             
@@ -206,7 +206,6 @@ public class SCOPEACT extends ACTIVITY {
             return (_statuses.keySet().size() < SCOPEACT.this._self.o.outgoingLinks.size());
 
         }
-
     }