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/LbTestServer2.java $
32 *
33 * @author Stefan Pleisch (SPL)
34 */
35 public class LbTestServer2 {
36
37 /**
38 * Private logger.
39 */
40 private static Logger s_logger = LoggerFactory.getLogger(LbTestServer2.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/startup2.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("rmiTestObjImpl2");
56
57 int iterations = 1;
58 while (iterations < LbServerConstants.NBR_ITERATIONS) {
59
60 try {
61 // 100s
62 Thread.sleep(LbServerConstants.SLEEPING_TIME);
63 } catch (Exception e) {
64 System.err.println("Problem:");
65 e.printStackTrace();
66 System.exit(-1);
67 }
68
69 iterations += 1;
70 s_logger.debug("Looping around, iteration: " + iterations);
71
72 } // while
73
74 s_logger.debug("Done.");
75 System.exit(0);
76 } // main()
77 }