// Compiles component sent by master // Copyright (C) 2000 Stephen A. Torri // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Questions, comments or improvements should be sent to: // s.torri@lancaster.ac.uk or storri@stratos.net // #include #include #include #include //---------------------------------- // Main // // argc: Number of arguments (int) // argv: Array of arguments (char[]) //----------------------------------- int main(int argc, char* argv[]) { CORBA::ORB_ptr orb; CORBA::Object_var obj; try{ // Initialize ORB & Object orb = CORBA::ORB_init(argc, argv); obj = orb->resolve_initial_references("RootPOA"); dout << "slave.cpp:main - Resolved RootPOA" << endl; PortableServer::POA_var rootPOA = PortableServer::POA::_narrow(obj); PortableServer::POAManager_var manager = rootPOA -> the_POAManager(); manager -> activate(); dout << "slave.cpp:main - Activated POAManager" << endl; Slave_impl* s_impl = new Slave_impl(); Comms::Slave_var slv = s_impl -> _this(); Comms::Master_var mstr; // Initialize JTC JTCInitialize bootJTC (argc, argv); // Register with Name Service dout << "slave.cpp:main - initializing slave" << endl; s_impl -> initialize(orb, slv); dout << "slave.cpp:main - finding location of master" << endl; mstr = s_impl -> findMaster(orb); dout << "slave.cpp:main - registering with master" << endl; s_impl -> registerSlave(orb, mstr); // Start Job thread // (wait for slave and issue out jobs) dout << "slave.cpp:main - starting Job Process thread" << endl; s_impl->startJobProcess(); // Start Monitor thread // (answer requests for status of each slave) dout << "slave.cpp:main - starting Monitor thread" << endl; s_impl->startMonitor(); orb->run(); } catch(const CORBA::Exception &e){ cerr << "Uncaught CORBA exception: " << e << endl; return 1; } orb->destroy(); return 0; }