/** * Build a new EJB2 Invocation Handler for the home interface. * @param classLoader the classloader to use (when the smart factory is used, it is the smart classloader) * @param clusterViewManager A manager of the cluster view * @param objectName a name of the object * @param protocolName a protocol to perform the invocation * @param homeClass a home interface */ public HAEJBHomeInvocationHandler( final ClassLoader classLoader, final ClusterViewManager clusterViewManager, final String objectName, final String protocolName, final Class<? extends EJBHome> homeClass) { super(clusterViewManager, objectName, protocolName, true, homeClass); this.classLoader = classLoader; try { remoteClass = clusterViewManager.getRemoteClass(objectName); } catch (ObjectNotFoundException e) { throw new HAEJBInvocationHandlerException("Cannot get the remote class for " + objectName, e); } }
/** * Build a new EJB2 Invocation Handler for the home interface. * @param classLoader the classloader to use (when the smart factory is used, it is the smart classloader) * @param clusterViewManager A manager of the cluster view * @param objectName a name of the object * @param protocolName a protocol to perform the invocation * @param homeClass a home interface */ public EJBHomeInvocationHandler( final ClassLoader classLoader, final ClusterViewManager clusterViewManager, final String objectName, final String protocolName, final Class<? extends EJBHome> homeClass) { super(clusterViewManager, objectName, protocolName, false, homeClass); this.classLoader = classLoader; try { remoteClass = clusterViewManager.getRemoteClass(objectName); } catch (ObjectNotFoundException e) { throw new EJBInvocationHandlerException("Cannot get the remote class for " + objectName, e); } }
@Override protected void checkInitialized() throws HAEJBInvocationHandlerException { try { synchronized(clusterViewManager){ // The first time, create a pool to share stubs for EJBHome if(clusterViewManager.getPool(objectName) == null) { LOGGER.debug("First lookup on {0}: creation of the pool for its stubs for EJBHome", objectName); Pool<CMIReferenceable<?>, CMIReference> pool = new JPool<CMIReferenceable<?>, CMIReference>( new StubOrProxyFactory(clusterViewManager)); IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); if(poolConfiguration != null) { pool.setPoolConfiguration(poolConfiguration); } clusterViewManager.setPool(objectName, pool); } } if(classLoader == null) { classLoader = Thread.currentThread().getContextClassLoader(); } if(remoteClass == null) { remoteClass = clusterViewManager.getRemoteClass(objectName); } } catch (Exception e) { LOGGER.error("Cannot init the HA EJBHome proxy", e); throw new HAEJBInvocationHandlerException("Cannot init the HA EJBHome proxy", e); } }
@Override protected void checkInitialized() throws EJBInvocationHandlerException { try { synchronized(clusterViewManager){ // The first time, create a pool to share stubs for EJBObject if(clusterViewManager.getPool(objectName) == null) { logger.debug("First lookup on {0}: creation of the pool for its stubs for EJBObject", objectName); Pool<CMIReferenceable<?>, CMIReference> pool = new JPool<CMIReferenceable<?>, CMIReference>( new EJBObjectFactory(clusterViewManager)); IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); if(poolConfiguration != null) { pool.setPoolConfiguration(poolConfiguration); } clusterViewManager.setPool(objectName, pool); } } if(classLoader == null) { classLoader = Thread.currentThread().getContextClassLoader(); } if(remoteClass == null) { remoteClass = clusterViewManager.getRemoteClass(objectName); } } catch(Exception e) { logger.error("Cannot init the EJBHome proxy", e); throw new EJBInvocationHandlerException("Cannot init the EJBHome proxy", e); } }