Package org.jboss.demo.cluster.client

Source Code of org.jboss.demo.cluster.client.StatelessSessionBeanClient

package org.jboss.demo.cluster.client;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;


import org.jboss.demo.cluster.slsb.StatelessSession;

public class StatelessSessionBeanClient {
 
  private String applicationContext = "cluster-demo-slsb";
  private String SLSB_JNDI = "ejb:/" + applicationContext + "/StatelessSessionBean!" + StatelessSession.class.getName() ;   
 
  protected void execute() throws Exception {
    Hashtable<String, String> jndiProps = new Hashtable<String, String>();
    jndiProps.put( Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming" );
    Context context = new InitialContext( jndiProps );
    StatelessSession slsb = (StatelessSession)context.lookup(SLSB_JNDI);
    for (int i = 0; i < 10; i++){
      System.out.println(slsb.getServer());
    }
  }


  public static void main(String[] args) throws Exception {
    new StatelessSessionBeanClient().execute();
  }
}
TOP

Related Classes of org.jboss.demo.cluster.client.StatelessSessionBeanClient

TOP
Copyright © 2018 www.massapi.com. 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.