From 2cc8830a044c8bd4ba00268a0dc2d04690f163a1 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" Date: Tue, 21 Nov 2023 19:58:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-108344=20=E7=94=A8=E6=88=B7=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E8=A2=AB=E8=AE=B0=E5=BD=95=E8=BF=9B=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=8C=E6=89=8B=E6=9C=BA=E5=8F=B7=E9=82=AE=E7=AE=B1=E8=A2=AB?= =?UTF-8?q?=E6=98=8E=E6=96=87=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fine-hibernate/README.md | 4 ++++ .../event/internal/AbstractFlushingEventListener.java | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fine-hibernate/README.md b/fine-hibernate/README.md index ddd53171e..d78cf61b0 100644 --- a/fine-hibernate/README.md +++ b/fine-hibernate/README.md @@ -7,3 +7,7 @@ - hibernate-entitymanager - hibernate-java8 - hibernate-jpamodelgen + + +定制: +REPORT-108344: debug日志级别,hibernate会打印出entity信息,没找到控制项,屏蔽一下相关代码 diff --git a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/event/internal/AbstractFlushingEventListener.java b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/event/internal/AbstractFlushingEventListener.java index b8d82aeb0..45c740a14 100644 --- a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/event/internal/AbstractFlushingEventListener.java +++ b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/event/internal/AbstractFlushingEventListener.java @@ -117,9 +117,7 @@ public abstract class AbstractFlushingEventListener implements Serializable { session.getActionQueue().numberOfCollectionRemovals(), persistenceContext.getCollectionEntries().size() ); - new EntityPrinter( session.getFactory() ).toString( - persistenceContext.getEntitiesByKey().entrySet() - ); + //new EntityPrinter( session.getFactory() ).toString(persistenceContext.getEntitiesByKey().entrySet()); } /** From 4277d88ac9e36efc5b11be0f739420b8b5753f82 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" Date: Wed, 22 Nov 2023 16:04:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-109123=20fine-third-11.0.jar?= =?UTF-8?q?=E4=B8=AD=E5=90=AB=E6=9C=89.bak=E6=96=87=E4=BB=B6=E5=BE=85?= =?UTF-8?q?=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/quartz/jobs/FileScanJob.java.bak | 121 ----------- .../simpl/CascadingClassLoadHelper.java.bak | 202 ------------------ .../InitThreadContextClassLoadHelper.java.bak | 96 --------- .../LoadingLoaderClassLoadHelper.java.bak | 87 -------- .../simpl/SimpleClassLoadHelper.java.bak | 106 --------- .../ThreadContextClassLoadHelper.java.bak | 89 -------- .../org/quartz/spi/ClassLoadHelper.java.bak | 69 ------ 7 files changed, 770 deletions(-) delete mode 100644 fine-quartz-old/src/main/java/com/fr/third/org/quartz/jobs/FileScanJob.java.bak delete mode 100644 fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/CascadingClassLoadHelper.java.bak delete mode 100644 fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/InitThreadContextClassLoadHelper.java.bak delete mode 100644 fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/LoadingLoaderClassLoadHelper.java.bak delete mode 100644 fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/SimpleClassLoadHelper.java.bak delete mode 100644 fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/ThreadContextClassLoadHelper.java.bak delete mode 100644 fine-quartz-old/src/main/java/com/fr/third/org/quartz/spi/ClassLoadHelper.java.bak diff --git a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/jobs/FileScanJob.java.bak b/fine-quartz-old/src/main/java/com/fr/third/org/quartz/jobs/FileScanJob.java.bak deleted file mode 100644 index 260f737c9..000000000 --- a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/jobs/FileScanJob.java.bak +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2004-2005 OpenSymphony - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - */ - -/* - * Previously Copyright (c) 2001-2004 James House - */ -package org.quartz.jobs; - -import java.io.File; - -import org.quartz.JobDataMap; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.quartz.SchedulerContext; -import org.quartz.SchedulerException; -import org.quartz.StatefulJob; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Inspects a file and compares whether it's "last modified date" has changed - * since the last time it was inspected. If the file has been updated, the - * job invokes a "call-back" method on an identified - * FileScanListener that can be found in the - * SchedulerContext. - * - * @author jhouse - * @see org.quartz.jobs.FileScanListener - */ -public class FileScanJob implements StatefulJob { - - public static String FILE_NAME = "FILE_NAME"; - public static String FILE_SCAN_LISTENER_NAME = "FILE_SCAN_LISTENER_NAME"; - private static String LAST_MODIFIED_TIME = "LAST_MODIFIED_TIME"; - - private final Log log = LogFactory.getLog(getClass()); - - public FileScanJob() { - } - - /** - * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) - */ - public void execute(JobExecutionContext context) throws JobExecutionException { - JobDataMap mergedJobDataMap = context.getMergedJobDataMap(); - SchedulerContext schedCtxt = null; - try { - schedCtxt = context.getScheduler().getContext(); - } catch (SchedulerException e) { - throw new JobExecutionException("Error obtaining scheduler context.", e, false); - } - - String fileName = mergedJobDataMap.getString(FILE_NAME); - String listenerName = mergedJobDataMap.getString(FILE_SCAN_LISTENER_NAME); - - if(fileName == null) { - throw new JobExecutionException("Required parameter '" + - FILE_NAME + "' not found in merged JobDataMap"); - } - if(listenerName == null) { - throw new JobExecutionException("Required parameter '" + - FILE_SCAN_LISTENER_NAME + "' not found in merged JobDataMap"); - } - - FileScanListener listener = (FileScanListener)schedCtxt.get(listenerName); - - if(listener == null) { - throw new JobExecutionException("FileScanListener named '" + - listenerName + "' not found in SchedulerContext"); - } - - long lastDate = -1; - if(mergedJobDataMap.containsKey(LAST_MODIFIED_TIME)) { - lastDate = mergedJobDataMap.getLong(LAST_MODIFIED_TIME); - } - - long newDate = getLastModifiedDate(fileName); - - if(newDate < 0) { - log.warn("File '"+fileName+"' does not exist."); - return; - } - - if(lastDate > 0 && (newDate != lastDate)) { - // notify call back... - log.info("File '"+fileName+"' updated, notifying listener."); - listener.fileUpdated(fileName); - } else if (log.isDebugEnabled()) { - log.debug("File '"+fileName+"' unchanged."); - } - - // It is the JobDataMap on the JobDetail which is actually stateful - context.getJobDetail().getJobDataMap().put(LAST_MODIFIED_TIME, newDate); - } - - protected long getLastModifiedDate(String fileName) { - - File file = new File(fileName); - - if(!file.exists()) { - return -1; - } else { - return file.lastModified(); - } - } -} diff --git a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/CascadingClassLoadHelper.java.bak b/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/CascadingClassLoadHelper.java.bak deleted file mode 100644 index 4ed568acf..000000000 --- a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/CascadingClassLoadHelper.java.bak +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 2004-2005 OpenSymphony - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - */ - -/* - * Previously Copyright (c) 2001-2004 James House - */ -package org.quartz.simpl; - -import java.util.Iterator; -import java.util.LinkedList; -import java.net.URL; -import java.io.InputStream; - -import org.quartz.spi.ClassLoadHelper; - -/** - * A ClassLoadHelper uses all of the ClassLoadHelper - * types that are found in this package in its attempts to load a class, when - * one scheme is found to work, it is promoted to the scheme that will be used - * first the next time a class is loaded (in order to improve perfomance). - * - *

