Search in sources :

Example 1 with ValueManagedReference

use of org.jboss.as.naming.ValueManagedReference in project wildfly by wildfly.

the class StatefulRemoteViewInstanceFactory method createViewInstance.

@Override
public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) throws Exception {
    SessionID sessionID = (SessionID) contextData.get(SessionID.class);
    final StatefulEJBLocator<?> statefulEJBLocator;
    final StatefulSessionComponent statefulSessionComponent = (StatefulSessionComponent) componentView.getComponent();
    if (sessionID == null) {
        statefulEJBLocator = EJBClient.createSession(StatelessEJBLocator.create(componentView.getViewClass(), identifier, Affinity.LOCAL));
    } else {
        statefulEJBLocator = StatefulEJBLocator.create(componentView.getViewClass(), identifier, sessionID, statefulSessionComponent.getCache().getStrictAffinity());
    }
    final Object ejbProxy = EJBClient.createProxy(statefulEJBLocator);
    return new ValueManagedReference(new ImmediateValue<Object>(ejbProxy));
}
Also used : ValueManagedReference(org.jboss.as.naming.ValueManagedReference) SessionID(org.jboss.ejb.client.SessionID)

Aggregations

ValueManagedReference (org.jboss.as.naming.ValueManagedReference)1 SessionID (org.jboss.ejb.client.SessionID)1