Package javax.resource.spi

Examples of javax.resource.spi.UnavailableException


            if (e instanceof java.lang.reflect.InvocationTargetException) {
                e = ((java.lang.reflect.InvocationTargetException) e).getTargetException();
            }
            String message = "The bean instance threw a system exception:" + e;
            MdbInstanceFactory.logger.error(message, e);
            throw new UnavailableException(message, e);
        } finally {
            ThreadContext.exit(oldContext);
        }
    }
View Full Code Here


        public MessageEndpoint createEndpoint(final XAResource xaResource) throws UnavailableException {
            try {
                return new JmsEndpoint(connectionFactory);
            } catch (final JMSException e) {
                e.printStackTrace();
                throw new UnavailableException(e);
            }
        }
View Full Code Here

    @Override
    protected Object doInvoke(Object proxy, Method method, Object[] args) throws Throwable {
        // Are we still usable?
        if (released.get())
            throw new UnavailableException("Message endpoint " + this + " has already been released");

        // TODO: check for concurrent invocation

        if (method.getDeclaringClass().equals(MessageEndpoint.class))
            return handle(method, args);
View Full Code Here

        else if (managedConnection != null) {
            try {
                return new LocalTransactionEndpoint(messageListener, managedConnection.getLocalTransaction());
            }
            catch (ResourceException e) {
                throw new UnavailableException(e);
            }
        }
        return new AcknowledgeEndpoint(messageListener);
    }
View Full Code Here

        public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
            try {
                return new JmsEndpoint(connectionFactory);
            } catch (JMSException e) {
                e.printStackTrace();
                throw new UnavailableException(e);
            }
        }
View Full Code Here

    public Object createInstance(boolean ignoreInstanceCount) throws UnavailableException {
        if (!ignoreInstanceCount) {
            synchronized (this) {
                // check the instance limit
                if (instanceLimit > 0 && instanceCount >= instanceLimit) {
                    throw new UnavailableException("Only " + instanceLimit + " instances can be created");
                }
                // increment the instance count
                instanceCount++;
            }
        }
View Full Code Here

            if (e instanceof java.lang.reflect.InvocationTargetException) {
                e = ((java.lang.reflect.InvocationTargetException) e).getTargetException();
            }
            String message = "The bean instance threw a system exception:" + e;
            MdbInstanceFactory.logger.error(message, e);
            throw new UnavailableException(message, e);
        } finally {
            ThreadContext.exit(oldContext);
        }
    }
View Full Code Here

            {
               return (JMSPlatformAdapter)factoryClass.newInstance();
            }
            catch (Throwable t)
            {
               throw new UnavailableException("Unable to instantiate the platform adapter \"" +
                  factoryClass.getName() + "\"", t);
            }
         }
      }
     
View Full Code Here

            }
        }

        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);

            //Use the MDB's application classloader to load the
            //message listener class.  If it is generic listener
            //class, it is expected to be packaged with the MDB application
            //or in the system classpath.
            String moduleID = getDescriptor().getApplication().getModuleID();
            Class endpointClass = null;
            ClassLoader loader = null;
            try {
                BundleDescriptor moduleDesc =
                        getDescriptor().getEjbBundleDescriptor();
                loader = moduleDesc.getClassLoader();
            } catch (Exception e) {
                logger.log(Level.WARNING, "endpointfactory.loader_not_found", e);
            }

            if (loader == null) {
                loader = Thread.currentThread().getContextClassLoader();
            }

            endpointClass = loader.loadClass(MESSAGE_ENDPOINT);


            String msgListenerType = getDescriptor().getMessageListenerType();
            if (msgListenerType == null || "".equals(msgListenerType))
                msgListenerType = "javax.jms.MessageListener";

            Class listenerClass = loader.loadClass(msgListenerType);

            MessageEndpointInvocationHandler handler =
                    new MessageEndpointInvocationHandler(listener, messageBeanPM_);
            endpoint = (MessageEndpoint) Proxy.newProxyInstance
                    (loader, new Class[]{endpointClass, listenerClass}, handler);

        } catch (Exception ex) {
            throw (UnavailableException)
                    (new UnavailableException()).initCause(ex);
        }
        return endpoint;
    }
View Full Code Here

        public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
            try {
                return new JmsEndpoint(connectionFactory);
            } catch (JMSException e) {
                e.printStackTrace();
                throw new UnavailableException(e);
            }
        }
View Full Code Here

TOP

Related Classes of javax.resource.spi.UnavailableException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.