public static Object proxy(final BeanContext beanContext, final Class<?>[] itfs) { if (beanContext.isLocalbean()) { return LocalBeanProxyFactory.newProxyInstance(itfs[0].getClassLoader(), new Handler(beanContext), itfs[0], IntraVmProxy.class, Serializable.class); } return Proxy.newProxyInstance(itfs[0].getClassLoader(), itfs, new Handler(beanContext)); }
public static Object proxy(final BeanContext beanContext, final Class<?>[] itfs) { if (beanContext.isLocalbean()) { return LocalBeanProxyFactory.newProxyInstance(itfs[0].getClassLoader(), new Handler(beanContext), itfs[0], IntraVmProxy.class, Serializable.class); } return Proxy.newProxyInstance(itfs[0].getClassLoader(), itfs, new Handler(beanContext)); }
public static Object simpleProxy(final BeanContext beanContext, final Class<?>[] itfs) { if (beanContext.isLocalbean()) { return LocalBeanProxyFactory.newProxyInstance(itfs[0].getClassLoader(), new Handler(beanContext), itfs[0]); } return Proxy.newProxyInstance(itfs[0].getClassLoader(), itfs, new Handler(beanContext)); }
public static Object simpleProxy(final BeanContext beanContext, final Class<?>[] itfs) { if (beanContext.isLocalbean()) { return LocalBeanProxyFactory.newProxyInstance(itfs[0].getClassLoader(), new Handler(beanContext), itfs[0]); } return Proxy.newProxyInstance(itfs[0].getClassLoader(), itfs, new Handler(beanContext)); }
@Override public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException { if (xaResource != null && xaResourceWrapper != null) { xaResource = xaResourceWrapper.wrap(xaResource, container.getContainerID().toString()); } final EndpointHandler endpointHandler = new EndpointHandler(container, beanContext, instanceFactory, xaResource); try { return (MessageEndpoint) LocalBeanProxyFactory.constructProxy(proxy, endpointHandler); } catch (final InternalError e) { // should be useless //try to create the proxy with tccl once again. try { return MessageEndpoint.class.cast(LocalBeanProxyFactory.newProxyInstance(Thread.currentThread().getContextClassLoader(), endpointHandler, beanContext.getBeanClass(), interfaces)); } catch (final InternalError ie) { try { return MessageEndpoint.class.cast(LocalBeanProxyFactory.newProxyInstance(classLoader, endpointHandler, beanContext.getBeanClass(), interfaces)); } catch (final InternalError ie2) { // no-op } } throw e; } }
@Override public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException { if (xaResource != null && xaResourceWrapper != null) { xaResource = xaResourceWrapper.wrap(xaResource, container.getContainerID().toString()); } InvocationHandler endpointHandler = null; if (usePool) { endpointHandler = new PoolEndpointHandler(container, beanContext, instanceManager, xaResource); } else { endpointHandler = new EndpointHandler(container, beanContext, instanceFactory, xaResource); } try { return (MessageEndpoint) LocalBeanProxyFactory.constructProxy(proxy, endpointHandler); } catch (final InternalError e) { // should be useless //try to create the proxy with tccl once again. try { return MessageEndpoint.class.cast(LocalBeanProxyFactory.newProxyInstance(Thread.currentThread().getContextClassLoader(), endpointHandler, beanContext.getBeanClass(), interfaces)); } catch (final InternalError ie) { try { return MessageEndpoint.class.cast(LocalBeanProxyFactory.newProxyInstance(classLoader, endpointHandler, beanContext.getBeanClass(), interfaces)); } catch (final InternalError ie2) { // no-op } } throw e; } }
public static Object subclassProxy(final BeanContext beanContext) { try { return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext), beanContext.getBeanClass(), IntraVmProxy.class, Serializable.class); } catch (final InternalError ie) { // try without intravmproxy which is maybe not loadable (in OSGi it can happen) return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext), beanContext.getBeanClass(), Serializable.class); } }
public static Object subclassProxy(final BeanContext beanContext) { try { return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext), beanContext.getBeanClass(), IntraVmProxy.class, Serializable.class); } catch (final InternalError ie) { // try without intravmproxy which is maybe not loadable (in OSGi it can happen) return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext), beanContext.getBeanClass(), Serializable.class); } }
public Object createProxy(Object primaryKey) { try { InterfaceType objectInterfaceType = this.interfaceType.getCounterpart(); EjbObjectProxyHandler handler = newEjbObjectHandler(getDeploymentInfo(), primaryKey, objectInterfaceType, this.getInterfaces()); List<Class> proxyInterfaces = new ArrayList<Class>(handler.getInterfaces().size() + 1); proxyInterfaces.addAll(handler.getInterfaces()); proxyInterfaces.add(IntraVmProxy.class); if (InterfaceType.LOCALBEAN.equals(objectInterfaceType)) { return LocalBeanProxyFactory.newProxyInstance(handler.getDeploymentInfo().getClassLoader(), handler.getDeploymentInfo().getBeanClass(), handler); } else { return ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[]{}), handler); } } catch (IllegalAccessException iae) { throw new RuntimeException("Could not create IVM proxy for " + getInterfaces().get(0), iae); } }