[jboss-cvs] JBossAS SVN: r104457 - trunk/connector/src/main/java/org/jboss/resource/adapter/quartz/inflow.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 4 17:48:07 EDT 2010
Author: alesj
Date: 2010-05-04 17:48:07 -0400 (Tue, 04 May 2010)
New Revision: 104457
Modified:
trunk/connector/src/main/java/org/jboss/resource/adapter/quartz/inflow/QuartzResourceAdapter.java
Log:
Fix stream handling.
Modified: trunk/connector/src/main/java/org/jboss/resource/adapter/quartz/inflow/QuartzResourceAdapter.java
===================================================================
--- trunk/connector/src/main/java/org/jboss/resource/adapter/quartz/inflow/QuartzResourceAdapter.java 2010-05-04 20:22:07 UTC (rev 104456)
+++ trunk/connector/src/main/java/org/jboss/resource/adapter/quartz/inflow/QuartzResourceAdapter.java 2010-05-04 21:48:07 UTC (rev 104457)
@@ -52,27 +52,27 @@
{
private static Logger log = Logger.getLogger(QuartzResourceAdapter.class);
- private static final ThreadLocal holder = new ThreadLocal();
+ private static final ThreadLocal<WorkManager> holder = new ThreadLocal<WorkManager>();
private Scheduler sched;
public final static String QUARTZ_PROPERTIES_PATH = "org/jboss/resource/adapter/quartz/inflow/quartz.properties";
- public static WorkManager getConfigTimeWorkManager() {
- return (WorkManager) holder.get();
+ public static WorkManager getConfigTimeWorkManager()
+ {
+ return holder.get();
}
public void start(BootstrapContext ctx) throws ResourceAdapterInternalException
{
log.debug("Start Quartz scheduler");
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- InputStream quartzPropsStream = cl.getResourceAsStream( QUARTZ_PROPERTIES_PATH );
+ InputStream quartzPropsStream = cl.getResourceAsStream(QUARTZ_PROPERTIES_PATH);
// First we must get a reference to a scheduler
StdSchedulerFactory sf = new StdSchedulerFactory();
try
{
- sf.initialize( quartzPropsStream );
- quartzPropsStream.close();
+ sf.initialize(quartzPropsStream);
holder.set(ctx.getWorkManager());
sched = sf.getScheduler();
sched.start();
@@ -81,13 +81,17 @@
{
throw new ResourceAdapterInternalException(e);
}
- catch (IOException e)
- {
- log.warn( "Unable to close quartz properties file: " + e, e );
- }
finally
{
- holder.set(null);
+ holder.remove();
+ try
+ {
+ quartzPropsStream.close();
+ }
+ catch (IOException e)
+ {
+ log.debug( "Unable to close quartz properties file: " + e, e );
+ }
}
}
@@ -152,5 +156,4 @@
{
return new XAResource[0];
}
-
}
More information about the jboss-cvs-commits
mailing list