You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ms...@apache.org on 2007/02/08 23:57:28 UTC
svn commit: r505077 - in
/incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz:
JobStoreJTA.java QuartzSchedulerImpl.java
Author: mszefler
Date: Thu Feb 8 14:57:27 2007
New Revision: 505077
URL: http://svn.apache.org/viewvc?view=rev&rev=505077
Log:
Merged dev branch, allow setting of clustered property.
Modified:
incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/JobStoreJTA.java
incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java
Modified: incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/JobStoreJTA.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/JobStoreJTA.java?view=diff&rev=505077&r1=505076&r2=505077
==============================================================================
--- incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/JobStoreJTA.java (original)
+++ incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/JobStoreJTA.java Thu Feb 8 14:57:27 2007
@@ -53,7 +53,7 @@
private TransactionManager _txm;
// Quartz in-mem semaphore has a bug, ours is identical but fixes it
- private Semaphore _customerLockHandler = null;
+ private Semaphore _lockHandler = null;
protected boolean setTxIsolationLevelReadCommitted = true;
@@ -80,7 +80,8 @@
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
throws SchedulerConfigException {
- _customerLockHandler = new NotSoSimpleSemaphore();
+ if (!getUseDBLocks() && !isClustered())
+ _lockHandler = new NotSoSimpleSemaphore();
super.initialize(loadHelper, signaler);
}
@@ -1388,6 +1389,6 @@
protected Semaphore getLockHandler() {
- return _customerLockHandler;
+ return _lockHandler == null ? super.getLockHandler() : _lockHandler;
}
}
Modified: incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java?view=diff&rev=505077&r1=505076&r2=505077
==============================================================================
--- incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java (original)
+++ incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java Thu Feb 8 14:57:27 2007
@@ -23,6 +23,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.iapi.Scheduler.JobProcessor;
import org.apache.ode.utils.GUID;
import org.quartz.*;
import org.quartz.core.QuartzScheduler;
@@ -61,7 +62,7 @@
private static final Map<String, QuartzSchedulerImpl> __instanceMap = Collections
.synchronizedMap(new HashMap<String, QuartzSchedulerImpl>());
- protected JobProcessor _processor;
+ protected volatile JobProcessor _processor;
private org.quartz.Scheduler _quartz;
@@ -77,6 +78,8 @@
private boolean _isSqlServer = false;
+ private boolean _isClustered = false;
+
public QuartzSchedulerImpl() {
_id = "ODE";
}
@@ -98,9 +101,11 @@
_txm = txm;
}
+ public void setIsClustered(boolean isclustered) {
+ _isClustered = isclustered;
+ }
+
public void init() throws ContextException {
- if (_processor == null)
- throw new NullPointerException("JobProcessor not set!");
if (_executorSvc == null)
throw new NullPointerException("ExecutorService not set!");
if (_managedDS == null)
@@ -111,11 +116,13 @@
DBConnectionManager.getInstance().addConnectionProvider("managed", new DataSourceConnectionProvider(_managedDS));
JobStoreJTA jobStore = new JobStoreJTA(_txm);
jobStore.setDataSource("managed");
+ jobStore.setIsClustered(_isClustered);
checkSqlServer();
try {
- _quartz = createScheduler(_id, _id, new QuartzThreadPoolExecutorServiceImpl(_executorSvc, _threads), jobStore);
+ _quartz = createScheduler(_id, new GUID().toString(), new QuartzThreadPoolExecutorServiceImpl(_executorSvc, _threads),
+ jobStore);
_quartz.getSchedulerInstanceId();
__instanceMap.put(_id, this);
} catch (Exception ex) {
@@ -221,7 +228,8 @@
public <T> T execTransaction(Callable<T> transaction) throws Exception, ContextException {
try {
- if (__log.isDebugEnabled()) __log.debug("Starting transaction.");
+ if (__log.isDebugEnabled())
+ __log.debug("Starting transaction.");
begin();
} catch (Exception ex) {
String errmsg = "Failed to start transaction.";
@@ -237,7 +245,8 @@
} finally {
if (success)
try {
- if (__log.isDebugEnabled()) __log.debug("Commiting transaction.");
+ if (__log.isDebugEnabled())
+ __log.debug("Commiting transaction.");
commit();
} catch (Exception ex) {
String errmsg = "Failed to commit transaction.";
@@ -293,11 +302,13 @@
@SuppressWarnings("unchecked")
private void doExecute(JobExecutionContext jobcontext) throws JobExecutionException {
- JobInfo ji = new JobInfo(jobcontext.getJobDetail().getName(),
- jobcontext.getJobDetail().getJobDataMap(),
- jobcontext.getRefireCount());
+ JobInfo ji = new JobInfo(jobcontext.getJobDetail().getName(), jobcontext.getJobDetail().getJobDataMap(), jobcontext
+ .getRefireCount());
+ JobProcessor processor = _processor;
+ if (processor == null)
+ throw new JobExecutionException("No processor.", null, true);
try {
- _processor.onScheduledJob(ji);
+ processor.onScheduledJob(ji);
} catch (JobProcessorException jpe) {
throw new JobExecutionException(jpe, jpe.retry);
} catch (RuntimeException ex) {