- * This approach is used because of the wide variance in class loader behavior - * between the various environments in which Quartz runs (e.g. disparate - * application servers, stand-alone, mobile devices, etc.). Because of this - * disparity, Quartz ran into difficulty with a one class-load style fits-all - * design. Thus, this class loader finds the approach that works, then - * 'remembers' it. - *

- * - * @see org.quartz.spi.ClassLoadHelper - * @see org.quartz.simpl.LoadingLoaderClassLoadHelper - * @see org.quartz.simpl.SimpleClassLoadHelper - * @see org.quartz.simpl.ThreadContextClassLoadHelper - * @see org.quartz.simpl.InitThreadContextClassLoadHelper - * - * @author jhouse - */ -public class CascadingClassLoadHelper implements ClassLoadHelper { - - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Data members. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - private LinkedList loadHelpers; - - private ClassLoadHelper bestCandidate; - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Interface. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - /** - * Called to give the ClassLoadHelper a chance to initialize itself, - * including the oportunity to "steal" the class loader off of the calling - * thread, which is the thread that is initializing Quartz. - */ - public void initialize() { - loadHelpers = new LinkedList(); - - loadHelpers.add(new LoadingLoaderClassLoadHelper()); - loadHelpers.add(new SimpleClassLoadHelper()); - loadHelpers.add(new ThreadContextClassLoadHelper()); - loadHelpers.add(new InitThreadContextClassLoadHelper()); - - Iterator iter = loadHelpers.iterator(); - while (iter.hasNext()) { - ClassLoadHelper loadHelper = (ClassLoadHelper) iter.next(); - loadHelper.initialize(); - } - } - - /** - * Return the class with the given name. - */ - public Class loadClass(String name) throws ClassNotFoundException { - - if (bestCandidate != null) { - try { - return bestCandidate.loadClass(name); - } catch (Exception e) { - bestCandidate = null; - } - } - - ClassNotFoundException cnfe = null; - Class clazz = null; - ClassLoadHelper loadHelper = null; - - Iterator iter = loadHelpers.iterator(); - while (iter.hasNext()) { - loadHelper = (ClassLoadHelper) iter.next(); - - try { - clazz = loadHelper.loadClass(name); - break; - } catch (ClassNotFoundException e) { - cnfe = e; - } - } - - if (clazz == null) { - throw cnfe; - } - - bestCandidate = loadHelper; - - return clazz; - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.net.URL object - */ - public URL getResource(String name) { - - if (bestCandidate != null) { - try { - return bestCandidate.getResource(name); - } catch (Exception e) { - bestCandidate = null; - } - } - - URL result = null; - ClassLoadHelper loadHelper = null; - - Iterator iter = loadHelpers.iterator(); - while (iter.hasNext()) { - loadHelper = (ClassLoadHelper) iter.next(); - - result = loadHelper.getResource(name); - if (result != null) { - break; - } - } - - bestCandidate = loadHelper; - return result; - - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.io.InputStream object - */ - public InputStream getResourceAsStream(String name) { - - if (bestCandidate != null) { - try { - return bestCandidate.getResourceAsStream(name); - } catch (Exception e) { - bestCandidate = null; - } - } - - InputStream result = null; - ClassLoadHelper loadHelper = null; - - Iterator iter = loadHelpers.iterator(); - while (iter.hasNext()) { - loadHelper = (ClassLoadHelper) iter.next(); - - result = loadHelper.getResourceAsStream(name); - if (result != null) { - break; - } - } - - bestCandidate = loadHelper; - return result; - - } - -} diff --git a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/InitThreadContextClassLoadHelper.java.bak b/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/InitThreadContextClassLoadHelper.java.bak deleted file mode 100644 index 9c6f84d1e..000000000 --- a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/InitThreadContextClassLoadHelper.java.bak +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2004-2005 OpenSymphony - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - */ - -/* - * Previously Copyright (c) 2001-2004 James House - */ -package org.quartz.simpl; - -import org.quartz.spi.ClassLoadHelper; - -import java.net.URL; -import java.io.InputStream; - -/** - * A ClassLoadHelper that uses either the context class loader - * of the thread that initialized Quartz. - * - * @see org.quartz.spi.ClassLoadHelper - * @see org.quartz.simpl.ThreadContextClassLoadHelper - * @see org.quartz.simpl.SimpleClassLoadHelper - * @see org.quartz.simpl.CascadingClassLoadHelper - * @see org.quartz.simpl.LoadingLoaderClassLoadHelper - * - * @author jhouse - */ -public class InitThreadContextClassLoadHelper implements ClassLoadHelper { - - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Data members. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - private ClassLoader initClassLoader; - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Interface. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - /** - * Called to give the ClassLoadHelper a chance to initialize itself, - * including the oportunity to "steal" the class loader off of the calling - * thread, which is the thread that is initializing Quartz. - */ - public void initialize() { - initClassLoader = Thread.currentThread().getContextClassLoader(); - } - - /** - * Return the class with the given name. - */ - public Class loadClass(String name) throws ClassNotFoundException { - return initClassLoader.loadClass(name); - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.net.URL object - */ - public URL getResource(String name) { - return initClassLoader.getResource(name); - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.io.InputStream object - */ - public InputStream getResourceAsStream(String name) { - return initClassLoader.getResourceAsStream(name); - } -} diff --git a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/LoadingLoaderClassLoadHelper.java.bak b/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/LoadingLoaderClassLoadHelper.java.bak deleted file mode 100644 index 8121baa7c..000000000 --- a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/LoadingLoaderClassLoadHelper.java.bak +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2004-2005 OpenSymphony - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - */ - -/* - * Previously Copyright (c) 2001-2004 James House - */ -package org.quartz.simpl; - -import org.quartz.spi.ClassLoadHelper; - -import java.net.URL; -import java.io.InputStream; - -/** - * A ClassLoadHelper that uses either the loader of it's own - * class (this.getClass().getClassLoader().loadClass( .. )). - * - * @see org.quartz.spi.ClassLoadHelper - * @see org.quartz.simpl.InitThreadContextClassLoadHelper - * @see org.quartz.simpl.SimpleClassLoadHelper - * @see org.quartz.simpl.CascadingClassLoadHelper - * - * @author jhouse - */ -public class LoadingLoaderClassLoadHelper implements ClassLoadHelper { - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Interface. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - /** - * Called to give the ClassLoadHelper a chance to initialize itself, - * including the oportunity to "steal" the class loader off of the calling - * thread, which is the thread that is initializing Quartz. - */ - public void initialize() { - } - - /** - * Return the class with the given name. - */ - public Class loadClass(String name) throws ClassNotFoundException { - return getClassLoader().loadClass(name); - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.net.URL object - */ - public URL getResource(String name) { - return getClassLoader().getResource(name); - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.io.InputStream object - */ - public InputStream getResourceAsStream(String name) { - return getClassLoader().getResourceAsStream(name); - } - - private ClassLoader getClassLoader() { - return this.getClass().getClassLoader(); - } -} diff --git a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/SimpleClassLoadHelper.java.bak b/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/SimpleClassLoadHelper.java.bak deleted file mode 100644 index 309a0ff0b..000000000 --- a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/SimpleClassLoadHelper.java.bak +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2004-2005 OpenSymphony - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - */ - -/* - * Previously Copyright (c) 2001-2004 James House - */ -package org.quartz.simpl; - -import org.quartz.spi.ClassLoadHelper; - -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.Method; -import java.net.URL; -import java.io.InputStream; - -/** - * A ClassLoadHelper that simply calls Class.forName(..). - * - * @see org.quartz.spi.ClassLoadHelper - * @see org.quartz.simpl.ThreadContextClassLoadHelper - * @see org.quartz.simpl.CascadingClassLoadHelper - * @see org.quartz.simpl.LoadingLoaderClassLoadHelper - * - * @author jhouse - */ -public class SimpleClassLoadHelper implements ClassLoadHelper { - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Interface. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - /** - * Called to give the ClassLoadHelper a chance to initialize itself, - * including the oportunity to "steal" the class loader off of the calling - * thread, which is the thread that is initializing Quartz. - */ - public void initialize() { - } - - /** - * Return the class with the given name. - */ - public Class loadClass(String name) throws ClassNotFoundException { - return Class.forName(name); - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.net.URL object - */ - public URL getResource(String name) { - return getClassLoader().getResource(name); - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.io.InputStream object - */ - public InputStream getResourceAsStream(String name) { - return getClassLoader().getResourceAsStream(name); - } - - private ClassLoader getClassLoader() { - // To follow the same behavior of Class.forName(...) I had to play - // dirty (Supported by Sun, IBM & BEA JVMs) - // ToDo - Test it more. - try { - // Get a reference to this class' class-loader - ClassLoader cl = this.getClass().getClassLoader(); - // Create a method instance represnting the protected - // getCallerClassLoader method of class ClassLoader - Method mthd = ClassLoader.class.getDeclaredMethod( - "getCallerClassLoader", new Class[0]); - // Make the method accessible. - AccessibleObject.setAccessible(new AccessibleObject[] {mthd}, true); - // Try to get the caller's class-loader - return (ClassLoader)mthd.invoke(cl, new Object[0]); - } catch (Exception all) { - // Use this class' class-loader - return this.getClass().getClassLoader(); - } - } - -} diff --git a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/ThreadContextClassLoadHelper.java.bak b/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/ThreadContextClassLoadHelper.java.bak deleted file mode 100644 index 80a9a3f7d..000000000 --- a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/simpl/ThreadContextClassLoadHelper.java.bak +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2004-2005 OpenSymphony - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - */ - -/* - * Previously Copyright (c) 2001-2004 James House - */ -package org.quartz.simpl; - -import org.quartz.spi.ClassLoadHelper; - -import java.net.URL; -import java.io.InputStream; - -/** - * A ClassLoadHelper that uses either the current thread's - * context class loader (Thread.currentThread().getContextClassLoader().loadClass( .. )). - * - * @see org.quartz.spi.ClassLoadHelper - * @see org.quartz.simpl.InitThreadContextClassLoadHelper - * @see org.quartz.simpl.SimpleClassLoadHelper - * @see org.quartz.simpl.CascadingClassLoadHelper - * @see org.quartz.simpl.LoadingLoaderClassLoadHelper - * - * @author jhouse - */ -public class ThreadContextClassLoadHelper implements ClassLoadHelper { - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Interface. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - /** - * Called to give the ClassLoadHelper a chance to initialize itself, - * including the oportunity to "steal" the class loader off of the calling - * thread, which is the thread that is initializing Quartz. - */ - public void initialize() { - } - - /** - * Return the class with the given name. - */ - public Class loadClass(String name) throws ClassNotFoundException { - return getClassLoader().loadClass(name); - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.net.URL object - */ - public URL getResource(String name) { - return getClassLoader().getResource(name); - } - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.io.InputStream object - */ - public InputStream getResourceAsStream(String name) { - return getClassLoader().getResourceAsStream(name); - } - - - private ClassLoader getClassLoader() { - return Thread.currentThread().getContextClassLoader(); - } -} diff --git a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/spi/ClassLoadHelper.java.bak b/fine-quartz-old/src/main/java/com/fr/third/org/quartz/spi/ClassLoadHelper.java.bak deleted file mode 100644 index 63a5930f3..000000000 --- a/fine-quartz-old/src/main/java/com/fr/third/org/quartz/spi/ClassLoadHelper.java.bak +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2004-2005 OpenSymphony - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - */ - -/* - * Previously Copyright (c) 2001-2004 James House - */ -package org.quartz.spi; - -import java.net.URL; -import java.io.InputStream; - -/** - * An interface for classes wishing to provide the service of loading classes - * and resources within the scheduler... - * - * @author jhouse - */ -public interface ClassLoadHelper { - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Interface. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - /** - * Called to give the ClassLoadHelper a chance to initialize itself, - * including the oportunity to "steal" the class loader off of the calling - * thread, which is the thread that is initializing Quartz. - */ - void initialize(); - - /** - * Return the class with the given name. - */ - Class loadClass(String name) throws ClassNotFoundException; - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.net.URL object - */ - URL getResource(String name); - - /** - * Finds a resource with a given name. This method returns null if no - * resource with this name is found. - * @param name name of the desired resource - * @return a java.io.InputStream object - */ - InputStream getResourceAsStream(String name); -}