Search in sources :

Example 1 with ClusterAffinity

use of org.jboss.ejb.client.ClusterAffinity in project wildfly by wildfly.

the class AssociationImpl method getStatelessAffinity.

private Affinity getStatelessAffinity(Request request) {
    ClusterTopologyRegistrar registrar = this.findClusterTopologyRegistrar(request.getLocalAddress());
    Group group = (registrar != null) ? registrar.getGroup() : null;
    return group != null && !group.isSingleton() ? new ClusterAffinity(group.getName()) : null;
}
Also used : ClusterAffinity(org.jboss.ejb.client.ClusterAffinity) Group(org.wildfly.clustering.group.Group)

Example 2 with ClusterAffinity

use of org.jboss.ejb.client.ClusterAffinity in project eap-additional-testsuite by jboss-set.

the class RemoteEJBDirectory method lookup.

@Override
protected <T> T lookup(String beanName, Class<T> beanInterface, Type type) throws NamingException {
    T bean = super.lookup(beanName, beanInterface, type);
    Affinity affinity = new ClusterAffinity("ejb");
    switch(type) {
        case STATEFUL:
            {
                EJBClient.setStrongAffinity(bean, affinity);
                break;
            }
        case STATELESS:
            {
                EJBClient.setWeakAffinity(bean, affinity);
                break;
            }
        default:
            {
            // No need to set initial affinity
            }
    }
    return bean;
}
Also used : ClusterAffinity(org.jboss.ejb.client.ClusterAffinity) ClusterAffinity(org.jboss.ejb.client.ClusterAffinity) Affinity(org.jboss.ejb.client.Affinity)

Example 3 with ClusterAffinity

use of org.jboss.ejb.client.ClusterAffinity in project eap-additional-testsuite by jboss-set.

the class RemoteEJBDirectory method lookup.

@Override
protected <T> T lookup(String beanName, Class<T> beanInterface, Type type) throws NamingException {
    T bean = super.lookup(beanName, beanInterface, type);
    Affinity affinity = new ClusterAffinity("ejb");
    switch(type) {
        case STATEFUL:
            {
                EJBClient.setStrongAffinity(bean, affinity);
                break;
            }
        case STATELESS:
            {
                EJBClient.setWeakAffinity(bean, affinity);
                break;
            }
        default:
            {
            // No need to set initial affinity
            }
    }
    return bean;
}
Also used : ClusterAffinity(org.jboss.ejb.client.ClusterAffinity) ClusterAffinity(org.jboss.ejb.client.ClusterAffinity) Affinity(org.jboss.ejb.client.Affinity)

Aggregations

ClusterAffinity (org.jboss.ejb.client.ClusterAffinity)3 Affinity (org.jboss.ejb.client.Affinity)2 Group (org.wildfly.clustering.group.Group)1