Package com.sun.ejb

Examples of com.sun.ejb.EjbInvocation


        checkAccessToCallerSecurity();

        ComponentInvocation inv =
                    EjbContainerUtilImpl.getInstance().getCurrentInvocation();
        if ( inv instanceof EjbInvocation) {
            EjbInvocation ejbInv = (EjbInvocation) inv;
            if( ejbInv.isTimerCallback ) {
                throw new IllegalStateException("isCallerInRole not allowed from timer callback");
            }

        } else {
View Full Code Here


        appEJBName_ = desc.getApplication().getRegistrationName() + ":"
                + desc.getName();

        EjbMessageBeanDescriptor msgBeanDesc = (EjbMessageBeanDescriptor) desc;

        EjbInvocation ejbInvocation = null;
        try {

            // Register the tx attribute for each method on MessageListener
            // interface. NOTE : These method objects MUST come from the
            // MessageListener interface, NOT the bean class itself. This
View Full Code Here

    public boolean userTransactionMethodsAllowed(ComponentInvocation inv) {
        boolean utMethodsAllowed = false;
        if (isBeanManagedTran) {
            if (inv instanceof EjbInvocation) {
                EjbInvocation ejbInvocation = (EjbInvocation) inv;
                MessageBeanContextImpl mdc = (MessageBeanContextImpl) ejbInvocation.context;
                utMethodsAllowed = (mdc.operationsAllowed()) ? true: false;
            }
        }
        return utMethodsAllowed;
View Full Code Here

     * Instantiate and initialize a message-driven bean instance.
     */
    private MessageBeanContextImpl createMessageDrivenEJB()
            throws CreateException {

        EjbInvocation inv = null;
        MessageBeanContextImpl context = null;
        ClassLoader originalClassLoader = null;
        boolean methodCalled = false;
        boolean methodCallFailed = false;

View Full Code Here

                            new Object[] { appEJBName_ });

            throw new EJBException(errorMsg);
        }

        EjbInvocation invocation = createEjbInvocation();

        try {

            MessageBeanContextImpl context = (MessageBeanContextImpl) getContext(invocation);

            if( deliveryType == MessageDeliveryType.Timer ) {
                invocation.isTimerCallback = true;
            }
           
            // Set the context class loader here so that message producer will
            // have access to application class loader during message
            // processing.
            // The previous context class loader will be restored in
            // afterMessageDelivery.

            invocation.setOriginalContextClassLoader(
                    Utility.setContextClassLoader(getClassLoader()));
            invocation.isMessageDriven = true;
            invocation.method = method;

            context.setState(BeanState.INVOKING);

            invocation.context = context;
            invocation.instance = context.getEJB();
            invocation.ejb = context.getEJB();
            invocation.container = this;

            // Message Bean Container only starts a new transaction if
            // there is no imported transaction and the message listener
            // method has tx attribute TX_REQUIRED or the ejbTimeout has
            // tx attribute TX_REQUIRES_NEW/TX_REQUIRED
            boolean startTx = false;
            if (!txImported) {
                startTx = containerStartsTx(method);
            }

            // keep track of whether tx was started for later.
            invocation.setContainerStartsTx(startTx);

            this.invocationManager.preInvoke(invocation);

            if (startTx) {
                // Register the session associated with the message-driven
View Full Code Here

        }
    }

    public Object deliverMessage(Object[] params) throws Throwable {

        EjbInvocation invocation = null;
        boolean methodCalled = false; // for monitoring
        Object result = null;

        invocation = (EjbInvocation) invocationManager.getCurrentInvocation();
View Full Code Here

    private boolean afterMessageDeliveryInternal(ResourceHandle resourceHandle) {
        // return value. assume failure until proven otherwise.
        boolean success = false;

        EjbInvocation invocation = null;

        invocation = (EjbInvocation) invocationManager.getCurrentInvocation();
        if (invocation == null) {
            _logger.log(Level.SEVERE, "containers.mdb.no_invocation",
                    new Object[] { appEJBName_, "" });
        } else {
            try {
                if (invocation.isContainerStartsTx()) {
                    // Unregister the session associated with
                    // the message-driven bean's destination.
                    unregisterMessageBeanResource(resourceHandle);
                }

                // counterpart of invocationManager.preInvoke
                invocationManager.postInvoke(invocation);

                // Commit/Rollback container-managed transaction.
                postInvokeTx(invocation);

                // Consider successful delivery. Commit failure will be
                // checked below.
                success = true;

                // TODO: Check if Tx existed / committed
                                ejbProbeNotifier.messageDeliveredEvent(getContainerId(),
                                        containerInfo.appName, containerInfo.modName,
                                        containerInfo.ejbName);

            } catch (Throwable ce) {
                _logger.log(Level.SEVERE,
                        "containers.mdb.postinvoke_exception", new Object[] {
                                appEJBName_, ce.toString() });
                _logger.log(Level.SEVERE, ce.getClass().getName(), ce);
            } finally {
                releaseContext(invocation);
            }

            // Reset original class loader
            Utility.setContextClassLoader(
                    invocation.getOriginalContextClassLoader());

            if (invocation.exception != null) {

                if (isSystemUncheckedException(invocation.exception)) {
                    success = false;
View Full Code Here

            if (!beanContext.isInState(BeanState.DESTROYED)) {

                // Called from pool implementation to reduce the pool size.
                // So we need to call ejb.ejbRemove() and
                // mark context as destroyed.
                EjbInvocation inv = null;

                try {
                    // NOTE : Context class-loader is already set by Pool

                    inv = createEjbInvocation(ejb, beanContext);
View Full Code Here

        return sbuf.toString();
    }

    @Override
    protected EjbInvocation createEjbInvocation(Object ejb, ComponentContext ctx) {
        EjbInvocation inv = super.createEjbInvocation(ejb, ctx);

        // Singletons can not store the underlying resource list
        // in the context impl since that is shared across many
        // concurrent invocations.  Instead, set the resource
        // handler on the invocation to provide a different
        // resource List for each Singleton invocation.
        inv.setResourceHandler(new ResourceHandlerImpl());

        return inv;
    }
View Full Code Here

    }
   
    private SingletonContextImpl createSingletonEJB()
        throws CreateException
    {
        EjbInvocation ejbInv = null;
        SingletonContextImpl context;

        // Track whether initialization got as far as preInvokeTx.
        // Needed for adequate error handling in the face of an initialization
        // exception.
View Full Code Here

TOP

Related Classes of com.sun.ejb.EjbInvocation

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.