/** * @param buff * the String buffer to write in. * @param indent * the ident value. */ private void writePoolToXml(final StringBuffer buff, final int indent) { // TODO Auto-generated method stub buff.append(indent); if (poolConfiguration != null) { writeValue(new Integer(poolConfiguration.getMax()).toString(), buff, "<max-size>", "</max-size>"); writeValue(new Integer(poolConfiguration.getMaxWaiters()) .toString(), buff, "<max-waiters>", "</max-waiters>"); writeValue(new Long(poolConfiguration.getTimeout()).toString(), buff, "<timeout>", "</timeout>"); } }
/** * Returns the maximal size of pool of CMIReferenceable for a object with the given name. * @param objectName a name of object * @return the maximal size of pool of CMIReferenceable for a object with the given name * @throws IllegalArgumentException if none object has the given name */ public Integer getMaxPoolSize(final String objectName) throws IllegalArgumentException { try { return clusterViewManager.getPoolConfiguration(objectName).getMax(); } catch (ObjectNotFoundException e) { LOGGER.error("Object not found: {0}", objectName, e); throw new IllegalArgumentException("Object not found: " + objectName + "\n" + e.getMessage()); } }
/** * Returns the max waiters of pool of CMIReferenceable for a object with the given name. * @param objectName a name of object * @return the maximal waiters of pool of CMIReferenceable for a object with the given name * @throws IllegalArgumentException if none object has the given name */ public Integer getMaxPoolWaiters(final String objectName) throws IllegalArgumentException { try { return clusterViewManager.getPoolConfiguration(objectName).getMaxWaiters(); } catch (ObjectNotFoundException e) { LOGGER.error("Object not found: {0}", objectName, e); throw new IllegalArgumentException("Object not found: " + objectName + "\n" + e.getMessage()); } }
/** * Returns the pool timeout of CMIReferenceable for a object with the given name. * @param objectName a name of object * @return the timeout of pool of CMIReferenceable for a object with the given name * @throws IllegalArgumentException if none object has the given name */ public Long getPoolTimeout(final String objectName) throws IllegalArgumentException { try { return clusterViewManager.getPoolConfiguration(objectName).getTimeout(); } catch (ObjectNotFoundException e) { LOGGER.error("Object not found: {0}", objectName, e); throw new IllegalArgumentException("Object not found: " + objectName + "\n" + e.getMessage()); } }
/** * 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()); } }
/** * 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()); } }