@Override protected void checkInitialized() throws CMIInvocationHandlerException { if(classLoader == null) { try { classLoader = Thread.currentThread().getContextClassLoader(); } catch(Exception e) { throw new POJOInvocationHandlerException( "Cannot retrieve the classloader for object with name " + objectName, e); } } }
@SuppressWarnings("unchecked") @Override protected CMIReferenceable<Object> getCMIReferenceable( final CMIReference cmiReference) throws POJOInvocationHandlerException { try { return (CMIReferenceable<Object>) StubOrProxyHelper.download(clusterViewManager, cmiReference); } catch (ProtocolNotFoundException e) { logger.error("Cannot get a CMIReferenceable for " + cmiReference, e); throw new POJOInvocationHandlerException("Cannot get a CMIReferenceable for " + cmiReference, e); } catch (ObjectNotFoundException e) { logger.error("Cannot get a CMIReferenceable for " + cmiReference, e); throw new POJOInvocationHandlerException("Cannot get a CMIReferenceable for " + cmiReference, e); } catch (NamingException e) { logger.debug("No CMIReferenceable is bound for " + cmiReference, e); throw new POJOInvocationHandlerException( "No CMIReferenceable is bound for " + cmiReference, e); } }
@Override protected void checkInitialized() throws POJOInvocationHandlerException { 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); } } } catch (Exception e) { LOGGER.error("Cannot init the pool", e); throw new POJOInvocationHandlerException("Cannot init the pool", e); } if(classLoader == null) { try { classLoader = Thread.currentThread().getContextClassLoader(); } catch(Exception e) { throw new POJOInvocationHandlerException( "Cannot retrieve the classloader for object with name " + objectName, e); } } }