use of com.sun.enterprise.deployment.runtime.BeanPoolDescriptor in project Payara by payara.
the class EjbNode method writeDescriptor.
/**
* write the descriptor class to a DOM tree and return it
*
* @param parent node for the DOM tree
* @param node name for the descriptor
* @param the descriptor to write
* @return the DOM tree top node
*/
@Override
public Node writeDescriptor(Node parent, String nodeName, EjbDescriptor ejbDescriptor) {
Element ejbNode = (Element) super.writeDescriptor(parent, nodeName, ejbDescriptor);
appendTextChild(ejbNode, RuntimeTagNames.EJB_NAME, ejbDescriptor.getName());
appendTextChild(ejbNode, RuntimeTagNames.JNDI_NAME, ejbDescriptor.getJndiName());
RuntimeDescriptorNode.writeCommonComponentInfo(ejbNode, ejbDescriptor);
appendTextChild(ejbNode, RuntimeTagNames.PASS_BY_REFERENCE, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getPassByReference()));
if (ejbDescriptor instanceof IASEjbCMPEntityDescriptor) {
CmpNode cmpNode = new CmpNode();
cmpNode.writeDescriptor(ejbNode, RuntimeTagNames.CMP, (IASEjbCMPEntityDescriptor) ejbDescriptor);
}
// principal
if (Boolean.FALSE.equals(ejbDescriptor.getUsesCallerIdentity())) {
RunAsIdentityDescriptor raid = ejbDescriptor.getRunAsIdentity();
if (raid != null && raid.getPrincipal() != null) {
Node principalNode = appendChild(ejbNode, RuntimeTagNames.PRINCIPAL);
appendTextChild(principalNode, RuntimeTagNames.NAME, raid.getPrincipal());
}
}
if (ejbDescriptor instanceof EjbMessageBeanDescriptor) {
EjbMessageBeanDescriptor msgBeanDesc = (EjbMessageBeanDescriptor) ejbDescriptor;
// mdb-connection-factory?
if (ejbDescriptor.getIASEjbExtraDescriptors().getMdbConnectionFactory() != null) {
MDBConnectionFactoryNode mcfNode = new MDBConnectionFactoryNode();
mcfNode.writeDescriptor(ejbNode, RuntimeTagNames.MDB_CONNECTION_FACTORY, ejbDescriptor.getIASEjbExtraDescriptors().getMdbConnectionFactory());
}
// jms-durable-subscription-name
if (msgBeanDesc.hasDurableSubscription()) {
appendTextChild(ejbNode, RuntimeTagNames.DURABLE_SUBSCRIPTION, msgBeanDesc.getDurableSubscriptionName());
}
appendTextChild(ejbNode, RuntimeTagNames.JMS_MAX_MESSAGES_LOAD, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getJmsMaxMessagesLoad()));
}
// ior-configuration
IORConfigurationNode iorNode = new IORConfigurationNode();
for (EjbIORConfigurationDescriptor iorConf : ejbDescriptor.getIORConfigurationDescriptors()) {
iorNode.writeDescriptor(ejbNode, RuntimeTagNames.IOR_CONFIG, iorConf);
}
appendTextChild(ejbNode, RuntimeTagNames.IS_READ_ONLY_BEAN, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().isIsReadOnlyBean()));
appendTextChild(ejbNode, RuntimeTagNames.REFRESH_PERIOD_IN_SECONDS, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getRefreshPeriodInSeconds()));
appendTextChild(ejbNode, RuntimeTagNames.COMMIT_OPTION, ejbDescriptor.getIASEjbExtraDescriptors().getCommitOption());
appendTextChild(ejbNode, RuntimeTagNames.CMT_TIMEOUT_IN_SECONDS, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getCmtTimeoutInSeconds()));
appendTextChild(ejbNode, RuntimeTagNames.USE_THREAD_POOL_ID, ejbDescriptor.getIASEjbExtraDescriptors().getUseThreadPoolId());
// gen-classes
writeGenClasses(ejbNode, ejbDescriptor);
// bean-pool
BeanPoolDescriptor beanPoolDesc = ejbDescriptor.getIASEjbExtraDescriptors().getBeanPool();
if (beanPoolDesc != null) {
BeanPoolNode bpNode = new BeanPoolNode();
bpNode.writeDescriptor(ejbNode, RuntimeTagNames.BEAN_POOL, beanPoolDesc);
}
// bean-cache
BeanCacheDescriptor beanCacheDesc = ejbDescriptor.getIASEjbExtraDescriptors().getBeanCache();
if (beanCacheDesc != null) {
BeanCacheNode bcNode = new BeanCacheNode();
bcNode.writeDescriptor(ejbNode, RuntimeTagNames.BEAN_CACHE, beanCacheDesc);
}
if (ejbDescriptor instanceof EjbMessageBeanDescriptor) {
EjbMessageBeanDescriptor msgBeanDesc = (EjbMessageBeanDescriptor) ejbDescriptor;
if (msgBeanDesc.hasResourceAdapterMid()) {
MDBResourceAdapterNode mdb = new MDBResourceAdapterNode();
mdb.writeDescriptor(ejbNode, RuntimeTagNames.MDB_RESOURCE_ADAPTER, msgBeanDesc);
}
} else if (ejbDescriptor instanceof EjbSessionDescriptor) {
// web-services
WebServiceEndpointRuntimeNode wsRuntime = new WebServiceEndpointRuntimeNode();
wsRuntime.writeWebServiceEndpointInfo(ejbNode, ejbDescriptor);
}
// flush-at-end-of-method
FlushAtEndOfMethodDescriptor flushMethodDesc = ejbDescriptor.getIASEjbExtraDescriptors().getFlushAtEndOfMethodDescriptor();
if (flushMethodDesc != null) {
FlushAtEndOfMethodNode flushNode = new FlushAtEndOfMethodNode();
flushNode.writeDescriptor(ejbNode, RuntimeTagNames.FLUSH_AT_END_OF_METHOD, flushMethodDesc);
}
// checkpointed-methods
// checkpoint-at-end-of-method
CheckpointAtEndOfMethodDescriptor checkpointMethodDesc = ejbDescriptor.getIASEjbExtraDescriptors().getCheckpointAtEndOfMethodDescriptor();
if (checkpointMethodDesc != null) {
CheckpointAtEndOfMethodNode checkpointNode = new CheckpointAtEndOfMethodNode();
checkpointNode.writeDescriptor(ejbNode, RuntimeTagNames.CHECKPOINT_AT_END_OF_METHOD, checkpointMethodDesc);
}
if (ejbDescriptor.getIASEjbExtraDescriptors().getPerRequestLoadBalancing() != null) {
appendTextChild(ejbNode, RuntimeTagNames.PER_REQUEST_LOAD_BALANCING, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getPerRequestLoadBalancing()));
}
// availability-enabled
setAttribute(ejbNode, RuntimeTagNames.AVAILABILITY_ENABLED, ejbDescriptor.getIASEjbExtraDescriptors().getAttributeValue(IASEjbExtraDescriptors.AVAILABILITY_ENABLED));
return ejbNode;
}
use of com.sun.enterprise.deployment.runtime.BeanPoolDescriptor in project Payara by payara.
the class MessageBeanContainer method createMessageBeanPool.
private void createMessageBeanPool(EjbMessageBeanDescriptor descriptor) {
beanPoolDesc_ = descriptor.getIASEjbExtraDescriptors().getBeanPool();
if (beanPoolDesc_ == null) {
beanPoolDesc_ = new BeanPoolDescriptor();
}
MdbContainer mdbc = ejbContainerUtilImpl.getServices().<Config>getService(Config.class, ServerEnvironment.DEFAULT_INSTANCE_NAME).getExtensionByType(MdbContainer.class);
int maxPoolSize = beanPoolDesc_.getMaxPoolSize();
if (maxPoolSize < 0) {
maxPoolSize = stringToInt(mdbc.getMaxPoolSize(), appEJBName_, _logger);
}
maxPoolSize = validateValue(maxPoolSize, 1, -1, DEFAULT_MAX_POOL_SIZE, "max-pool-size", appEJBName_, _logger);
beanPoolDesc_.setMaxPoolSize(maxPoolSize);
int value = beanPoolDesc_.getSteadyPoolSize();
if (value < 0) {
value = stringToInt(mdbc.getSteadyPoolSize(), appEJBName_, _logger);
}
value = validateValue(value, 0, maxPoolSize, DEFAULT_STEADY_SIZE, "steady-pool-size", appEJBName_, _logger);
beanPoolDesc_.setSteadyPoolSize(value);
value = beanPoolDesc_.getPoolResizeQuantity();
if (value < 0) {
value = stringToInt(mdbc.getPoolResizeQuantity(), appEJBName_, _logger);
}
value = validateValue(value, 1, maxPoolSize, DEFAULT_RESIZE_QUANTITY, "pool-resize-quantity", appEJBName_, _logger);
beanPoolDesc_.setPoolResizeQuantity(value);
// if ejb pool idle-timeout-in-seconds is not explicitly set in
// glassfish-ejb-jar.xml, returned value is -1
value = beanPoolDesc_.getPoolIdleTimeoutInSeconds();
if (value < MIN_IDLE_TIMEOUT) {
value = stringToInt(mdbc.getIdleTimeoutInSeconds(), appEJBName_, _logger);
}
value = validateValue(value, MIN_IDLE_TIMEOUT, -1, DEFAULT_IDLE_TIMEOUT, "idle-timeout-in-seconds", appEJBName_, _logger);
beanPoolDesc_.setPoolIdleTimeoutInSeconds(value);
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, appEJBName_ + ": Setting message-driven bean pool max-pool-size=" + beanPoolDesc_.getMaxPoolSize() + ", steady-pool-size=" + beanPoolDesc_.getSteadyPoolSize() + ", pool-resize-quantity=" + beanPoolDesc_.getPoolResizeQuantity() + ", idle-timeout-in-seconds=" + beanPoolDesc_.getPoolIdleTimeoutInSeconds());
}
// Create a non-blocking pool of message bean instances.
// The protocol manager implementation enforces a limit
// on message bean resources independent of the pool.
ObjectFactory objFactory = new MessageBeanContextFactory();
String val = descriptor.getEjbBundleDescriptor().getEnterpriseBeansProperty(SINGLETON_BEAN_POOL_PROP);
messageBeanPool_ = new NonBlockingPool(getContainerId(), appEJBName_, objFactory, beanPoolDesc_.getSteadyPoolSize(), beanPoolDesc_.getPoolResizeQuantity(), beanPoolDesc_.getMaxPoolSize(), beanPoolDesc_.getPoolIdleTimeoutInSeconds(), loader, Boolean.parseBoolean(val));
}
Aggregations