use of org.glassfish.ejb.api.ResourcesExceededException in project Payara by payara.
the class MessageBeanContainer method createMessageBeanListener.
/**
**************************************************************
* The following are implementation for methods required by the *
* MessageBeanProtocalManager interface. *
***************************************************************
*/
/**
* {@inheritDoc}
*/
@Override
public MessageBeanListener createMessageBeanListener(ResourceHandle resource) throws ResourcesExceededException {
boolean resourcesExceeded = false;
synchronized (this) {
if (numMessageBeanListeners_ < maxMessageBeanListeners_) {
numMessageBeanListeners_++;
} else {
resourcesExceeded = true;
}
}
if (resourcesExceeded) {
ResourcesExceededException ree = new ResourcesExceededException("Message Bean Resources " + "exceeded for message bean " + appEJBName_);
_logger.log(Level.FINE, "exceeded max of " + maxMessageBeanListeners_, ree);
throw ree;
}
//
return new MessageBeanListenerImpl(this, resource);
}
Aggregations