From 5b3f31597873b165b6a154393ee4ade942beec0a Mon Sep 17 00:00:00 2001 From: zhouping Date: Mon, 18 Nov 2019 09:43:30 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-1329=20&=20KERNEL-1334=20&=20KERNEL-1310?= =?UTF-8?q?=20fine-quartz=E3=80=81fine-spring=E3=80=81fine-ehcache?= =?UTF-8?q?=E6=94=AF=E6=8C=81JDK11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extended/ExtendedStatisticsImpl.java | 102 +++---- .../quartz/jobs/ee/ejb/EJB3InvokerJob.java | 110 ------- .../org/quartz/jobs/ee/ejb/EJBInvokerJob.java | 277 ------------------ .../xml/XMLSchedulingDataProcessor.java | 2 +- .../AbstractRemoteSlsbInvokerInterceptor.java | 23 -- .../rmi/JndiRmiClientInterceptor.java | 68 +---- .../remoting/rmi/JndiRmiServiceExporter.java | 5 - .../rmi/RmiClientInterceptorUtils.java | 9 +- .../WebMvcConfigurationSupport.java | 1 - 9 files changed, 58 insertions(+), 539 deletions(-) delete mode 100644 fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJB3InvokerJob.java delete mode 100644 fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJBInvokerJob.java diff --git a/fine-ehcache/src/com/fr/third/net/sf/ehcache/statistics/extended/ExtendedStatisticsImpl.java b/fine-ehcache/src/com/fr/third/net/sf/ehcache/statistics/extended/ExtendedStatisticsImpl.java index f02c4a84f..e168d0cd4 100644 --- a/fine-ehcache/src/com/fr/third/net/sf/ehcache/statistics/extended/ExtendedStatisticsImpl.java +++ b/fine-ehcache/src/com/fr/third/net/sf/ehcache/statistics/extended/ExtendedStatisticsImpl.java @@ -66,7 +66,7 @@ import static org.terracotta.context.query.QueryBuilder.queryBuilder; /** * The Class ExtendedStatisticsImpl. - * + * * @author cschanck */ public class ExtendedStatisticsImpl implements ExtendedStatistics { @@ -75,15 +75,15 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { private static final Logger LOGGER = LoggerFactory.getLogger(ExtendedStatisticsImpl.class); /** The standard pass throughs. */ - private final ConcurrentMap> standardPassThroughs = + private final ConcurrentMap> standardPassThroughs = new ConcurrentHashMap>(); /** The standard operations. */ - private final ConcurrentMap> standardOperations = + private final ConcurrentMap> standardOperations = new ConcurrentHashMap>(); /** The custom operations. */ - private final ConcurrentMap, CompoundOperationImpl> customOperations = + private final ConcurrentMap, CompoundOperationImpl> customOperations = new ConcurrentHashMap, CompoundOperationImpl>(); /** custom pass thru stats*/ @@ -155,7 +155,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /** * Instantiates a new extended statistics impl. - * + * * @param manager the manager * @param executor the executor * @param timeToDisable the time to disable @@ -265,7 +265,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#setTimeToDisable(long, java.util.concurrent.TimeUnit) */ @Override @@ -280,7 +280,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#setAlwaysOn(boolean) */ @Override @@ -305,7 +305,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#get() */ @Override @@ -315,7 +315,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#put() */ @Override @@ -375,7 +375,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#search() */ @Override @@ -385,7 +385,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#heapGet() */ @Override @@ -395,7 +395,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#heapPut() */ @Override @@ -405,7 +405,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#heapRemove() */ @Override @@ -415,7 +415,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#offheapGet() */ @Override @@ -425,7 +425,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#offheapPut() */ @Override @@ -435,7 +435,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#offheapRemove() */ @Override @@ -445,7 +445,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#diskGet() */ @Override @@ -455,7 +455,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#diskPut() */ @Override @@ -465,7 +465,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#diskRemove() */ @Override @@ -475,7 +475,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#xaCommit() */ @Override @@ -485,7 +485,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#xaRollback() */ @Override @@ -495,7 +495,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#xaRecovery() */ @Override @@ -505,7 +505,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#eviction() */ @Override @@ -515,7 +515,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#expiry() */ @Override @@ -525,7 +525,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getCacheHitRatio() */ @Override @@ -535,7 +535,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#allGet() */ @Override @@ -545,7 +545,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#allMiss() */ @Override @@ -555,7 +555,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#allPut() */ @Override @@ -565,7 +565,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#heapAllPut() */ @Override @@ -575,7 +575,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#offHeapAllPut() */ @Override @@ -585,7 +585,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#diskAllPut() */ @Override @@ -595,7 +595,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#operations(java.lang.Class, java.lang.String, java.lang.String[]) */ @Override @@ -623,7 +623,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getLocalHeapSize() */ @Override @@ -633,7 +633,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getLocalHeapSizeInBytes() */ @Override @@ -643,7 +643,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getLocalOffHeapSize() */ @Override @@ -653,7 +653,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getLocalOffHeapSizeInBytes() */ @Override @@ -663,7 +663,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getLocalDiskSize() */ @Override @@ -673,7 +673,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getLocalDiskSizeInBytes() */ @Override @@ -683,7 +683,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getRemoteSize() */ @Override @@ -693,7 +693,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getSize() */ @Override @@ -703,7 +703,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#getWriterQueueLength() */ @Override @@ -713,7 +713,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /** * Gets the standard operation. - * + * * @param statistic the statistic * @return the standard operation */ @@ -740,7 +740,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /** * Gets the standard pass through. - * + * * @param statistic the statistic * @return the standard pass through */ @@ -766,13 +766,13 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /** * Find operation statistic. - * + * * @param manager the manager * @param statistic the statistic * @return the operation statistic */ private static OperationStatistic findOperationStatistic(StatisticsManager manager, StandardOperationStatistic statistic) { - Set> results = findOperationStatistic(manager, + Set> results = (Set>)findOperationStatistic(manager, statistic.context(), statistic.type(), statistic.operationName(), @@ -789,7 +789,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /** * Find pass through statistic. - * + * * @param manager the manager * @param statistic the statistic * @return the value statistic @@ -808,7 +808,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /** * Find operation statistic. - * + * * @param the generic type * @param manager the manager * @param contextQuery the context query @@ -843,7 +843,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /** * Find pass through statistic. - * + * * @param manager the manager * @param contextQuery the context query * @param name the name @@ -876,7 +876,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#clusterEvent() */ @Override @@ -886,7 +886,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#clusterEvent() */ @Override @@ -896,7 +896,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics { /* * (non-Javadoc) - * + * * @see ExtendedStatistics#lastRejoinTimeStampInNanos() */ @Override diff --git a/fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJB3InvokerJob.java b/fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJB3InvokerJob.java deleted file mode 100644 index b24a16182..000000000 --- a/fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJB3InvokerJob.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.fr.third.v2.org.quartz.jobs.ee.ejb; - -import java.lang.reflect.InvocationTargetException; - -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import com.fr.third.v2.org.quartz.JobDataMap; -import com.fr.third.v2.org.quartz.JobExecutionContext; -import com.fr.third.v2.org.quartz.JobExecutionException; - -/** - *

- * A Job that invokes a method on an EJB3. - *

- * - *

- * Expects the properties corresponding to the following keys to be in the - * JobDataMap when it executes: - *

    - *
  • EJB_JNDI_NAME_KEY- the JNDI name (location) of the EJB's - * home interface.
  • - *
  • EJB_METHOD_KEY- the name of the method to invoke on the EJB. - *
  • - *
  • EJB_ARGS_KEY- an Object[] of the args to pass to the method - * (optional, if left out, there are no arguments).
  • - *
  • EJB_ARG_TYPES_KEY- an Class[] of the types of the args to - * pass to the method (optional, if left out, the types will be derived by - * calling getClass() on each of the arguments).
  • - *
- *
- * The following keys can also be used at need: - *
    - *
  • INITIAL_CONTEXT_FACTORY - the context factory used to build - * the context.
  • - *
  • PROVIDER_URL - the name of the environment property for - * specifying configuration information for the service provider to use.
  • - *
- *

- * - *

- * The result of the EJB method invocation will be available to - * Job/TriggerListeners via - * {@link com.fr.third.v2.org.quartz.JobExecutionContext#getResult()}. - *

- * - * @author hhuynh - * @see {@link EJBInvokerJob} - */ -public class EJB3InvokerJob extends EJBInvokerJob { - - @Override - public void execute(JobExecutionContext context) - throws JobExecutionException { - JobDataMap dataMap = context.getMergedJobDataMap(); - - String ejb = dataMap.getString(EJB_JNDI_NAME_KEY); - String method = dataMap.getString(EJB_METHOD_KEY); - - Object[] arguments = (Object[]) dataMap.get(EJB_ARGS_KEY); - if (arguments == null) { - arguments = new Object[0]; - } - if (ejb == null) { - throw new JobExecutionException("must specify EJB_JNDI_NAME_KEY"); - } - if (method == null) { - throw new JobExecutionException("must specify EJB_METHOD_KEY"); - } - - InitialContext jndiContext = null; - Object value = null; - try { - try { - jndiContext = getInitialContext(dataMap); - value = jndiContext.lookup(ejb); - } catch (NamingException ne) { - throw new JobExecutionException(ne); - } - - Class[] argTypes = (Class[]) dataMap.get(EJB_ARG_TYPES_KEY); - if (argTypes == null) { - argTypes = new Class[arguments.length]; - for (int i = 0; i < arguments.length; i++) { - argTypes[i] = arguments[i].getClass(); - } - } - - try { - Object returnValue = value.getClass() - .getMethod(method, argTypes).invoke(value, arguments); - context.setResult(returnValue); - } catch (IllegalAccessException iae) { - throw new JobExecutionException(iae); - } catch (InvocationTargetException ite) { - throw new JobExecutionException(ite.getTargetException()); - } catch (NoSuchMethodException nsme) { - throw new JobExecutionException(nsme); - } - } finally { - if (jndiContext != null) { - try { - jndiContext.close(); - } catch (Exception e) { - // ignored - } - } - } - } -} diff --git a/fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJBInvokerJob.java b/fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJBInvokerJob.java deleted file mode 100644 index 68d5ba7a2..000000000 --- a/fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJBInvokerJob.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - * - * 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. - * - */ - -package com.fr.third.v2.org.quartz.jobs.ee.ejb; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.rmi.RemoteException; -import java.util.Hashtable; - -import javax.ejb.EJBHome; -import javax.ejb.EJBMetaData; -import javax.ejb.EJBObject; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.rmi.PortableRemoteObject; - -import com.fr.third.v2.org.quartz.Job; -import com.fr.third.v2.org.quartz.JobDataMap; -import com.fr.third.v2.org.quartz.JobExecutionContext; -import com.fr.third.v2.org.quartz.JobExecutionException; - -/** - *

- * A Job that invokes a method on an EJB. - *

- * - *

- * Expects the properties corresponding to the following keys to be in the - * JobDataMap when it executes: - *

    - *
  • EJB_JNDI_NAME_KEY- the JNDI name (location) of the - * EJB's home interface.
  • - *
  • EJB_METHOD_KEY- the name of the method to invoke on the - * EJB.
  • - *
  • EJB_ARGS_KEY- an Object[] of the args to pass to the - * method (optional, if left out, there are no arguments).
  • - *
  • EJB_ARG_TYPES_KEY- an Class[] of the types of the args to - * pass to the method (optional, if left out, the types will be derived by - * calling getClass() on each of the arguments).
  • - *
- *
- * The following keys can also be used at need: - *
    - *
  • INITIAL_CONTEXT_FACTORY - the context factory used to - * build the context.
  • - *
  • PROVIDER_URL - the name of the environment property - * for specifying configuration information for the service provider to use. - *
  • - *
- *

- * - *

- * The result of the EJB method invocation will be available to - * Job/TriggerListeners via - * {@link com.fr.third.v2.org.quartz.JobExecutionContext#getResult()}. - *

- * - * @author Andrew Collins - * @author James House - * @author Joel Shellman - * @author Chris Bonham - */ -public class EJBInvokerJob implements Job { - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Constants. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - public static final String EJB_JNDI_NAME_KEY = "ejb"; - - public static final String EJB_METHOD_KEY = "method"; - - public static final String EJB_ARG_TYPES_KEY = "argTypes"; - - public static final String EJB_ARGS_KEY = "args"; - - public static final String INITIAL_CONTEXT_FACTORY = "java.naming.factory.initial"; - - public static final String PROVIDER_URL = "java.naming.provider.url"; - - public static final String PRINCIPAL = "java.naming.security.principal"; - - public static final String CREDENTIALS = "java.naming.security.credentials"; - - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Constructors. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - public EJBInvokerJob() { - // nothing - } - - /* - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * Interface. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - - public void execute(JobExecutionContext context) - throws JobExecutionException { - JobDataMap dataMap = context.getMergedJobDataMap(); - - String ejb = dataMap.getString(EJB_JNDI_NAME_KEY); - String method = dataMap.getString(EJB_METHOD_KEY); - Object[] arguments = (Object[]) dataMap.get(EJB_ARGS_KEY); - if (arguments == null) { - arguments = new Object[0]; - } - - if (ejb == null) { - // must specify remote home - throw new JobExecutionException(); - } - - InitialContext jndiContext = null; - - // get initial context - try { - jndiContext = getInitialContext(dataMap); - } catch (NamingException ne) { - throw new JobExecutionException(ne); - } - - try { - Object value = null; - - // locate home interface - try { - value = jndiContext.lookup(ejb); - } catch (NamingException ne) { - throw new JobExecutionException(ne); - } - - // get home interface - EJBHome ejbHome = (EJBHome) PortableRemoteObject.narrow(value, - EJBHome.class); - - // get meta data - EJBMetaData metaData = null; - - try { - metaData = ejbHome.getEJBMetaData(); - } catch (RemoteException re) { - throw new JobExecutionException(re); - } - - // get home interface class - Class homeClass = metaData.getHomeInterfaceClass(); - - // get remote interface class - Class remoteClass = metaData.getRemoteInterfaceClass(); - - // get home interface - ejbHome = (EJBHome) PortableRemoteObject.narrow(ejbHome, homeClass); - - Method methodCreate = null; - - try { - // create method 'create()' on home interface - methodCreate = homeClass.getMethod("create", ((Class[])null)); - } catch (NoSuchMethodException nsme) { - throw new JobExecutionException(nsme); - } - - // create remote object - EJBObject remoteObj = null; - - try { - // invoke 'create()' method on home interface - remoteObj = (EJBObject) methodCreate.invoke(ejbHome, ((Object[])null)); - } catch (IllegalAccessException iae) { - throw new JobExecutionException(iae); - } catch (InvocationTargetException ite) { - throw new JobExecutionException(ite); - } - - // execute user-specified method on remote object - Method methodExecute = null; - - try { - // create method signature - - Class[] argTypes = (Class[]) dataMap.get(EJB_ARG_TYPES_KEY); - if (argTypes == null) { - argTypes = new Class[arguments.length]; - for (int i = 0; i < arguments.length; i++) { - argTypes[i] = arguments[i].getClass(); - } - } - - // get method on remote object - methodExecute = remoteClass.getMethod(method, argTypes); - } catch (NoSuchMethodException nsme) { - throw new JobExecutionException(nsme); - } - - try { - // invoke user-specified method on remote object - Object returnObj = methodExecute.invoke(remoteObj, arguments); - - // Return any result in the JobExecutionContext so it will be - // available to Job/TriggerListeners - context.setResult(returnObj); - } catch (IllegalAccessException iae) { - throw new JobExecutionException(iae); - } catch (InvocationTargetException ite) { - throw new JobExecutionException(ite); - } - } finally { - // Don't close jndiContext until after method execution because - // WebLogic requires context to be open to keep the user credentials - // available. See JIRA Issue: QUARTZ-401 - if (jndiContext != null) { - try { - jndiContext.close(); - } catch (NamingException e) { - // Ignore any errors closing the initial context - } - } - } - } - - protected InitialContext getInitialContext(JobDataMap jobDataMap) - throws NamingException { - Hashtable params = new Hashtable(2); - - String initialContextFactory = - jobDataMap.getString(INITIAL_CONTEXT_FACTORY); - if (initialContextFactory != null) { - params.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); - } - - String providerUrl = jobDataMap.getString(PROVIDER_URL); - if (providerUrl != null) { - params.put(Context.PROVIDER_URL, providerUrl); - } - - String principal = jobDataMap.getString(PRINCIPAL); - if ( principal != null ) { - params.put( Context.SECURITY_PRINCIPAL, principal ); - } - - String credentials = jobDataMap.getString(CREDENTIALS); - if ( credentials != null ) { - params.put( Context.SECURITY_CREDENTIALS, credentials ); - } - - return (params.size() == 0) ? new InitialContext() : new InitialContext(params); - } -} \ No newline at end of file diff --git a/fine-quartz/src/com/fr/third/v2/org/quartz/xml/XMLSchedulingDataProcessor.java b/fine-quartz/src/com/fr/third/v2/org/quartz/xml/XMLSchedulingDataProcessor.java index b70a3992d..8bd0e53fa 100644 --- a/fine-quartz/src/com/fr/third/v2/org/quartz/xml/XMLSchedulingDataProcessor.java +++ b/fine-quartz/src/com/fr/third/v2/org/quartz/xml/XMLSchedulingDataProcessor.java @@ -203,7 +203,7 @@ public class XMLSchedulingDataProcessor implements ErrorHandler { return XMLConstants.NULL_NS_URI; } - public Iterator getPrefixes(String namespaceURI) + public Iterator getPrefixes(String namespaceURI) { // This method isn't necessary for XPath processing. throw new UnsupportedOperationException(); diff --git a/fine-spring/src/com/fr/third/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java b/fine-spring/src/com/fr/third/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java index 6863de22e..96ddade3f 100644 --- a/fine-spring/src/com/fr/third/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java +++ b/fine-spring/src/com/fr/third/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java @@ -23,7 +23,6 @@ import java.rmi.RemoteException; import javax.ejb.EJBHome; import javax.ejb.EJBObject; import javax.naming.NamingException; -import javax.rmi.PortableRemoteObject; import org.aopalliance.intercept.MethodInvocation; @@ -88,28 +87,6 @@ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbI return this.refreshHomeOnConnectFailure; } - - /** - * This overridden lookup implementation performs a narrow operation - * after the JNDI lookup, provided that a home interface is specified. - * @see #setHomeInterface - * @see javax.rmi.PortableRemoteObject#narrow - */ - @Override - protected Object lookup() throws NamingException { - Object homeObject = super.lookup(); - if (this.homeInterface != null) { - try { - homeObject = PortableRemoteObject.narrow(homeObject, this.homeInterface); - } - catch (ClassCastException ex) { - throw new RemoteLookupFailureException( - "Could not narrow EJB home stub to home interface [" + this.homeInterface.getName() + "]", ex); - } - } - return homeObject; - } - /** * Check for EJB3-style home object that serves as EJB component directly. */ diff --git a/fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiClientInterceptor.java b/fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiClientInterceptor.java index 5d6440546..4bb758a0a 100644 --- a/fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiClientInterceptor.java +++ b/fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiClientInterceptor.java @@ -21,12 +21,9 @@ import java.lang.reflect.Method; import java.rmi.RemoteException; import javax.naming.Context; import javax.naming.NamingException; -import javax.rmi.PortableRemoteObject; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; -import org.omg.CORBA.OBJECT_NOT_EXIST; -import org.omg.CORBA.SystemException; import com.fr.third.springframework.aop.support.AopUtils; import com.fr.third.springframework.beans.factory.InitializingBean; @@ -41,8 +38,8 @@ import com.fr.third.springframework.remoting.support.RemoteInvocationFactory; import com.fr.third.springframework.util.ReflectionUtils; /** - * {@link org.aopalliance.intercept.MethodInterceptor} for accessing RMI services from JNDI. - * Typically used for RMI-IIOP (CORBA), but can also be used for EJB home objects + * {@link org.aopalliance.intercept.MethodInterceptor} for accessing RMI services + * from JNDI.Typically used for RMI-IIOP, but can also be used for EJB home objects * (for example, a Stateful Session Bean home). In contrast to a plain JNDI lookup, * this accessor also performs narrowing through PortableRemoteObject. * @@ -74,7 +71,6 @@ import com.fr.third.springframework.util.ReflectionUtils; * @see com.fr.third.springframework.remoting.RemoteAccessException * @see java.rmi.RemoteException * @see java.rmi.Remote - * @see javax.rmi.PortableRemoteObject#narrow */ public class JndiRmiClientInterceptor extends JndiObjectLocator implements MethodInterceptor, InitializingBean { @@ -227,17 +223,7 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho */ protected Object lookupStub() throws RemoteLookupFailureException { try { - Object stub = lookup(); - if (getServiceInterface() != null && !(stub instanceof RmiInvocationHandler)) { - try { - stub = PortableRemoteObject.narrow(stub, getServiceInterface()); - } - catch (ClassCastException ex) { - throw new RemoteLookupFailureException( - "Could not narrow RMI stub to service interface [" + getServiceInterface().getName() + "]", ex); - } - } - return stub; + return lookup(); } catch (NamingException ex) { throw new RemoteLookupFailureException("JNDI lookup for RMI service [" + getJndiName() + "] failed", ex); @@ -306,14 +292,6 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho throw ex; } } - catch (SystemException ex) { - if (isConnectFailure(ex)) { - return handleRemoteConnectFailure(invocation, ex); - } - else { - throw ex; - } - } finally { getJndiTemplate().releaseContext(ctx); } @@ -330,17 +308,6 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho return RmiClientInterceptorUtils.isConnectFailure(ex); } - /** - * Determine whether the given CORBA exception indicates a connect failure. - *

The default implementation checks for CORBA's - * {@link org.omg.CORBA.OBJECT_NOT_EXIST} exception. - * @param ex the RMI exception to check - * @return whether the exception should be treated as connect failure - */ - protected boolean isConnectFailure(SystemException ex) { - return (ex instanceof OBJECT_NOT_EXIST); - } - /** * Refresh the stub and retry the remote invocation if necessary. *

If not configured to refresh on connect failure, this method @@ -402,9 +369,6 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho catch (RemoteException ex) { throw convertRmiAccessException(ex, invocation.getMethod()); } - catch (SystemException ex) { - throw convertCorbaAccessException(ex, invocation.getMethod()); - } catch (InvocationTargetException ex) { throw ex.getTargetException(); } @@ -423,9 +387,6 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho if (targetEx instanceof RemoteException) { throw convertRmiAccessException((RemoteException) targetEx, invocation.getMethod()); } - else if (targetEx instanceof SystemException) { - throw convertCorbaAccessException((SystemException) targetEx, invocation.getMethod()); - } else { throw targetEx; } @@ -483,27 +444,4 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho return RmiClientInterceptorUtils.convertRmiAccessException(method, ex, isConnectFailure(ex), getJndiName()); } - /** - * Convert the given CORBA SystemException that happened during remote access - * to Spring's RemoteAccessException if the method signature does not declare - * RemoteException. Else, return the SystemException wrapped in a RemoteException. - * @param method the invoked method - * @param ex the RemoteException that happened - * @return the exception to be thrown to the caller - */ - private Exception convertCorbaAccessException(SystemException ex, Method method) { - if (ReflectionUtils.declaresException(method, RemoteException.class)) { - // A traditional RMI service: wrap CORBA exceptions in standard RemoteExceptions. - return new RemoteException("Failed to access CORBA service [" + getJndiName() + "]", ex); - } - else { - if (isConnectFailure(ex)) { - return new RemoteConnectFailureException("Could not connect to CORBA service [" + getJndiName() + "]", ex); - } - else { - return new RemoteAccessException("Could not access CORBA service [" + getJndiName() + "]", ex); - } - } - } - } diff --git a/fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiServiceExporter.java b/fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiServiceExporter.java index 5297f83f1..1ec5dfb68 100644 --- a/fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiServiceExporter.java +++ b/fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiServiceExporter.java @@ -22,7 +22,6 @@ import java.rmi.RemoteException; import java.util.Properties; import javax.naming.NamingException; -import javax.rmi.PortableRemoteObject; import com.fr.third.springframework.beans.factory.DisposableBean; import com.fr.third.springframework.beans.factory.InitializingBean; @@ -32,7 +31,6 @@ import com.fr.third.springframework.jndi.JndiTemplate; * Service exporter which binds RMI services to JNDI. * Typically used for RMI-IIOP (CORBA). * - *

Exports services via the {@link javax.rmi.PortableRemoteObject} class. * You need to run "rmic" with the "-iiop" option to generate corresponding * stubs and skeletons for each exported service. * @@ -64,7 +62,6 @@ import com.fr.third.springframework.jndi.JndiTemplate; * @see #setJndiName * @see JndiRmiClientInterceptor * @see JndiRmiProxyFactoryBean - * @see javax.rmi.PortableRemoteObject#exportObject */ public class JndiRmiServiceExporter extends RmiBasedExporter implements InitializingBean, DisposableBean { @@ -118,7 +115,6 @@ public class JndiRmiServiceExporter extends RmiBasedExporter implements Initiali // Initialize and cache exported object. this.exportedObject = getObjectToExport(); - PortableRemoteObject.exportObject(this.exportedObject); rebind(); } @@ -144,7 +140,6 @@ public class JndiRmiServiceExporter extends RmiBasedExporter implements Initiali logger.info("Unbinding RMI service from JNDI location [" + this.jndiName + "]"); } this.jndiTemplate.unbind(this.jndiName); - PortableRemoteObject.unexportObject(this.exportedObject); } } diff --git a/fine-spring/src/com/fr/third/springframework/remoting/rmi/RmiClientInterceptorUtils.java b/fine-spring/src/com/fr/third/springframework/remoting/rmi/RmiClientInterceptorUtils.java index 400c64e84..5c1fa0d61 100644 --- a/fine-spring/src/com/fr/third/springframework/remoting/rmi/RmiClientInterceptorUtils.java +++ b/fine-spring/src/com/fr/third/springframework/remoting/rmi/RmiClientInterceptorUtils.java @@ -29,10 +29,6 @@ import java.rmi.UnknownHostException; import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.NO_RESPONSE; -import org.omg.CORBA.SystemException; import com.fr.third.springframework.remoting.RemoteAccessException; import com.fr.third.springframework.remoting.RemoteConnectFailureException; @@ -184,8 +180,9 @@ public abstract class RmiClientInterceptorUtils { * @param ex the RMI exception to check */ private static boolean isCorbaConnectFailure(Throwable ex) { - return ((ex instanceof COMM_FAILURE || ex instanceof NO_RESPONSE) && - ((SystemException) ex).completed == CompletionStatus.COMPLETED_NO); + return (ex instanceof ConnectException || ex instanceof ConnectIOException || + ex instanceof UnknownHostException || ex instanceof NoSuchObjectException || + ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException); } } diff --git a/fine-spring/src/com/fr/third/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java b/fine-spring/src/com/fr/third/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java index ce35a6e69..0920a2016 100644 --- a/fine-spring/src/com/fr/third/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java +++ b/fine-spring/src/com/fr/third/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java @@ -76,7 +76,6 @@ import com.fr.third.springframework.web.servlet.mvc.method.annotation.ExceptionH import com.fr.third.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import com.fr.third.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import com.fr.third.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver; -import com.sun.prism.impl.BaseContext; /** * This is the main class providing the configuration behind the MVC Java config.