Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / POA / Loader / server.cpp
blobfad2f61b8a845cb803a86f7ebb77f1399986c4d2
2 //=============================================================================
3 /**
4 * @file server.cpp
6 * Server application to test the Servant Activator and Servant Locator.
8 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
9 */
10 //=============================================================================
13 #include "Server_Manager.h"
15 int
16 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
18 try
20 Server_i server;
22 if (server.init (argc, argv) != 0)
23 ACE_ERROR_RETURN ((LM_ERROR,
24 "Failure during Initialisation: init ()\n"),
25 -1);
27 // This POA is used to test the Servant Activator interface and
28 // hence has an RETAIN policy.
29 PortableServer::POA_var first_poa =
30 server.create_poa ("firstPOA", 1);
32 if (first_poa.in () == 0)
33 ACE_ERROR_RETURN ((LM_ERROR,
34 "Failure during first POA creation: create_poa ()\n"),
35 -1);
37 // This poa is used to test the Servant Activator interface and
38 // hence has an NONRETAIN policy.
39 PortableServer::POA_var second_poa =
40 server.create_poa ("secondPOA", 0);
42 if (second_poa.in () == 0)
43 ACE_ERROR_RETURN ((LM_ERROR,
44 "Failure during second POA creation: create_poa ()\n"),
45 -1);
47 // The Servant Activator interface is created and initialised.
48 if (server.create_activator (first_poa) != 0)
49 ACE_ERROR_RETURN ((LM_ERROR,
50 "Failure during first Servant Activator creation: create_activator()\n"),
51 -1);
53 // The Servant Locator interface is created and initialised.
54 if (server.create_locator (second_poa) !=0)
55 ACE_ERROR_RETURN ((LM_ERROR,
56 "Failure during first Servant Locator creation: create_activator()\n"),
57 -1);
59 // The server begins processing requests.
60 if (server.run () != 0)
61 ACE_ERROR_RETURN ((LM_ERROR,
62 "Failure during request processing: run ()\n"),
63 -1);
65 catch (const ::CORBA::Exception &ex)
67 ex._tao_print_exception("Caught unexpected CORBA exception :");
69 return 0;