Polishing
This commit is contained in:
parent
0ec19dc95e
commit
7d7758bfc9
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
* <p>Support for this WebSphere 5.1 variant can be built with this class
|
||||
* and its helper DelegatingWork as template: Call the WorkManager's
|
||||
* <code>startWork(Work)</code> instead of <code>schedule(Work)</code>
|
||||
* in the <code>execute(Runnable)</code> implementation. Furthermore,
|
||||
* for simplicity's sake, drop the entire "Implementation of the CommonJ
|
||||
* WorkManager interface" section (and the corresponding
|
||||
* <code>implements WorkManager</code> clause at the class level).
|
||||
* Of course, you also need to change all <code>commonj.work</code> imports in
|
||||
* your WorkManagerTaskExecutor and DelegatingWork variants to the corresponding
|
||||
* WebSphere API imports (<code>com.ibm.websphere.asynchbeans.WorkManager</code>
|
||||
* and <code>com.ibm.websphere.asynchbeans.Work</code>, respectively).
|
||||
* This should be sufficient to get a TaskExecutor adapter for WebSphere 5.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -23,12 +23,12 @@ package org.springframework.util;
|
|||
* 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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue