Package org.jboss.as.ejb3.component.stateful

Examples of org.jboss.as.ejb3.component.stateful.StatefulSessionComponentInstance


                    // write out the (successful) method invocation result to the channel output stream
                    try {
                        // attach any weak affinity if available
                        Affinity weakAffinity = null;
                        if (locator instanceof StatefulEJBLocator && componentView.getComponent() instanceof StatefulSessionComponent) {
                            final StatefulSessionComponent statefulSessionComponent = (StatefulSessionComponent) componentView.getComponent();
                            weakAffinity = MethodInvocationMessageHandler.this.getWeakAffinity(statefulSessionComponent, (StatefulEJBLocator<?>) locator);
                        } else if (componentView.getComponent() instanceof StatelessSessionComponent) {
                            final StatelessSessionComponent statelessSessionComponent = (StatelessSessionComponent) componentView.getComponent();
                            weakAffinity = statelessSessionComponent.getWeakAffinity();
                        }
View Full Code Here


        }
    }

    @Override
    protected Object handleInvocation(final InterceptorContext invocation) throws Exception {
        final StatefulSessionComponentInstance instance = (StatefulSessionComponentInstance) invocation.getPrivateData(ComponentInstance.class);

        TransactionManager tm = getComponent().getTransactionManager();
        assert tm.getTransaction() == null : "can't handle BMT transaction, there is a transaction active";

        // Is the instance already associated with a transaction?
        Transaction tx = instance.getTransaction();
        if (tx != null) {
            // then resume that transaction.
            instance.setTransaction(null);
            tm.resume(tx);
        }
        try {
            return invocation.proceed();
        } catch (Throwable e) {
            throw this.handleException(invocation, e);
        } finally {
            checkBadStateful();
            // Is the instance finished with the transaction?
            Transaction newTx = tm.getTransaction();
            //always set it, even if null
            instance.setTransaction(newTx);
            if (newTx != null) {
                // remember the association
                // and suspend it.
                tm.suspend();
            }
View Full Code Here

    public Object processInvocation(InterceptorContext context) throws Exception {
        ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
        if (componentInstance == null) {
            throw MESSAGES.notSetInInterceptorContext("componentInstance", context);
        }
        StatefulSessionComponentInstance sfsb = (StatefulSessionComponentInstance) componentInstance;
        SFSBContextHandleImpl sfsbContextHandle = new SFSBContextHandleImpl(sfsb);

        SFSBCallStack.pushCall(sfsbContextHandle);
        try {
            return context.proceed();   // call the next interceptor or target
View Full Code Here

    public Object processInvocation(InterceptorContext interceptorContext) throws Exception {
        try {

            return interceptorContext.proceed();
        } finally {
            StatefulSessionComponentInstance sfsb = (StatefulSessionComponentInstance) interceptorContext.getPrivateData(ComponentInstance.class);
            SFSBContextHandleImpl sfsbContextHandle = new SFSBContextHandleImpl(sfsb);
            List<EntityManager> readyToClose = sfsbxpcMap.remove(sfsbContextHandle);
            if (readyToClose != null && readyToClose.size() > 0) {
                for (EntityManager entityManager : readyToClose) {
                    if (entityManager instanceof ExtendedEntityManager) {
View Full Code Here

    public Interceptor create(final InterceptorFactoryContext context) {
        return new Interceptor() {
            @Override
            public Object processInvocation(InterceptorContext interceptorContext) throws Exception {
                Object target = context.getContextData().get(AbstractComponent.COMPONENT_INSTANCE_KEY);
                StatefulSessionComponentInstance sfsb = (StatefulSessionComponentInstance)target;
                SFSBContextHandleImpl sfsbContextHandle = new SFSBContextHandleImpl(sfsb);
                SFSBXPCMap.getINSTANCE().finishRegistrationOfPersistenceContext(sfsbContextHandle);
                return interceptorContext.proceed();
            }
        };
View Full Code Here

    public Interceptor create(final InterceptorFactoryContext context) {
        return new Interceptor() {
            @Override
            public Object processInvocation(InterceptorContext interceptorContext) throws Exception {
                StatefulSessionComponentInstance sfsb = (StatefulSessionComponentInstance) context.getContextData().get(AbstractComponent.COMPONENT_INSTANCE_KEY);
                SFSBContextHandleImpl sfsbContextHandle = new SFSBContextHandleImpl(sfsb);
                List<EntityManager> readyToClose = SFSBXPCMap.getINSTANCE().remove(sfsbContextHandle);
                if (readyToClose != null && readyToClose.size() > 0) {
                    for (EntityManager entityManager : readyToClose) {
                        if (entityManager instanceof ExtendedEntityManager) {
View Full Code Here

    public Object processInvocation(InterceptorContext context) throws Exception {
        ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
        if (componentInstance == null) {
            throw new IllegalStateException("componentInstance not set in InterceptorContext: " + context);
        }
        StatefulSessionComponentInstance sfsb = (StatefulSessionComponentInstance)componentInstance;
        SFSBContextHandleImpl sfsbContextHandle = new SFSBContextHandleImpl(sfsb);

        SFSBCallStack.pushCall(sfsbContextHandle);
        try {
            return context.proceed();   // call the next interceptor or target
View Full Code Here

public class SFSBCreateInterceptor implements ComponentLifecycle {


    @Override
    public void invoke(ComponentInstance target) throws Exception {
        StatefulSessionComponentInstance sfsb = (StatefulSessionComponentInstance)target;
        SFSBContextHandleImpl sfsbContextHandle = new SFSBContextHandleImpl(sfsb);
        SFSBXPCMap.getINSTANCE().finishRegistrationOfPersistenceContext(sfsbContextHandle);
    }
View Full Code Here

public class SFSBDestroyInterceptor implements ComponentLifecycle {


    @Override
    public void invoke(ComponentInstance target) throws Exception {
        StatefulSessionComponentInstance sfsb = (StatefulSessionComponentInstance)target;
        SFSBContextHandleImpl sfsbContextHandle = new SFSBContextHandleImpl(sfsb);
        SFSBXPCMap.getINSTANCE().remove(sfsbContextHandle);
    }
View Full Code Here

    public Object processInvocation(InterceptorContext context) throws Exception {
        ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
        if (componentInstance == null) {
            throw new IllegalStateException("componentInstance not set in InterceptorContext: " + context);
        }
        StatefulSessionComponentInstance sfsb = (StatefulSessionComponentInstance) componentInstance;
        SFSBContextHandleImpl sfsbContextHandle = new SFSBContextHandleImpl(sfsb);

        SFSBCallStack.pushCall(sfsbContextHandle);
        try {
            return context.proceed();   // call the next interceptor or target
View Full Code Here

TOP

Related Classes of org.jboss.as.ejb3.component.stateful.StatefulSessionComponentInstance

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.