Browse Source

KERNEL-1329 & KERNEL-1334 & KERNEL-1310 fine-quartz、fine-spring、fine-ehcache支持JDK11

research/11.0
zhouping 5 years ago
parent
commit
5b3f315978
  1. 102
      fine-ehcache/src/com/fr/third/net/sf/ehcache/statistics/extended/ExtendedStatisticsImpl.java
  2. 110
      fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJB3InvokerJob.java
  3. 277
      fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJBInvokerJob.java
  4. 2
      fine-quartz/src/com/fr/third/v2/org/quartz/xml/XMLSchedulingDataProcessor.java
  5. 23
      fine-spring/src/com/fr/third/springframework/ejb/access/AbstractRemoteSlsbInvokerInterceptor.java
  6. 68
      fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiClientInterceptor.java
  7. 5
      fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiServiceExporter.java
  8. 9
      fine-spring/src/com/fr/third/springframework/remoting/rmi/RmiClientInterceptorUtils.java
  9. 1
      fine-spring/src/com/fr/third/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java

102
fine-ehcache/src/com/fr/third/net/sf/ehcache/statistics/extended/ExtendedStatisticsImpl.java vendored

@ -66,7 +66,7 @@ import static org.terracotta.context.query.QueryBuilder.queryBuilder;
/** /**
* The Class ExtendedStatisticsImpl. * The Class ExtendedStatisticsImpl.
* *
* @author cschanck * @author cschanck
*/ */
public class ExtendedStatisticsImpl implements ExtendedStatistics { public class ExtendedStatisticsImpl implements ExtendedStatistics {
@ -75,15 +75,15 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
private static final Logger LOGGER = LoggerFactory.getLogger(ExtendedStatisticsImpl.class); private static final Logger LOGGER = LoggerFactory.getLogger(ExtendedStatisticsImpl.class);
/** The standard pass throughs. */ /** The standard pass throughs. */
private final ConcurrentMap<StandardPassThroughStatistic, Statistic<Number>> standardPassThroughs = private final ConcurrentMap<StandardPassThroughStatistic, Statistic<Number>> standardPassThroughs =
new ConcurrentHashMap<StandardPassThroughStatistic, Statistic<Number>>(); new ConcurrentHashMap<StandardPassThroughStatistic, Statistic<Number>>();
/** The standard operations. */ /** The standard operations. */
private final ConcurrentMap<StandardOperationStatistic, Operation<?>> standardOperations = private final ConcurrentMap<StandardOperationStatistic, Operation<?>> standardOperations =
new ConcurrentHashMap<StandardOperationStatistic, Operation<?>>(); new ConcurrentHashMap<StandardOperationStatistic, Operation<?>>();
/** The custom operations. */ /** The custom operations. */
private final ConcurrentMap<OperationStatistic<?>, CompoundOperationImpl<?>> customOperations = private final ConcurrentMap<OperationStatistic<?>, CompoundOperationImpl<?>> customOperations =
new ConcurrentHashMap<OperationStatistic<?>, CompoundOperationImpl<?>>(); new ConcurrentHashMap<OperationStatistic<?>, CompoundOperationImpl<?>>();
/** custom pass thru stats*/ /** custom pass thru stats*/
@ -155,7 +155,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/** /**
* Instantiates a new extended statistics impl. * Instantiates a new extended statistics impl.
* *
* @param manager the manager * @param manager the manager
* @param executor the executor * @param executor the executor
* @param timeToDisable the time to disable * @param timeToDisable the time to disable
@ -265,7 +265,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#setTimeToDisable(long, java.util.concurrent.TimeUnit) * @see ExtendedStatistics#setTimeToDisable(long, java.util.concurrent.TimeUnit)
*/ */
@Override @Override
@ -280,7 +280,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#setAlwaysOn(boolean) * @see ExtendedStatistics#setAlwaysOn(boolean)
*/ */
@Override @Override
@ -305,7 +305,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#get() * @see ExtendedStatistics#get()
*/ */
@Override @Override
@ -315,7 +315,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#put() * @see ExtendedStatistics#put()
*/ */
@Override @Override
@ -375,7 +375,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#search() * @see ExtendedStatistics#search()
*/ */
@Override @Override
@ -385,7 +385,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#heapGet() * @see ExtendedStatistics#heapGet()
*/ */
@Override @Override
@ -395,7 +395,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#heapPut() * @see ExtendedStatistics#heapPut()
*/ */
@Override @Override
@ -405,7 +405,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#heapRemove() * @see ExtendedStatistics#heapRemove()
*/ */
@Override @Override
@ -415,7 +415,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#offheapGet() * @see ExtendedStatistics#offheapGet()
*/ */
@Override @Override
@ -425,7 +425,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#offheapPut() * @see ExtendedStatistics#offheapPut()
*/ */
@Override @Override
@ -435,7 +435,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#offheapRemove() * @see ExtendedStatistics#offheapRemove()
*/ */
@Override @Override
@ -445,7 +445,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#diskGet() * @see ExtendedStatistics#diskGet()
*/ */
@Override @Override
@ -455,7 +455,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#diskPut() * @see ExtendedStatistics#diskPut()
*/ */
@Override @Override
@ -465,7 +465,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#diskRemove() * @see ExtendedStatistics#diskRemove()
*/ */
@Override @Override
@ -475,7 +475,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#xaCommit() * @see ExtendedStatistics#xaCommit()
*/ */
@Override @Override
@ -485,7 +485,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#xaRollback() * @see ExtendedStatistics#xaRollback()
*/ */
@Override @Override
@ -495,7 +495,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#xaRecovery() * @see ExtendedStatistics#xaRecovery()
*/ */
@Override @Override
@ -505,7 +505,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#eviction() * @see ExtendedStatistics#eviction()
*/ */
@Override @Override
@ -515,7 +515,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#expiry() * @see ExtendedStatistics#expiry()
*/ */
@Override @Override
@ -525,7 +525,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getCacheHitRatio() * @see ExtendedStatistics#getCacheHitRatio()
*/ */
@Override @Override
@ -535,7 +535,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#allGet() * @see ExtendedStatistics#allGet()
*/ */
@Override @Override
@ -545,7 +545,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#allMiss() * @see ExtendedStatistics#allMiss()
*/ */
@Override @Override
@ -555,7 +555,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#allPut() * @see ExtendedStatistics#allPut()
*/ */
@Override @Override
@ -565,7 +565,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#heapAllPut() * @see ExtendedStatistics#heapAllPut()
*/ */
@Override @Override
@ -575,7 +575,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#offHeapAllPut() * @see ExtendedStatistics#offHeapAllPut()
*/ */
@Override @Override
@ -585,7 +585,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#diskAllPut() * @see ExtendedStatistics#diskAllPut()
*/ */
@Override @Override
@ -595,7 +595,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#operations(java.lang.Class, java.lang.String, java.lang.String[]) * @see ExtendedStatistics#operations(java.lang.Class, java.lang.String, java.lang.String[])
*/ */
@Override @Override
@ -623,7 +623,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getLocalHeapSize() * @see ExtendedStatistics#getLocalHeapSize()
*/ */
@Override @Override
@ -633,7 +633,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getLocalHeapSizeInBytes() * @see ExtendedStatistics#getLocalHeapSizeInBytes()
*/ */
@Override @Override
@ -643,7 +643,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getLocalOffHeapSize() * @see ExtendedStatistics#getLocalOffHeapSize()
*/ */
@Override @Override
@ -653,7 +653,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getLocalOffHeapSizeInBytes() * @see ExtendedStatistics#getLocalOffHeapSizeInBytes()
*/ */
@Override @Override
@ -663,7 +663,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getLocalDiskSize() * @see ExtendedStatistics#getLocalDiskSize()
*/ */
@Override @Override
@ -673,7 +673,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getLocalDiskSizeInBytes() * @see ExtendedStatistics#getLocalDiskSizeInBytes()
*/ */
@Override @Override
@ -683,7 +683,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getRemoteSize() * @see ExtendedStatistics#getRemoteSize()
*/ */
@Override @Override
@ -693,7 +693,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getSize() * @see ExtendedStatistics#getSize()
*/ */
@Override @Override
@ -703,7 +703,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#getWriterQueueLength() * @see ExtendedStatistics#getWriterQueueLength()
*/ */
@Override @Override
@ -713,7 +713,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/** /**
* Gets the standard operation. * Gets the standard operation.
* *
* @param statistic the statistic * @param statistic the statistic
* @return the standard operation * @return the standard operation
*/ */
@ -740,7 +740,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/** /**
* Gets the standard pass through. * Gets the standard pass through.
* *
* @param statistic the statistic * @param statistic the statistic
* @return the standard pass through * @return the standard pass through
*/ */
@ -766,13 +766,13 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/** /**
* Find operation statistic. * Find operation statistic.
* *
* @param manager the manager * @param manager the manager
* @param statistic the statistic * @param statistic the statistic
* @return the operation statistic * @return the operation statistic
*/ */
private static OperationStatistic findOperationStatistic(StatisticsManager manager, StandardOperationStatistic statistic) { private static OperationStatistic findOperationStatistic(StatisticsManager manager, StandardOperationStatistic statistic) {
Set<OperationStatistic<? extends Enum>> results = findOperationStatistic(manager, Set<OperationStatistic<? extends Enum>> results = (Set<OperationStatistic<? extends Enum>>)findOperationStatistic(manager,
statistic.context(), statistic.context(),
statistic.type(), statistic.type(),
statistic.operationName(), statistic.operationName(),
@ -789,7 +789,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/** /**
* Find pass through statistic. * Find pass through statistic.
* *
* @param manager the manager * @param manager the manager
* @param statistic the statistic * @param statistic the statistic
* @return the value statistic * @return the value statistic
@ -808,7 +808,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/** /**
* Find operation statistic. * Find operation statistic.
* *
* @param <T> the generic type * @param <T> the generic type
* @param manager the manager * @param manager the manager
* @param contextQuery the context query * @param contextQuery the context query
@ -843,7 +843,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/** /**
* Find pass through statistic. * Find pass through statistic.
* *
* @param manager the manager * @param manager the manager
* @param contextQuery the context query * @param contextQuery the context query
* @param name the name * @param name the name
@ -876,7 +876,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#clusterEvent() * @see ExtendedStatistics#clusterEvent()
*/ */
@Override @Override
@ -886,7 +886,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#clusterEvent() * @see ExtendedStatistics#clusterEvent()
*/ */
@Override @Override
@ -896,7 +896,7 @@ public class ExtendedStatisticsImpl implements ExtendedStatistics {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see ExtendedStatistics#lastRejoinTimeStampInNanos() * @see ExtendedStatistics#lastRejoinTimeStampInNanos()
*/ */
@Override @Override

110
fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJB3InvokerJob.java

@ -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;
/**
* <p>
* A <code>Job</code> that invokes a method on an EJB3.
* </p>
*
* <p>
* Expects the properties corresponding to the following keys to be in the
* <code>JobDataMap</code> when it executes:
* <ul>
* <li><code>EJB_JNDI_NAME_KEY</code>- the JNDI name (location) of the EJB's
* home interface.</li>
* <li><code>EJB_METHOD_KEY</code>- the name of the method to invoke on the EJB.
* </li>
* <li><code>EJB_ARGS_KEY</code>- an Object[] of the args to pass to the method
* (optional, if left out, there are no arguments).</li>
* <li><code>EJB_ARG_TYPES_KEY</code>- 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).</li>
* </ul>
* <br/>
* The following keys can also be used at need:
* <ul>
* <li><code>INITIAL_CONTEXT_FACTORY</code> - the context factory used to build
* the context.</li>
* <li><code>PROVIDER_URL</code> - the name of the environment property for
* specifying configuration information for the service provider to use.</li>
* </ul>
* </p>
*
* <p>
* The result of the EJB method invocation will be available to
* <code>Job/TriggerListener</code>s via
* <code>{@link com.fr.third.v2.org.quartz.JobExecutionContext#getResult()}</code>.
* </p>
*
* @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
}
}
}
}
}

277
fine-quartz/src/com/fr/third/v2/org/quartz/jobs/ee/ejb/EJBInvokerJob.java

@ -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;
/**
* <p>
* A <code>Job</code> that invokes a method on an EJB.
* </p>
*
* <p>
* Expects the properties corresponding to the following keys to be in the
* <code>JobDataMap</code> when it executes:
* <ul>
* <li><code>EJB_JNDI_NAME_KEY</code>- the JNDI name (location) of the
* EJB's home interface.</li>
* <li><code>EJB_METHOD_KEY</code>- the name of the method to invoke on the
* EJB.</li>
* <li><code>EJB_ARGS_KEY</code>- an Object[] of the args to pass to the
* method (optional, if left out, there are no arguments).</li>
* <li><code>EJB_ARG_TYPES_KEY</code>- 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).</li>
* </ul>
* <br/>
* The following keys can also be used at need:
* <ul>
* <li><code>INITIAL_CONTEXT_FACTORY</code> - the context factory used to
* build the context.</li>
* <li><code>PROVIDER_URL</code> - the name of the environment property
* for specifying configuration information for the service provider to use.
* </li>
* </ul>
* </p>
*
* <p>
* The result of the EJB method invocation will be available to
* <code>Job/TriggerListener</code>s via
* <code>{@link com.fr.third.v2.org.quartz.JobExecutionContext#getResult()}</code>.
* </p>
*
* @author Andrew Collins
* @author James House
* @author Joel Shellman
* @author <a href="mailto:bonhamcm@thirdeyeconsulting.com">Chris Bonham</a>
*/
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<String, String> params = new Hashtable<String, String>(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);
}
}

2
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; return XMLConstants.NULL_NS_URI;
} }
public Iterator<?> getPrefixes(String namespaceURI) public Iterator<String> getPrefixes(String namespaceURI)
{ {
// This method isn't necessary for XPath processing. // This method isn't necessary for XPath processing.
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

23
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.EJBHome;
import javax.ejb.EJBObject; import javax.ejb.EJBObject;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
@ -88,28 +87,6 @@ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbI
return this.refreshHomeOnConnectFailure; 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. * Check for EJB3-style home object that serves as EJB component directly.
*/ */

68
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 java.rmi.RemoteException;
import javax.naming.Context; import javax.naming.Context;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation; 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.aop.support.AopUtils;
import com.fr.third.springframework.beans.factory.InitializingBean; 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; import com.fr.third.springframework.util.ReflectionUtils;
/** /**
* {@link org.aopalliance.intercept.MethodInterceptor} for accessing RMI services from JNDI. * {@link org.aopalliance.intercept.MethodInterceptor} for accessing RMI services
* Typically used for RMI-IIOP (CORBA), but can also be used for EJB home objects * 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, * (for example, a Stateful Session Bean home). In contrast to a plain JNDI lookup,
* this accessor also performs narrowing through PortableRemoteObject. * 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 com.fr.third.springframework.remoting.RemoteAccessException
* @see java.rmi.RemoteException * @see java.rmi.RemoteException
* @see java.rmi.Remote * @see java.rmi.Remote
* @see javax.rmi.PortableRemoteObject#narrow
*/ */
public class JndiRmiClientInterceptor extends JndiObjectLocator implements MethodInterceptor, InitializingBean { public class JndiRmiClientInterceptor extends JndiObjectLocator implements MethodInterceptor, InitializingBean {
@ -227,17 +223,7 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
*/ */
protected Object lookupStub() throws RemoteLookupFailureException { protected Object lookupStub() throws RemoteLookupFailureException {
try { try {
Object stub = lookup(); return 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;
} }
catch (NamingException ex) { catch (NamingException ex) {
throw new RemoteLookupFailureException("JNDI lookup for RMI service [" + getJndiName() + "] failed", 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; throw ex;
} }
} }
catch (SystemException ex) {
if (isConnectFailure(ex)) {
return handleRemoteConnectFailure(invocation, ex);
}
else {
throw ex;
}
}
finally { finally {
getJndiTemplate().releaseContext(ctx); getJndiTemplate().releaseContext(ctx);
} }
@ -330,17 +308,6 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
return RmiClientInterceptorUtils.isConnectFailure(ex); return RmiClientInterceptorUtils.isConnectFailure(ex);
} }
/**
* Determine whether the given CORBA exception indicates a connect failure.
* <p>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. * Refresh the stub and retry the remote invocation if necessary.
* <p>If not configured to refresh on connect failure, this method * <p>If not configured to refresh on connect failure, this method
@ -402,9 +369,6 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
catch (RemoteException ex) { catch (RemoteException ex) {
throw convertRmiAccessException(ex, invocation.getMethod()); throw convertRmiAccessException(ex, invocation.getMethod());
} }
catch (SystemException ex) {
throw convertCorbaAccessException(ex, invocation.getMethod());
}
catch (InvocationTargetException ex) { catch (InvocationTargetException ex) {
throw ex.getTargetException(); throw ex.getTargetException();
} }
@ -423,9 +387,6 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
if (targetEx instanceof RemoteException) { if (targetEx instanceof RemoteException) {
throw convertRmiAccessException((RemoteException) targetEx, invocation.getMethod()); throw convertRmiAccessException((RemoteException) targetEx, invocation.getMethod());
} }
else if (targetEx instanceof SystemException) {
throw convertCorbaAccessException((SystemException) targetEx, invocation.getMethod());
}
else { else {
throw targetEx; throw targetEx;
} }
@ -483,27 +444,4 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
return RmiClientInterceptorUtils.convertRmiAccessException(method, ex, isConnectFailure(ex), getJndiName()); 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);
}
}
}
} }

5
fine-spring/src/com/fr/third/springframework/remoting/rmi/JndiRmiServiceExporter.java

@ -22,7 +22,6 @@ import java.rmi.RemoteException;
import java.util.Properties; import java.util.Properties;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import com.fr.third.springframework.beans.factory.DisposableBean; import com.fr.third.springframework.beans.factory.DisposableBean;
import com.fr.third.springframework.beans.factory.InitializingBean; 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. * Service exporter which binds RMI services to JNDI.
* Typically used for RMI-IIOP (CORBA). * Typically used for RMI-IIOP (CORBA).
* *
* <p>Exports services via the {@link javax.rmi.PortableRemoteObject} class.
* You need to run "rmic" with the "-iiop" option to generate corresponding * You need to run "rmic" with the "-iiop" option to generate corresponding
* stubs and skeletons for each exported service. * stubs and skeletons for each exported service.
* *
@ -64,7 +62,6 @@ import com.fr.third.springframework.jndi.JndiTemplate;
* @see #setJndiName * @see #setJndiName
* @see JndiRmiClientInterceptor * @see JndiRmiClientInterceptor
* @see JndiRmiProxyFactoryBean * @see JndiRmiProxyFactoryBean
* @see javax.rmi.PortableRemoteObject#exportObject
*/ */
public class JndiRmiServiceExporter extends RmiBasedExporter implements InitializingBean, DisposableBean { public class JndiRmiServiceExporter extends RmiBasedExporter implements InitializingBean, DisposableBean {
@ -118,7 +115,6 @@ public class JndiRmiServiceExporter extends RmiBasedExporter implements Initiali
// Initialize and cache exported object. // Initialize and cache exported object.
this.exportedObject = getObjectToExport(); this.exportedObject = getObjectToExport();
PortableRemoteObject.exportObject(this.exportedObject);
rebind(); rebind();
} }
@ -144,7 +140,6 @@ public class JndiRmiServiceExporter extends RmiBasedExporter implements Initiali
logger.info("Unbinding RMI service from JNDI location [" + this.jndiName + "]"); logger.info("Unbinding RMI service from JNDI location [" + this.jndiName + "]");
} }
this.jndiTemplate.unbind(this.jndiName); this.jndiTemplate.unbind(this.jndiName);
PortableRemoteObject.unexportObject(this.exportedObject);
} }
} }

9
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.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; 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.RemoteAccessException;
import com.fr.third.springframework.remoting.RemoteConnectFailureException; import com.fr.third.springframework.remoting.RemoteConnectFailureException;
@ -184,8 +180,9 @@ public abstract class RmiClientInterceptorUtils {
* @param ex the RMI exception to check * @param ex the RMI exception to check
*/ */
private static boolean isCorbaConnectFailure(Throwable ex) { private static boolean isCorbaConnectFailure(Throwable ex) {
return ((ex instanceof COMM_FAILURE || ex instanceof NO_RESPONSE) && return (ex instanceof ConnectException || ex instanceof ConnectIOException ||
((SystemException) ex).completed == CompletionStatus.COMPLETED_NO); ex instanceof UnknownHostException || ex instanceof NoSuchObjectException ||
ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException);
} }
} }

1
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.RequestMappingHandlerAdapter;
import com.fr.third.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import com.fr.third.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import com.fr.third.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver; 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. * This is the main class providing the configuration behind the MVC Java config.

Loading…
Cancel
Save