/** * Find the serialVersionUID field * @param clz The class * @return The field or <code>null</code> if none were found */ private static Field getSerialVersionUID(Class<?> clz) { Class<?> c = clz; while (c != null) { try { Field svuf = SecurityActions.getDeclaredField(clz, "serialVersionUID"); SecurityActions.setAccessible(svuf); return svuf; } catch (Throwable t) { // No serialVersionUID definition } c = c.getSuperclass(); } return null; } }
Field[] fields = SecurityActions.getDeclaredFields(c); if (fields.length > 0)
/** * Checks, if Work implementation class method is synchronized * @param workClass - implementation class * @param methodName - could be "run" or "release" * @return true, if method is synchronized, false elsewhere */ private boolean isWorkMethodSynchronized(Class<? extends Work> workClass, String methodName) { try { Method method = SecurityActions.getMethod(workClass, methodName, new Class[0]); if (Modifier.isSynchronized(method.getModifiers())) return true; } catch (NoSuchMethodException e) { //Never happens, Work implementation should have these methods } return false; }
ClassLoader oldCL = SecurityActions.getThreadContextClassLoader(); SecurityActions.setThreadContextClassLoader(work.getClass().getClassLoader()); SecurityActions.setThreadContextClassLoader(oldCL);
is = SecurityActions.getClassLoader(s.getClass()).getResourceAsStream(clzName); int i = is.read(); while (i != -1)
classes = SecurityActions.getDeclaredClasses(s.getClass()); if (classes != null && classes.length > 0)
/** * Constructor * @param cb The class bundle * @param resourceAdapterClassLoader The resource adapter class loader */ public WorkClassLoader(ClassBundle cb, ResourceAdapterClassLoader resourceAdapterClassLoader) { super(SecurityActions.getClassLoader(WorkClassLoader.class)); List<Class<?>> classes = new ArrayList<Class<?>>(cb.getDefinitions().size()); final boolean trace = log.isTraceEnabled(); for (ClassDefinition cd : cb.getDefinitions()) { if (trace) log.tracef("%s: Defining class=%s", Integer.toHexString(System.identityHashCode(this)), cd.getName()); Class<?> c = defineClass(cd.getName(), cd.getData(), 0, cd.getData().length); classes.add(c); } for (Class<?> c : classes) { if (trace) log.tracef("%s: Resolving class=%s", Integer.toHexString(System.identityHashCode(this)), c.getName()); resolveClass(c); } this.resourceAdapterClassLoader = resourceAdapterClassLoader; }
if (SecurityActions.getClassLoader(work.getClass()) instanceof WorkClassLoader) WorkClassLoader wcl = (WorkClassLoader)SecurityActions.getClassLoader(work.getClass()); ResourceAdapterClassLoader racl = new ResourceAdapterClassLoader(SecurityActions.getClassLoader(resourceAdapter.getClass()), wcl);