ConnectorConnectionPool clone = new ConnectorConnectionPool(name); ConnectorDescriptorInfo cdi = connectorDescriptorInfo_.doClone(); clone.setSecurityMaps(this.securityMaps); clone.setSteadyPoolSize(getSteadyPoolSize()); clone.setMaxPoolSize(getMaxPoolSize()); clone.setMaxWaitTimeInMillis(getMaxWaitTimeInMillis()); clone.setPoolResizeQuantity(getPoolResizeQuantity()); clone.setIdleTimeoutInSeconds(getIdleTimeoutInSeconds()); clone.setConnectionValidationRequired(isConnectionValidationRequired_); clone.setFailAllConnections(isFailAllConnections()); clone.setTransactionSupport(getTransactionSupport()); clone.setConnectorDescriptorInfo(cdi); clone.setNonComponent(isNonComponent()); clone.setNonTransactional(isNonTransactional()); clone.setMatchConnections(matchConnections()); clone.setLazyConnectionAssoc(isLazyConnectionAssoc()); clone.setAssociateWithThread(isAssociateWithThread()); clone.setPartitionedPool(isPartitionedPool()); clone.setDataStructureParameters(getDataStructureParameters()); clone.setPoolDataStructureType(getPoolDataStructureType()); clone.setPoolWaitQueue(getPoolWaitQueue()); clone.setLazyConnectionEnlist(isLazyConnectionEnlist()); clone.setMaxConnectionUsage(getMaxConnectionUsage()); clone.setValidateAtmostOncePeriod(getValidateAtmostOncePeriod());
private void updateMCFAndPoolAttributes(ConnectorConnectionPool ccp) throws ConnectorRuntimeException { PoolInfo poolInfo = ccp.getPoolInfo(); try { ConnectorConnectionPool origCcp = origCcp.setSteadyPoolSize(ccp.getSteadyPoolSize()); origCcp.setMaxPoolSize(ccp.getMaxPoolSize()); origCcp.setMaxWaitTimeInMillis(ccp.getMaxWaitTimeInMillis()); origCcp.setPoolResizeQuantity(ccp.getPoolResizeQuantity()); origCcp.setIdleTimeoutInSeconds(ccp.getIdleTimeoutInSeconds()); origCcp.setFailAllConnections(ccp.isFailAllConnections()); origCcp.setMatchConnections(ccp.matchConnections()); origCcp.setMaxConnectionUsage(ccp.getMaxConnectionUsage()); origCcp.setNonComponent(ccp.isNonComponent()); origCcp.setNonTransactional(ccp.isNonTransactional()); origCcp.setConCreationRetryAttempts(ccp.getConCreationRetryAttempts()); origCcp.setConCreationRetryInterval (ccp.getConCreationRetryInterval()); origCcp.setValidateAtmostOncePeriod(ccp.getValidateAtmostOncePeriod()); origCcp.setConnectionLeakTracingTimeout(ccp.getConnectionLeakTracingTimeout()); origCcp.setConnectionReclaim(ccp.isConnectionReclaim()); poolInfo); SetMethodAction sma = new SetMethodAction(mcf, ccp.getConnectorDescriptorInfo().getMCFConfigProperties()); try { sma.run();
private void setPoolConfiguration(Hashtable env) throws PoolingException { ConnectorConnectionPool poolResource = getPoolConfigurationFromJndi(env); idletime = Integer.parseInt(poolResource.getIdleTimeoutInSeconds()) * 1000L; maxPoolSize = Integer.parseInt(poolResource.getMaxPoolSize()); steadyPoolSize = Integer.parseInt(poolResource.getSteadyPoolSize()); if (maxPoolSize < steadyPoolSize) { maxPoolSize = steadyPoolSize; } resizeQuantity = Integer.parseInt(poolResource.getPoolResizeQuantity()); maxWaitTime = Integer.parseInt(poolResource.getMaxWaitTimeInMillis()); //Make sure it's not negative. if (maxWaitTime < 0) { maxWaitTime = 0; } failAllConnections = poolResource.isFailAllConnections(); validation = poolResource.isIsConnectionValidationRequired(); validateAtmostEveryIdleSecs = poolResource.isValidateAtmostEveryIdleSecs(); dataStructureType = poolResource.getPoolDataStructureType(); dataStructureParameters = poolResource.getDataStructureParameters(); poolWaitQueueClass = poolResource.getPoolWaitQueue(); resourceSelectionStrategyClass = poolResource.getResourceSelectionStrategyClass(); resourceGatewayClass = poolResource.getResourceGatewayClass(); reconfigWaitTime = poolResource.getDynamicReconfigWaitTimeout(); setAdvancedPoolConfiguration(poolResource); }
/** * Creates default ConnectorConnectionPool consisting of default * pool values. * * @param poolInfo Name of the pool * @return ConnectorConnectionPool created ConnectorConnectionPool instance */ public static ConnectorConnectionPool createDefaultConnectorPoolObject( PoolInfo poolInfo, String rarName) { ConnectorConnectionPool connectorPoolObj = new ConnectorConnectionPool(poolInfo); connectorPoolObj.setMaxPoolSize("20"); connectorPoolObj.setSteadyPoolSize("10"); connectorPoolObj.setMaxWaitTimeInMillis("7889"); connectorPoolObj.setIdleTimeoutInSeconds("789"); connectorPoolObj.setPoolResizeQuantity("2"); connectorPoolObj.setFailAllConnections(false); connectorPoolObj.setMatchConnections(true); //always setDefaultAdvancedPoolAttributes(connectorPoolObj); try { connectorPoolObj.setTransactionSupport(getTransactionSupportFromRaXml(rarName)); } catch (Exception ex) { if(_logger.isLoggable(Level.FINE)) { _logger.fine("error in setting txSupport"); } } return connectorPoolObj; }
throws Exception { ConnectorConnectionPool ccp ; ccp = new ConnectorConnectionPool(poolInfo); ccp.setSteadyPoolSize(domainCcp.getSteadyPoolSize()); ccp.setMaxPoolSize(domainCcp.getMaxPoolSize()); ccp.setMaxWaitTimeInMillis(domainCcp.getMaxWaitTimeInMillis()); ccp.setPoolResizeQuantity(domainCcp.getPoolResizeQuantity()); ccp.setIdleTimeoutInSeconds(domainCcp.getIdleTimeoutInSeconds()); ccp.setFailAllConnections(Boolean.valueOf(domainCcp.getFailAllConnections())); ccp.setAuthCredentialsDefinedInPool( isAuthCredentialsDefinedInPool(domainCcp)); ccp.setConnectionValidationRequired(Boolean.valueOf(domainCcp.getIsConnectionValidationRequired())); ccp.getName()); throw cre; ccp.setTransactionSupport(txSupportIntVal); ccp.setNonComponent(false); ccp.setNonTransactional(false); ccp.setConnectionLeakTracingTimeout(domainCcp.getConnectionLeakTimeoutInSeconds()); ccp.setConnectionReclaim(Boolean.valueOf(domainCcp.getConnectionLeakReclaim())); ccp.setMatchConnections(Boolean.valueOf(domainCcp.getMatchConnections())); ccp.setAssociateWithThread(Boolean.valueOf(domainCcp.getAssociateWithThread())); ccp.setPooling(Boolean.valueOf(domainCcp.getPooling())); ccp.setPingDuringPoolCreation(Boolean.valueOf(domainCcp.getPing()));
if(newCcp.isPoolingOn() != oldCcp.isPoolingOn()) { return ReconfigAction.RECREATE_POOL; if (newCcp.getTransactionSupport() != oldCcp.getTransactionSupport()) { return ReconfigAction.RECREATE_POOL; if (newCcp.isAssociateWithThread() != oldCcp.isAssociateWithThread()) { return ReconfigAction.RECREATE_POOL; if (newCcp.isLazyConnectionAssoc() != oldCcp.isLazyConnectionAssoc()) { return ReconfigAction.RECREATE_POOL; if (newCcp.isPartitionedPool() != oldCcp.isPartitionedPool()) { return ReconfigAction.RECREATE_POOL; if (newCcp.getPoolDataStructureType() == null && oldCcp.getPoolDataStructureType() != null) { return ReconfigAction.RECREATE_POOL; if (newCcp.getPoolDataStructureType() != null && oldCcp.getPoolDataStructureType() == null) { return ReconfigAction.RECREATE_POOL; if (((newCcp.getPoolDataStructureType() != null) && (oldCcp.getPoolDataStructureType() != null) && !(newCcp.getPoolDataStructureType().equals(oldCcp.getPoolDataStructureType())))) { return ReconfigAction.RECREATE_POOL; if ((newCcp.getPoolWaitQueue() != null) && (oldCcp.getPoolWaitQueue() == null)) { return ReconfigAction.RECREATE_POOL; if ((newCcp.getPoolWaitQueue() == null) && (oldCcp.getPoolWaitQueue() != null)) {
/** * sets advanced pool properties<br> * used during pool configuration (initialization) and re-configuration<br> * * @param poolResource Connector Connection Pool */ private void setAdvancedPoolConfiguration(ConnectorConnectionPool poolResource) { matchConnections = poolResource.matchConnections(); preferValidateOverRecreate = poolResource.isPreferValidateOverRecreate(); maxConnectionUsage_ = Integer.parseInt(poolResource.getMaxConnectionUsage()); connectionCreationRetryAttempts_ = Integer.parseInt (poolResource.getConCreationRetryAttempts()); //Converting seconds to milliseconds as TimerTask will take input in milliseconds conCreationRetryInterval_ = Integer.parseInt(poolResource.getConCreationRetryInterval()) * 1000L; connectionCreationRetry_ = connectionCreationRetryAttempts_ > 0; validateAtmostPeriodInMilliSeconds_ = Integer.parseInt(poolResource.getValidateAtmostOncePeriod()) * 1000L; boolean connectionLeakReclaim_ = poolResource.isConnectionReclaim(); long connectionLeakTimeoutInMilliSeconds_ = Integer.parseInt( poolResource.getConnectionLeakTracingTimeout()) * 1000L; boolean connectionLeakTracing_ = connectionLeakTimeoutInMilliSeconds_ > 0; if (leakDetector == null) { leakDetector = new ConnectionLeakDetector(poolInfo, connectionLeakTracing_, connectionLeakTimeoutInMilliSeconds_, connectionLeakReclaim_); } else { leakDetector.reset(connectionLeakTracing_, connectionLeakTimeoutInMilliSeconds_, connectionLeakReclaim_); } }
StringBuffer sb = new StringBuffer("ConnectorConnectionPool :: "); try { sb.append(getName()); sb.append("\nsteady size: "); sb.append(getSteadyPoolSize()); sb.append("\nmax pool size: "); sb.append(getMaxPoolSize()); sb.append("\nmax wait time: "); sb.append(getMaxWaitTimeInMillis()); sb.append("\npool resize qty: "); sb.append(getPoolResizeQuantity()); sb.append("\nIdle timeout: "); sb.append(getIdleTimeoutInSeconds()); sb.append("\nfailAllConnections: "); sb.append(isFailAllConnections()); sb.append("\nTransaction Support Level: "); sb.append(transactionSupport_);
int _idleTime = Integer.parseInt(poolResource.getIdleTimeoutInSeconds()) * 1000; if (poolInitialized) { resizeQuantity = Integer.parseInt(poolResource.getPoolResizeQuantity()); maxWaitTime = Integer.parseInt(poolResource.getMaxWaitTimeInMillis()); validation = poolResource.isIsConnectionValidationRequired(); failAllConnections = poolResource.isFailAllConnections(); setAdvancedPoolConfiguration(poolResource); int _maxPoolSize = Integer.parseInt(poolResource.getMaxPoolSize()); int oldMaxPoolSize = maxPoolSize; ds.setMaxSize(maxPoolSize); int _steadyPoolSize = Integer.parseInt(poolResource.getSteadyPoolSize()); int oldSteadyPoolSize = steadyPoolSize;
private void handlePoolRecreation(final ConnectorConnectionPool connConnPool) throws ConnectorRuntimeException { debug("[DRC] Pool recreation required"); final long reconfigWaitTimeout = connConnPool.getDynamicReconfigWaitTimeout(); PoolInfo poolInfo = new PoolInfo(connConnPool.getName(), connConnPool.getApplicationName(), connConnPool.getModuleName()); final ResourcePool oldPool = runtime.getPoolManager().getPool(poolInfo); execService.invokeAll(list); }catch(Exception e){ Object[] params = new Object[]{connConnPool.getName(), e}; _logger.log(Level.WARNING,"exception.redeploying.pool.transparently", params);
public ConnectorConnectionPool createConnectorConnectionPool(JdbcConnectionPool adminPool, PoolInfo poolInfo) throws ConnectorRuntimeException { String moduleName = ResourcesUtil.createInstance().getRANameofJdbcConnectionPool(adminPool); int txSupport = getTxSupport(moduleName); ConnectorDescriptor connDesc = runtime.getConnectorDescriptor(moduleName); //Create the connector Connection Pool object from the configbean object ConnectorConnectionPool conConnPool = new ConnectorConnectionPool(poolInfo); conConnPool.setTransactionSupport(txSupport); setConnectorConnectionPoolAttributes(conConnPool, adminPool); //Initially create the ConnectorDescriptor ConnectorDescriptorInfo connDescInfo = createConnectorDescriptorInfo(connDesc, moduleName); connDescInfo.setMCFConfigProperties( getMCFConfigProperties(adminPool, conConnPool, connDesc)); //since we are deploying a 1.0 RAR, this is null connDescInfo.setResourceAdapterConfigProperties((Set) null); conConnPool.setConnectorDescriptorInfo(connDescInfo); return conConnPool; }
final String mcfClass = ccp.getConnectorDescriptorInfo().getManagedConnectionFactoryClass(); try { TransactionSupport ts = ConnectionPoolObjectsUtils.getTransactionSupport( ccp.getTransactionSupport()); ((ConfigurableTransactionSupport)mcf).setTransactionSupport(ts); (mcf, ccp.getConnectorDescriptorInfo().getMCFConfigProperties()); setMethodAction.run(); if(_logger.isLoggable(Level.FINE)) {
/** * Utility method to get property value from ConnectorDescriptorInfo. * @param prop * @return */ protected String getPropertyValue(String prop, ConnectorConnectionPool connectorConnectionPool) { String result = null; ConnectorDescriptorInfo cdi = connectorConnectionPool.getConnectorDescriptorInfo(); Set mcfConfigProperties = cdi.getMCFConfigProperties(); Iterator mcfConfPropsIter = mcfConfigProperties.iterator(); while (mcfConfPropsIter.hasNext()) { ConnectorConfigProperty envProp = (ConnectorConfigProperty ) mcfConfPropsIter.next(); if (envProp.getName().toUpperCase(Locale.getDefault()).equals(prop)) { result = envProp.getValue(); } } return result; }
new ConnectorConnectionPool(poolInfo); SunConnector sundesc = desc.getSunDescriptor(); ResourceAdapter sunRAXML = sundesc.getResourceAdapter(); connectorPoolObj.setMaxPoolSize( (String) sunRAXML.getValue(ResourceAdapter.MAX_POOL_SIZE)); connectorPoolObj.setSteadyPoolSize( (String) sunRAXML.getValue(ResourceAdapter.STEADY_POOL_SIZE)); connectorPoolObj.setMaxWaitTimeInMillis((String) sunRAXML.getValue( ResourceAdapter.MAX_WAIT_TIME_IN_MILLIS)); connectorPoolObj.setIdleTimeoutInSeconds((String) sunRAXML.getValue( ResourceAdapter.IDLE_TIMEOUT_IN_SECONDS)); connectorPoolObj.setPoolResizeQuantity((String) "2"); connectorPoolObj.setFailAllConnections(false); connectorPoolObj.setMatchConnections(true); //always connectorPoolObj.setTransactionSupport(getTransactionSupportFromRaXml(rarName)); } catch (Exception ex) { if(_logger.isLoggable(Level.FINE)) { connectorPoolObj.setValidateAtmostEveryIdleSecs(validateAtmostEveryIdleSecs);
/** * Returns the resource adapter object corresponding * to the pool * * @param connectorConnectionPool Name of the pool. * MCF pertaining to this pool is * created/returned. * @return Resource adapter instance corresponding to this pool. * @throws ConnectorRuntimeException if creation/retrieval * of RA fails */ private ActiveResourceAdapter getResourceAdapter(ConnectorConnectionPool connectorConnectionPool) throws ConnectorRuntimeException { String rarName = connectorConnectionPool.getConnectorDescriptorInfo().getRarName(); ActiveResourceAdapter activeResourceAdapter = getActiveResourceAdapter(rarName); if (activeResourceAdapter == null) { String i18nMsg = localStrings.getString("ccp_adm.active_ra_not_init", rarName); ConnectorRuntimeException cre = new ConnectorRuntimeException(i18nMsg); _logger.log(Level.SEVERE, "rardeployment.resourceadapter_not_initialized", rarName); if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "", cre); } throw cre; } return activeResourceAdapter; }
connectorPoolObj.getConnectorDescriptorInfo().getRarName(); String connectionDefinitionName = connectorPoolObj.getConnectorDescriptorInfo(). getConnectionDefinitionName();
ccp = (ConnectorConnectionPool) namingService.lookup(poolInfo, jndiNameForPool); ConnectorDescriptorInfo cdi = ccp.getConnectorDescriptorInfo();