/** * Sets the pool timeout of CMIReferenceable for a object with the given name. * @param objectName a name of object * @param poolTimeout the timeout of pool of CMIReferenceable for a object with the given name * @throws IllegalArgumentException if no object is bound with the given name * @throws UnsupportedOperationException if the used manager is at client-side */ public void setPoolTimeout(final String objectName, final Long poolTimeout) throws IllegalArgumentException, UnsupportedOperationException { if(!(clusterViewManager instanceof ServerClusterViewManager)) { LOGGER.error("Clients cannot call this method"); throw new UnsupportedOperationException("Clients cannot call this method"); } try { IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); poolConfiguration.setTimeout(poolTimeout); ((ServerClusterViewManager) clusterViewManager).getPool(objectName).setPoolConfiguration(poolConfiguration); } catch (ObjectNotFoundException e) { LOGGER.error("Object not found: {0}", objectName, e); throw new IllegalArgumentException("Object not found: " + objectName + "\n" + e.getMessage()); } }
protected final void updatePool( final DistributedObjectInfo oldDistributedObjectInfo, final DistributedObjectInfo newDistributedObjectInfo) throws ObjectNotFoundException { String objectName = newDistributedObjectInfo.getObjectName(); if (hasPool(objectName)) { IPoolConfiguration newPoolConfiguration = newDistributedObjectInfo .getPoolConfiguration(); if (oldDistributedObjectInfo != null) { IPoolConfiguration oldPoolConfiguration = oldDistributedObjectInfo .getPoolConfiguration(); if (oldPoolConfiguration != null) { if (newPoolConfiguration == null) { newPoolConfiguration = new PoolConfiguration(); } if (!oldPoolConfiguration.equals(newPoolConfiguration)) { getPool(objectName).setPoolConfiguration( newPoolConfiguration); } } } else { if (newPoolConfiguration != null && newPoolConfiguration != new PoolConfiguration()) { getPool(objectName).setPoolConfiguration( newPoolConfiguration); } } } }
/** * Sets the maximal size of pool of CMIReferenceable for a object with the given name. * @param objectName a name of object * @param maxSize the maximal size of pool of CMIReferenceable for a object with the given name * @throws IllegalArgumentException if no object is bound with the given name * @throws UnsupportedOperationException if the used manager is at client-side */ public void setMaxPoolSize(final String objectName, final Integer maxSize) throws IllegalArgumentException, UnsupportedOperationException { if(!(clusterViewManager instanceof ServerClusterViewManager)) { LOGGER.error("Clients cannot call this method"); throw new UnsupportedOperationException("Clients cannot call this method"); } try { IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); poolConfiguration.setMax(maxSize); ((ServerClusterViewManager) clusterViewManager).getPool(objectName).setPoolConfiguration(poolConfiguration); } catch (ObjectNotFoundException e) { LOGGER.error("Object not found: {0}", objectName, e); throw new IllegalArgumentException("Object not found: " + objectName + "\n" + e.getMessage()); } }
/** * Sets the max waiters of pool of CMIReferenceable for a object with the given name. * @param objectName a name of object * @param maxPoolWaiters the max waiters of pool of CMIReferenceable for a object with the given name * @throws IllegalArgumentException if no object is bound with the given name * @throws UnsupportedOperationException if the used manager is at client-side */ public void setMaxPoolWaiters(final String objectName, final Integer maxPoolWaiters) throws IllegalArgumentException, UnsupportedOperationException { if(!(clusterViewManager instanceof ServerClusterViewManager)) { LOGGER.error("Clients cannot call this method"); throw new UnsupportedOperationException("Clients cannot call this method"); } try { IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); poolConfiguration.setMaxWaiters(maxPoolWaiters); ((ServerClusterViewManager) clusterViewManager).getPool(objectName).setPoolConfiguration(poolConfiguration); } catch (ObjectNotFoundException e) { LOGGER.error("Object not found: {0}", objectName, e); throw new IllegalArgumentException("Object not found: " + objectName + "\n" + e.getMessage()); } }
IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); if(poolConfiguration != null) { pool.setPoolConfiguration(poolConfiguration);
@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); } }
IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); if(poolConfiguration != null) { pool.setPoolConfiguration(poolConfiguration);
@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 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); } } }
IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); if(poolConfiguration != null) { pool.setPoolConfiguration(poolConfiguration); IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); if(poolConfiguration != null) { pool.setPoolConfiguration(poolConfiguration); IPoolConfiguration poolConfiguration = clusterViewManager.getPoolConfiguration(objectName); if(poolConfiguration != null) { pool.setPoolConfiguration(poolConfiguration);
pool.setPoolConfiguration(clusteredObjectInfo.getPoolConfiguration()); setPool(providerName, pool);