Author: dejanb
Date: Fri Apr 16 12:14:52 2010
New Revision: 934839
URL: http://svn.apache.org/viewvc?rev=934839&view=rev
Log:
JmsSchedulerTest give it more time to handle slow machines and add some
debugging
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobLocation.java
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobSchedulerImpl.java
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
activemq/trunk/activemq-core/src/test/resources/log4j.properties
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobLocation.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobLocation.java?rev=934839&r1=934838&r2=934839&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobLocation.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobLocation.java
Fri Apr 16 12:14:52 2010
@@ -20,7 +20,9 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
+
import org.apache.kahadb.journal.Location;
import org.apache.kahadb.util.VariableMarshaller;
@@ -183,6 +185,12 @@ class JobLocation {
return this.location;
}
+ public String toString() {
+ return "Job [id=" + jobId + ", startTime=" + new Date(startTime)
+ + ", delay=" + delay + ", period=" + period + ", repeat="
+ + repeat + ", nextTime=" + new Date(nextTime) + "]";
+ }
+
static class JobLocationMarshaller extends
VariableMarshaller<List<JobLocation>> {
static final JobLocationMarshaller INSTANCE = new
JobLocationMarshaller();
public List<JobLocation> readPayload(DataInput dataIn) throws
IOException {
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobSchedulerImpl.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobSchedulerImpl.java?rev=934839&r1=934838&r2=934839&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobSchedulerImpl.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/scheduler/JobSchedulerImpl.java
Fri Apr 16 12:14:52 2010
@@ -25,7 +25,9 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
+
import javax.jms.MessageFormatException;
+
import org.apache.activemq.util.IdGenerator;
import org.apache.activemq.util.ServiceStopper;
import org.apache.activemq.util.ServiceSupport;
@@ -286,6 +288,9 @@ class JobSchedulerImpl extends ServiceSu
jobLocation.setDelay(delay);
jobLocation.setPeriod(period);
jobLocation.setRepeat(repeat);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Scheduling " + jobLocation);
+ }
storeJob(tx, jobLocation, time);
this.scheduleTime.newJob();
}
@@ -410,6 +415,9 @@ class JobSchedulerImpl extends ServiceSu
}
void fireJob(JobLocation job) throws IllegalStateException, IOException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Firing " + job);
+ }
ByteSequence bs = this.store.getPayload(job.getLocation());
for (JobListener l : jobListeners) {
l.scheduledJob(job.getJobId(), bs);
@@ -506,6 +514,9 @@ class JobSchedulerImpl extends ServiceSu
// rescheduled from this execution time
remove(executionTime);
} else {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Not yet time to execute the job,
waiting " + (executionTime - currentTime) + " ms");
+ }
this.scheduleTime.setWaitTime(executionTime -
currentTime);
}
}
Modified:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java?rev=934839&r1=934838&r2=934839&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
(original)
+++
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JmsSchedulerTest.java
Fri Apr 16 12:14:52 2010
@@ -70,8 +70,8 @@ public class JmsSchedulerTest extends Em
JobScheduler js = sb.getJobScheduler();
List<Job> list = js.getAllJobs();
assertEquals(1, list.size());
- latch.await(120,TimeUnit.SECONDS);
- assertEquals(COUNT,count.get());
+ latch.await(240, TimeUnit.SECONDS);
+ assertEquals(COUNT, count.get());
}
public void testSchedule() throws Exception {
Modified: activemq/trunk/activemq-core/src/test/resources/log4j.properties
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/log4j.properties?rev=934839&r1=934838&r2=934839&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/log4j.properties (original)
+++ activemq/trunk/activemq-core/src/test/resources/log4j.properties Fri Apr 16
12:14:52 2010
@@ -20,6 +20,7 @@
#
log4j.rootLogger=INFO, out, stdout
+log4j.logger.org.apache.activemq.broker.scheduler=DEBUG
#log4j.logger.org.apache.activemq=DEBUG
#log4j.logger.org.apache.activemq.store.jdbc=DEBUG
#log4j.logger.org.apache.activemq.broker.region.cursors.AbstractStoreCursor=DEBUG