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 2006/12/14 18:54:55 UTC
svn commit: r487279 -
/incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java
Author: mszefler
Date: Thu Dec 14 09:54:55 2006
New Revision: 487279
URL: http://svn.apache.org/viewvc?view=rev&rev=487279
Log:
Fixed incomplete shutdown.
Modified:
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/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=487279&r1=487278&r2=487279
==============================================================================
--- 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 Dec 14 09:54:55 2006
@@ -102,19 +102,18 @@
if (_txm == null)
throw new NullPointerException("TransactionManager not set!");
- DBConnectionManager.getInstance().addConnectionProvider("managed",
- new DataSourceConnectionProvider(_managedDS));
+ DBConnectionManager.getInstance()
+ .addConnectionProvider("managed", new DataSourceConnectionProvider(_managedDS));
JobStoreJTA jobStore = new JobStoreJTA(_txm);
jobStore.setDataSource("managed");
try {
- _quartz= createScheduler("ODEScheduler",_id,
- new QuartzThreadPoolExecutorServiceImpl(_executorSvc, _threads),
- jobStore);
+ _quartz = createScheduler("ODEScheduler", _id, new QuartzThreadPoolExecutorServiceImpl(_executorSvc,
+ _threads), jobStore);
_quartz.getSchedulerInstanceId();
__instanceMap.put(_id, this);
} catch (Exception ex) {
- throw new ContextException(ex.getMessage(),ex);
+ throw new ContextException(ex.getMessage(), ex);
}
}
@@ -129,15 +128,6 @@
}
}
- public void stop() {
- try {
- _quartz.standby();
- } catch (SchedulerException e) {
- throw new ContextException("Error stopping Quartz.", e);
- }
-
- }
-
public void shutdown() {
try {
_quartz.shutdown();
@@ -145,20 +135,27 @@
throw new RuntimeException(except);
} finally {
__instanceMap.remove(_id);
+ SchedulerRepository.getInstance().remove(_id);
}
}
- public String schedulePersistedJob(Map<String, Object> detail, Date when)
- throws ContextException {
+ public void stop() {
+ try {
+ _quartz.standby();
+ } catch (SchedulerException e) {
+ throw new ContextException("Error stopping Quartz.", e);
+ }
+
+ }
+
+ public String schedulePersistedJob(Map<String, Object> detail, Date when) throws ContextException {
return schedule(detail, when, false, false);
}
- protected String schedule(Map<String, Object> detail, Date when,
- boolean volatil, boolean notx) {
+ protected String schedule(Map<String, Object> detail, Date when, boolean volatil, boolean notx) {
if (when == null)
when = new Date();
- JobDetail jobDetail = new JobDetail(new GUID().toString(), null,
- JobImpl.class);
+ JobDetail jobDetail = new JobDetail(new GUID().toString(), null, JobImpl.class);
HashMap<String, Object> mcopy = new HashMap<String, Object>(detail);
mcopy.put("__scheduler", _id);
@@ -167,8 +164,8 @@
jobDetail.setDurability(false);
jobDetail.setVolatility(volatil);
jobDetail.setRequestsRecovery(true);
- Trigger trigger = new SimpleTrigger(jobDetail.getName() + ".trigger",
- org.quartz.Scheduler.DEFAULT_GROUP, when, null, 0, 0L);
+ Trigger trigger = new SimpleTrigger(jobDetail.getName() + ".trigger", org.quartz.Scheduler.DEFAULT_GROUP, when,
+ null, 0, 0L);
trigger.setVolatility(volatil);
try {
@@ -181,8 +178,8 @@
return jobDetail.getName();
}
- public String scheduleVolatileJob(boolean transacted,
- Map<String, Object> detail, Date when) throws ContextException {
+ public String scheduleVolatileJob(boolean transacted, Map<String, Object> detail, Date when)
+ throws ContextException {
return schedule(detail, when, true, !transacted);
}
@@ -196,8 +193,7 @@
}
}
- public <T> T execTransaction(Callable<T> transaction) throws Exception,
- ContextException {
+ public <T> T execTransaction(Callable<T> transaction) throws Exception, ContextException {
try {
begin();
@@ -236,7 +232,7 @@
try {
_txm.rollback();
} catch (Exception ex) {
- __log.error("JTA ROLLBACK FAILED",ex);
+ __log.error("JTA ROLLBACK FAILED", ex);
throw ex;
}
}
@@ -245,7 +241,7 @@
try {
_txm.commit();
} catch (Exception ex) {
- __log.error("JTA COMMIT FAILED",ex);
+ __log.error("JTA COMMIT FAILED", ex);
throw ex;
}
}
@@ -254,7 +250,7 @@
try {
_txm.begin();
} catch (Exception ex) {
- __log.error("JTA BEGIN FAILED",ex);
+ __log.error("JTA BEGIN FAILED", ex);
throw ex;
}
}
@@ -266,14 +262,14 @@
}
public static void execute(JobExecutionContext jobcontext) {
- String schedulerGuid = jobcontext.getJobDetail().getJobDataMap().getString(
- "__scheduler");
+ String schedulerGuid = jobcontext.getJobDetail().getJobDataMap().getString("__scheduler");
__instanceMap.get(schedulerGuid).doExecute(jobcontext);
}
/**
- * Create a QUARTZ scheduler using JTA Job Shell. Unfortunately there is
- * no "easy" way to do this using the standard scheduler factory.
+ * Create a QUARTZ scheduler using JTA Job Shell. Unfortunately there is no
+ * "easy" way to do this using the standard scheduler factory.
+ *
* @param schedulerName
* @param schedulerInstanceId
* @param threadPool
@@ -285,8 +281,7 @@
* @throws SchedulerException
*/
private org.quartz.Scheduler createScheduler(String schedulerName, String schedulerInstanceId,
- ThreadPool threadPool, JobStoreJTA jobStore)
- throws SchedulerException {
+ ThreadPool threadPool, JobStoreJTA jobStore) throws SchedulerException {
jobStore.setInstanceName(schedulerName);
jobStore.setInstanceId(schedulerInstanceId);
@@ -306,7 +301,7 @@
qrs.setThreadPool(threadPool);
qrs.setJobStore(jobStore);
- QuartzScheduler qs = new QuartzScheduler(qrs, schedCtxt, 0,0);
+ QuartzScheduler qs = new QuartzScheduler(qrs, schedCtxt, 0, 0);
ClassLoadHelper cch = new CascadingClassLoadHelper();
cch.initialize();