Author: jeff.yuchang
Date: 2010-10-20 23:29:59 -0400 (Wed, 20 Oct 2010)
New Revision: 1047
Modified:
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/cron/CronScheduler.java
branches/ODE/RiftSaw-ODE-trunk/dao-jpa-hibernate/build.xml
branches/ODE/RiftSaw-ODE-trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/scheduler/JobDAOImpl.java
branches/ODE/RiftSaw-ODE-trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/jdbc/SchedulerDAOConnectionImpl.java
Log:
* RIFTSAW-291, RIFTSAW-292. using boolean data type for Java's boolean, instead of
int.
Modified:
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/cron/CronScheduler.java
===================================================================
---
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/cron/CronScheduler.java 2010-10-20
11:35:01 UTC (rev 1046)
+++
branches/ODE/RiftSaw-ODE-trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/cron/CronScheduler.java 2010-10-21
03:29:59 UTC (rev 1047)
@@ -90,7 +90,9 @@
public void cancelProcessCronJobs(QName pid, boolean undeployed) {
assert pid != null;
- if( __log.isInfoEnabled() ) __log.info("Cancelling PROCESS CRON jobs for:
" + pid);
+ if( __log.isDebugEnabled() ) {
+ __log.debug("Cancelling PROCESS CRON jobs for: " + pid);
+ }
Collection<TerminationListener> listenersToTerminate = new
ArrayList<TerminationListener>();
synchronized( _terminationListenersByPid ) {
@@ -110,6 +112,9 @@
listener.terminate();
}
}
+
+ __log.info("Cancelled PROCESS CRON jobs for: " + pid);
+
}
public void scheduleProcessCronJobs(QName pid, ProcessConf pconf) {
@@ -122,7 +127,9 @@
Collection<TerminationListener> newListeners = new
ArrayList<TerminationListener>();
synchronized( pid ) {
- if( __log.isInfoEnabled() ) __log.info("Scheduling PROCESS CRON jobs
for: " + pid);
+ if( __log.isDebugEnabled() ) {
+ __log.debug("Scheduling PROCESS CRON jobs for: " + pid);
+ }
// start new cron jobs
for( final CronJob job : pconf.getCronJobs() ) {
@@ -161,6 +168,8 @@
}
}
}
+
+ __log.info("Scheduled PROCESS CRON jobs for: " + pid);
}
public void refreshSystemCronJobs(SystemSchedulesConfig systemSchedulesConf) {
Modified:
branches/ODE/RiftSaw-ODE-trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/scheduler/JobDAOImpl.java
===================================================================
---
branches/ODE/RiftSaw-ODE-trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/scheduler/JobDAOImpl.java 2010-10-20
11:35:01 UTC (rev 1046)
+++
branches/ODE/RiftSaw-ODE-trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/scheduler/JobDAOImpl.java 2010-10-21
03:29:59 UTC (rev 1047)
@@ -227,7 +227,7 @@
@Lob
@Column(name = "detailsExt")
public byte[] getDetailsExt() {
- if (_details.detailsExt != null) {
+ if (_details.detailsExt != null && _details.detailsExt.size() > 0) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bos);
@@ -242,7 +242,7 @@
}
public void setDetailsExt(byte[] detailsExt) {
- if (detailsExt != null) {
+ if (detailsExt != null && detailsExt.length > 0) {
try {
ByteArrayInputStream bis = new ByteArrayInputStream(detailsExt);
ObjectInputStream is = new ObjectInputStream(bis);
Modified: branches/ODE/RiftSaw-ODE-trunk/dao-jpa-hibernate/build.xml
===================================================================
--- branches/ODE/RiftSaw-ODE-trunk/dao-jpa-hibernate/build.xml 2010-10-20 11:35:01 UTC
(rev 1046)
+++ branches/ODE/RiftSaw-ODE-trunk/dao-jpa-hibernate/build.xml 2010-10-21 03:29:59 UTC
(rev 1047)
@@ -66,7 +66,6 @@
<concat destfile="${db.scripts.dir}/scripts/(a){db}.sql">
<fileset file="${scripts.dir}/license-header.sql"/>
<fileset file="${scripts.dir}/common.sql"/>
- <fileset file="${scripts.dir}/simplesched-(a){db}.sql"/>
<fileset file="${db.scripts.dir}/partial.(a){db}.sql"/>
</concat>
Modified:
branches/ODE/RiftSaw-ODE-trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/jdbc/SchedulerDAOConnectionImpl.java
===================================================================
---
branches/ODE/RiftSaw-ODE-trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/jdbc/SchedulerDAOConnectionImpl.java 2010-10-20
11:35:01 UTC (rev 1046)
+++
branches/ODE/RiftSaw-ODE-trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/jdbc/SchedulerDAOConnectionImpl.java 2010-10-21
03:29:59 UTC (rev 1047)
@@ -60,23 +60,23 @@
private static final String DELETE_JOB = "delete from ODE_JOB where jobid = ?
and nodeid = ?";
- private static final String UPDATE_REASSIGN = "update ODE_JOB set nodeid = ?,
scheduled = 0 where nodeid = ?";
+ private static final String UPDATE_REASSIGN = "update ODE_JOB set nodeid = ?,
scheduled = false where nodeid = ?";
private static final String UPDATE_JOB = "update ODE_JOB set ts = ?, retryCount
= ?, scheduled = ? where jobid = ?";
- private static final String UPGRADE_JOB_DEFAULT = "update ODE_JOB set nodeid = ?
where nodeid is null and scheduled = 0 "
+ private static final String UPGRADE_JOB_DEFAULT = "update ODE_JOB set nodeid = ?
where nodeid is null and scheduled = false "
+ "and mod(ts,?) = ? and ts < ?";
- private static final String UPGRADE_JOB_DB2 = "update ODE_JOB set nodeid = ?
where nodeid is null and scheduled = 0 "
+ private static final String UPGRADE_JOB_DB2 = "update ODE_JOB set nodeid = ?
where nodeid is null and scheduled = false "
+ "and mod(ts,CAST(? AS BIGINT)) = ? and ts < ?";
- private static final String UPGRADE_JOB_SQLSERVER = "update ODE_JOB set nodeid =
? where nodeid is null and scheduled = 0 "
+ private static final String UPGRADE_JOB_SQLSERVER = "update ODE_JOB set nodeid =
? where nodeid is null and scheduled = false "
+ "and (ts % ?) = ? and ts < ?";
- private static final String UPGRADE_JOB_SYBASE = "update ODE_JOB set nodeid = ?
where nodeid is null and scheduled = 0 "
+ private static final String UPGRADE_JOB_SYBASE = "update ODE_JOB set nodeid = ?
where nodeid is null and scheduled = false "
+ "and convert(int, ts) % ? = ? and ts < ?";
- private static final String UPGRADE_JOB_SYBASE12 = "update ODE_JOB set nodeid =
? where nodeid is null and scheduled = 0 "
+ private static final String UPGRADE_JOB_SYBASE12 = "update ODE_JOB set nodeid =
? where nodeid is null and scheduled = false "
+ "and -1 <> ? and -1 <> ? and ts < ?";
private static final String SAVE_JOB = "insert into ODE_JOB "
@@ -118,9 +118,9 @@
+ "inMem,"
+ "detailsExt"
+ " from ODE_JOB "
- + "where nodeid = ? and scheduled = 0 and ts < ? order by ts";
+ + "where nodeid = ? and scheduled = false and ts < ? order by
ts";
- private static final String UPDATE_SCHEDULED = "update ODE_JOB set scheduled = 1
where jobid in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ private static final String UPDATE_SCHEDULED = "update ODE_JOB set scheduled =
true where jobid in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
private static final int UPDATE_SCHEDULED_SLOTS = 10;
@@ -197,10 +197,11 @@
ps.setString(i++, job.getJobId());
ps.setString(i++, nodeId);
ps.setLong(i++, job.getScheduledDate());
- ps.setInt(i++, asInteger(loaded));
- ps.setInt(i++, asInteger(job.isTransacted()));
+ ps.setBoolean(i++, loaded);
+ ps.setBoolean(i++, job.isTransacted());
JobDetails details = job.getDetails();
+
ps.setObject(i++, details.instanceId, Types.BIGINT);
ps.setObject(i++, details.mexId, Types.VARCHAR);
ps.setObject(i++, details.processId, Types.VARCHAR);
@@ -209,10 +210,10 @@
ps.setObject(i++, details.correlatorId, Types.VARCHAR);
ps.setObject(i++, details.correlationKeySet, Types.VARCHAR);
ps.setObject(i++, details.retryCount, Types.INTEGER);
- ps.setObject(i++, details.inMem, Types.INTEGER);
+ ps.setObject(i++, details.inMem, Types.BOOLEAN);
if (details.detailsExt == null || details.detailsExt.size() == 0) {
- ps.setBytes(i++, null);
+ ps.setObject(i++, null, Types.BLOB);
} else {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
@@ -221,7 +222,7 @@
__log.error("Error serializing job detail: " +
job.getDetails());
throw new DatabaseException(ex);
}
- ps.setBytes(i++, bos.toByteArray());
+ ps.setObject(i++, bos.toByteArray(), Types.BLOB);
}
return ps.executeUpdate() == 1;
@@ -244,7 +245,7 @@
ps = con.prepareStatement(UPDATE_JOB);
ps.setLong(1, job.getScheduledDate());
ps.setInt(2, job.getDetails().getRetryCount());
- ps.setInt(3, asInt(job.isScheduled()));
+ ps.setBoolean(3, job.isScheduled());
ps.setString(4, job.getJobId());
return ps.executeUpdate() == 1;
} catch (SQLException se) {
@@ -254,14 +255,8 @@
close(con);
}
}
+
- private int asInt(boolean flag) {
- if (flag) {
- return 1;
- }
- return 0;
- }
-
private Long asLong(Object o) {
if (o == null) return null;
else if (o instanceof BigDecimal) return ((BigDecimal) o).longValue();
@@ -300,7 +295,7 @@
details.correlatorId = (String) rs.getObject("correlatorId");
details.correlationKeySet = (String)
rs.getObject("correlationKeySet");
details.retryCount = asInteger(rs.getObject("retryCount"));
- details.inMem = asBoolean(rs.getInt("inMem"));
+ details.inMem = rs.getBoolean("inMem");
if (rs.getObject("detailsExt") != null) {
try {
ObjectInputStream is = new
ObjectInputStream(rs.getBinaryStream("detailsExt"));
@@ -346,7 +341,7 @@
}
}
- JobDAO job = new JobDAOImpl(rs.getLong("ts"),
rs.getString("jobid"), asBoolean(rs.getInt("transacted")), details);
+ JobDAO job = new JobDAOImpl(rs.getLong("ts"),
rs.getString("jobid"), rs.getBoolean("transacted"), details);
ret.add(job);
}
rs.close();
@@ -435,14 +430,6 @@
return c;
}
- private int asInteger(boolean value) {
- return (value ? 1 : 0);
- }
-
- private boolean asBoolean(int value) {
- return (value != 0);
- }
-
private void close(PreparedStatement ps) {
if (ps != null) {
try {