Package org.jboss.ejb.client

Examples of org.jboss.ejb.client.SessionID


        context.putPrivateData(Component.class, ejbComponent);
        context.putPrivateData(ComponentView.class, view);


        if (locator instanceof StatefulEJBLocator) {
            final SessionID sessionID = ((StatefulEJBLocator) locator).getSessionId();
            context.putPrivateData(SessionID.class, sessionID);
        } else if (locator instanceof EntityEJBLocator) {
            final Object primaryKey = ((EntityEJBLocator) locator).getPrimaryKey();
            context.putPrivateData(EntityBeanComponent.PRIMARY_KEY_CONTEXT_KEY, primaryKey);
        }
View Full Code Here


        final EJBComponent component = ejbInfo.getEjbComponent();
        if (!(component instanceof StatefulSessionComponent)) {
            throw MESSAGES.notStatefulSessionBean(beanName, appName, moduleName, distinctName);
        }
        final StatefulSessionComponent statefulComponent = (StatefulSessionComponent) component;
        final SessionID sessionID = statefulComponent.createSession();
        return new StatefulEJBLocator<T>(viewType, appName, moduleName, beanName, distinctName, sessionID, statefulComponent.getCache().getStrictAffinity(), this.getNodeName());
    }
View Full Code Here

        // invoke the method and write out the response on a separate thread
        executorService.submit(runnable);
    }

    private Affinity getWeakAffinity(final StatefulSessionComponent statefulSessionComponent, final StatefulEJBLocator<?> statefulEJBLocator) {
        final SessionID sessionID = statefulEJBLocator.getSessionId();
        return statefulSessionComponent.getCache().getWeakAffinity(sessionID);
    }
View Full Code Here

            this.channelAssociation = channelAssociation;
        }

        @Override
        public void run() {
            final SessionID sessionID;
            try {
                try {
                    sessionID = statefulSessionComponent.createSession();
                } catch (Throwable t) {
                    SessionOpenRequestHandler.this.writeException(channelAssociation, SessionOpenRequestHandler.this.marshallerFactory, invocationId, t, null);
View Full Code Here

    }

    private void prepareInterceptorContext(final SkeletonStrategy op, final Object[] params, final InterceptorContext interceptorContext) throws IOException, ClassNotFoundException {
        if (!home) {
            if (componentView.getComponent() instanceof StatefulSessionComponent) {
                final SessionID sessionID = (SessionID) unmarshalIdentifier();
                interceptorContext.putPrivateData(SessionID.class, sessionID);
            } else if (componentView.getComponent() instanceof EntityBeanComponent) {
                final Object pk = unmarshalIdentifier();
                interceptorContext.putPrivateData(EntityBeanComponent.PRIMARY_KEY_CONTEXT_KEY, pk);
            }
View Full Code Here

        this.beanName = beanName;
    }

    @Override
    public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) {
        SessionID sessionID = (SessionID) contextData.get(SessionID.SESSION_ID_KEY);
        if(sessionID == null) {
            try {
                sessionID = EJBClient.createSession(applicationName, moduleName, beanName, distinctName);
            } catch (Exception e) {
                throw MESSAGES.failToCreateStatefulSessionBean(beanName,e);
View Full Code Here

        this.serviceName = serviceName;
    }

    @Override
    public Object processInvocation(final InterceptorContext context) throws Exception {
        SessionID sessionId = (SessionID) context.getPrivateData(SessionID.SESSION_ID_KEY);
        return new StatefulSerializedProxy(serviceName, sessionId);
    }
View Full Code Here

    @Override
    public Object processInvocation(InterceptorContext context) throws Exception {
        StatefulSessionComponent component = getComponent(context, StatefulSessionComponent.class);
        // TODO: this is a contract with the client interceptor
        SessionID sessionId = (SessionID) context.getPrivateData(SessionID.SESSION_ID_KEY);
        if (sessionId == null) {
            throw MESSAGES.statefulSessionIdIsNull(component.getComponentName());
        }
        ROOT_LOGGER.debug("Looking for stateful component instance with session id: " + sessionId);
        StatefulSessionComponentInstance instance = component.getCache().get(sessionId);
View Full Code Here

            if (this.isApplicationException(statefulComponent, e.getClass(), context.getMethod()) && this.retainIfException) {
                throw e;
            }
            // otherwise, just remove it and throw back the original exception
            final StatefulSessionComponentInstance statefulComponentInstance = (StatefulSessionComponentInstance) context.getPrivateData(ComponentInstance.class);
            final SessionID sessionId = statefulComponentInstance.getId();
            statefulComponent.removeSession(sessionId);
            throw e;
        }
        final StatefulSessionComponentInstance statefulComponentInstance = (StatefulSessionComponentInstance) context.getPrivateData(ComponentInstance.class);
        final SessionID sessionId = statefulComponentInstance.getId();
        // just remove the session because of a call to @Remove method
        statefulComponent.removeSession(sessionId);
        // return the invocation result
        return invocationResult;
    }
View Full Code Here

    public Interceptor create(InterceptorFactoryContext context) {
        final AtomicReference<SessionID> sessionIdReference = new AtomicReference<SessionID>();
        context.getContextData().put(StatefulSessionComponent.SESSION_ID_REFERENCE_KEY, sessionIdReference);

        //if we are attaching to an existing instance this will not be null
        final SessionID id = (SessionID) context.getContextData().get(SessionID.SESSION_ID_KEY);
        if(id == null) {
            return new StatefulComponentSessionIdGeneratingInterceptor(sessionIdReference);
        } else {
            sessionIdReference.set(id);
            return Interceptors.getTerminalInterceptor();
View Full Code Here

TOP

Related Classes of org.jboss.ejb.client.SessionID

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.