use of org.glassfish.ejb.api.MessageBeanListener in project Payara by payara.
the class ConnectorMessageBeanClient method createEndpoint.
/**
* {@inheritDoc}
*/
public MessageEndpoint createEndpoint(XAResource xaResource, long timeout) throws UnavailableException {
synchronized (this) {
while (myState == BLOCKED) {
try {
wait(timeout);
} catch (Exception e) {
// This exception should not affect the functionality.
} finally {
// Once the first thread comes out of wait, block is
// is removed. This makes sure that the time for which the
// the block remains is limited. Max 2x6000.
myState = UNBLOCKED;
}
}
}
if (!started_) {
logger.log(Level.WARNING, "endpointfactory.unavailable");
throw new UnavailableException("EndpointFactory is currently not available");
}
MessageEndpoint endpoint = null;
try {
ResourceHandle resourceHandle = allocator_.createResource(xaResource);
MessageBeanListener listener = messageBeanPM_.createMessageBeanListener(resourceHandle);
MessageEndpointInvocationHandler handler = new MessageEndpointInvocationHandler(listener, messageBeanPM_);
endpoint = (MessageEndpoint) messageBeanPM_.createMessageBeanProxy(handler);
} catch (Exception ex) {
throw (UnavailableException) (new UnavailableException()).initCause(ex);
}
return endpoint;
}
Aggregations