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