ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r691670 - in /ode/branches/APACHE_ODE_1.X: bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/
Date Wed, 03 Sep 2008 16:30:59 GMT
Author: mriou
Date: Wed Sep  3 09:30:57 2008
New Revision: 691670

URL: http://svn.apache.org/viewvc?rev=691670&view=rev
Log:
Suppression of scheduled invocation checks when response is received.

Modified:
    ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java
    ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SchedulerThread.java
    ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java

Modified: ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=691670&r1=691669&r2=691670&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
(original)
+++ ode/branches/APACHE_ODE_1.X/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
Wed Sep  3 09:30:57 2008
@@ -819,7 +819,8 @@
             event.setInMem(false);
             event.setType(WorkEvent.Type.INVOKE_CHECK);
             Date future = new Date(System.currentTimeMillis() + (180 * 1000));
-            _bpelProcess._engine._contexts.scheduler.schedulePersistedJob(event.getDetail(),
future);
+            String jobId = _bpelProcess._engine._contexts.scheduler.schedulePersistedJob(event.getDetail(),
future);
+            mex.setProperty("invokeCheckJobId", jobId);
         }
     }
 
@@ -1243,6 +1244,10 @@
     public void releasePartnerMex(String mexId) {
         MessageExchangeDAO dao = _dao.getConnection().getMessageExchange(mexId);
         dao.release();
+
+        // Canceling invocation check job
+        String jobId = dao.getProperty("invokeCheckJobId");
+        _bpelProcess._engine._contexts.scheduler.cancelJob(jobId);
     }
 
 

Modified: ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java?rev=691670&r1=691669&r2=691670&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java
(original)
+++ ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java
Wed Sep  3 09:30:57 2008
@@ -45,5 +45,13 @@
         this.transacted = transacted;
     }
 
-    
+    @Override
+    public int hashCode() {
+        return jobId.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return obj instanceof Job && jobId.equals(((Job) obj).jobId);
+    }
 }

Modified: ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SchedulerThread.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SchedulerThread.java?rev=691670&r1=691669&r2=691670&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SchedulerThread.java
(original)
+++ ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SchedulerThread.java
Wed Sep  3 09:30:57 2008
@@ -113,6 +113,21 @@
 	}
 
 	/**
+	 * Remove a job to the todo queue.
+	 *
+	 * @param job
+	 */
+	void dequeue(Task task) {
+		_lock.lock();
+		try {
+			_todo.remove(task);
+			_activity.signal();
+		} finally {
+			_lock.unlock();
+		}
+	}
+
+	/**
 	 * Get the size of the todo queue.
 	 * 
 	 * @return

Modified: ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java?rev=691670&r1=691669&r2=691670&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
(original)
+++ ode/branches/APACHE_ODE_1.X/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
Wed Sep  3 09:30:57 2008
@@ -109,7 +109,6 @@
 
     private Random _random = new Random();
 
-
     public SimpleScheduler(String nodeId, DatabaseDelegate del, Properties conf) {
         _nodeId = nodeId;
         _db = del;
@@ -146,7 +145,13 @@
     }
 
     public void cancelJob(String jobId) throws ContextException {
-        // TODO: maybe later, not really necessary.
+        _todo.dequeue(new Job(0, jobId, false, null));
+        try {
+            _db.deleteJob(jobId, _nodeId);
+        } catch (DatabaseException e) {
+            __log.debug("Job removal failed.", e);
+            throw new ContextException("Job removal failed.", e);
+        }
     }
 
     public <T> Future<T> execIsolatedTransaction(final Callable<T> transaction)
throws Exception, ContextException {



Mime
View raw message