diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerTaskScheduler.java b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerTaskScheduler.java index 8d0f0795bc..76714ce5f2 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerTaskScheduler.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerTaskScheduler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,10 +43,15 @@ public class TimerManagerTaskScheduler extends TimerManagerAccessor implements T private volatile ErrorHandler errorHandler; + + /** + * Provide an {@link ErrorHandler} strategy. + */ public void setErrorHandler(ErrorHandler errorHandler) { this.errorHandler = errorHandler; } + public ScheduledFuture schedule(Runnable task, Trigger trigger) { return new ReschedulingTimerListener(errorHandlingTask(task, true), trigger).schedule(); } diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java index e1d2cb0911..4d1518dfa9 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,26 +65,6 @@ import org.springframework.util.Assert; * {@link org.springframework.jca.work.glassfish.GlassFishWorkManagerTaskExecutor} * classes which are the direct equivalent of this CommonJ adapter class. * - *
A similar facility is available on WebSphere 5.1, under the name - * "Asynch Beans". Its central interface is called WorkManager too and is - * also obtained from JNDI, just like a standard CommonJ WorkManager. - * However, this WorkManager variant is notably different: The central - * execution method is called "startWork" instead of "schedule", - * and takes a slightly different Work interface as parameter. - * - *
Support for this WebSphere 5.1 variant can be built with this class
- * and its helper DelegatingWork as template: Call the WorkManager's
- * startWork(Work) instead of schedule(Work)
- * in the execute(Runnable) implementation. Furthermore,
- * for simplicity's sake, drop the entire "Implementation of the CommonJ
- * WorkManager interface" section (and the corresponding
- * implements WorkManager clause at the class level).
- * Of course, you also need to change all commonj.work imports in
- * your WorkManagerTaskExecutor and DelegatingWork variants to the corresponding
- * WebSphere API imports (com.ibm.websphere.asynchbeans.WorkManager
- * and com.ibm.websphere.asynchbeans.Work, respectively).
- * This should be sufficient to get a TaskExecutor adapter for WebSphere 5.
- *
* @author Juergen Hoeller
* @since 2.0
*/
diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessorBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessorBean.java
index d02689462d..9c69a47c00 100644
--- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessorBean.java
+++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessorBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -95,8 +95,8 @@ public class SchedulerAccessorBean extends SchedulerAccessor implements BeanFact
if (this.beanFactory instanceof ListableBeanFactory) {
ListableBeanFactory lbf = (ListableBeanFactory) this.beanFactory;
String[] beanNames = lbf.getBeanNamesForType(Scheduler.class);
- for (int i = 0; i < beanNames.length; i++) {
- Scheduler schedulerBean = (Scheduler) lbf.getBean(beanNames[i]);
+ for (String beanName : beanNames) {
+ Scheduler schedulerBean = (Scheduler) lbf.getBean(beanName);
if (schedulerName.equals(schedulerBean.getSchedulerName())) {
return schedulerBean;
}
diff --git a/spring-core/src/main/java/org/springframework/util/ErrorHandler.java b/spring-core/src/main/java/org/springframework/util/ErrorHandler.java
index 10e9daf0d0..a43ee8b659 100644
--- a/spring-core/src/main/java/org/springframework/util/ErrorHandler.java
+++ b/spring-core/src/main/java/org/springframework/util/ErrorHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,14 +21,14 @@ package org.springframework.util;
* errors that occur during asynchronous execution of tasks that have been
* submitted to a TaskScheduler. In such cases, it may not be possible to
* throw the error to the original caller.
- *
+ *
* @author Mark Fisher
- * @since 3.0.
+ * @since 3.0
*/
public interface ErrorHandler {
/**
- * Handle the given error, possibly rethrowing it as a fatal exception
+ * Handle the given error, possibly rethrowing it as a fatal exception.
*/
void handleError(Throwable t);
diff --git a/spring-tx/src/main/java/org/springframework/jca/work/WorkManagerTaskExecutor.java b/spring-tx/src/main/java/org/springframework/jca/work/WorkManagerTaskExecutor.java
index 4e06eeeb29..ac03decd34 100644
--- a/spring-tx/src/main/java/org/springframework/jca/work/WorkManagerTaskExecutor.java
+++ b/spring-tx/src/main/java/org/springframework/jca/work/WorkManagerTaskExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ import org.springframework.util.Assert;
* @see javax.resource.spi.work.WorkManager#scheduleWork
*/
public class WorkManagerTaskExecutor extends JndiLocatorSupport
- implements SchedulingTaskExecutor, AsyncTaskExecutor, WorkManager, BootstrapContextAware, InitializingBean {
+ implements SchedulingTaskExecutor, WorkManager, BootstrapContextAware, InitializingBean {
private WorkManager workManager;