View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2006 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  package ch.elca.el4j.tests.services.remoting.loadbalancing.server;
18  
19  import org.slf4j.Logger;
20  import org.slf4j.LoggerFactory;
21  import org.springframework.context.ApplicationContext;
22  
23  import ch.elca.el4j.tests.services.remoting.loadbalancing.common.BusinessObject;
24  import ch.elca.el4j.core.context.ModuleApplicationContext;
25  
26  /**
27   * Defines the server used to test the idempotent invocation module. Launches a
28   * business object whose unique purpose is to illustrate the behavior of the
29   * module.
30   *
31   * @svnLink $Revision: 3879 $;$Date: 2009-08-04 15:13:46 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/tests/remoting/apps/server/src/test/java/ch/elca/el4j/tests/services/remoting/loadbalancing/server/LbTestServer.java $
32   *
33   * @author Stefan Pleisch (SPL)
34   */
35  public class LbTestServer {
36  
37  	/**
38  	 * Private logger.
39  	 */
40  	private static Logger s_logger = LoggerFactory.getLogger(LbTestServer.class);
41  
42  	/** {@inheritDoc} */
43  	public static void main(String args[]) {
44  
45  		ApplicationContext applicationContext = new ModuleApplicationContext(
46  			new String[] {"classpath*:mandatory/*.xml",
47  				"classpath:loadbalancing/server/startup.xml",
48  			"classpath:loadbalancing/remoting/multiplermi-protocol-config.xml"},
49  			(String[]) null,
50  			false,
51  			(ApplicationContext) null);
52  
53  		s_logger.debug("Starting up ....");
54  
55  		BusinessObject obj = (BusinessObject)applicationContext.getBean("rmiTestObjImpl");
56  
57  		int iterations = 1;
58  		while (iterations < LbServerConstants.NBR_ITERATIONS) {
59  
60  			try {
61  				Thread.sleep(LbServerConstants.SLEEPING_TIME);
62  			} catch (Exception e) {
63  				System.err.println("Problem:");
64  				e.printStackTrace();
65  				System.exit(-1);
66  			} // catch
67  
68  			iterations += 1;
69  			s_logger.debug("Looping around, iteration: " + iterations);
70  
71  		} // while
72  
73  		s_logger.debug("Done.");
74  		System.exit(0);
75  	} // main()
76  }