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.rmi;
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: 3884 $;$Date: 2009-08-04 15:48:31 +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/rmi/TestServerNoContextPassing.java $
32   *
33   * @author Stefan Pleisch (SPL)
34   */
35  public class TestServerNoContextPassing {
36  
37  	/**
38  	 * Private logger.
39  	 */
40  	private static Logger s_logger = LoggerFactory.getLogger(TestServerNoContextPassing.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:rmi/startup.xml",
48  				"classpath:rmi/rmi-nocontext-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  
58  		int iterations = 1;
59  		while (iterations < 100) {
60  
61  			try {
62  				// 100s
63  				Thread.sleep(100000);
64  			} catch (Exception e) {
65  				System.err.println("Problem:");
66  				e.printStackTrace();
67  				System.exit(-1);
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  }