1. /*
  2. * @(#)NameServiceStartThread.java 1.11 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.internal.Activation;
  8. import java.io.File;
  9. import org.omg.CosNaming.NamingContext;
  10. import com.sun.corba.se.internal.POA.POAORB;
  11. import com.sun.corba.se.internal.PCosNaming.NameService;
  12. import com.sun.corba.se.internal.orbutil.ORBConstants;
  13. // REVISIT: After Merlin to see if we can get rid of this Thread and
  14. // make the registration of PNameService for INS and BootStrap neat.
  15. public class NameServiceStartThread extends java.lang.Thread
  16. {
  17. private POAORB orb;
  18. private File dbDir;
  19. private InitialNamingImpl ins;
  20. public NameServiceStartThread( POAORB theOrb,
  21. File theDir, InitialNamingImpl theIns )
  22. {
  23. orb = theOrb;
  24. dbDir = theDir;
  25. ins = theIns;
  26. }
  27. public void run( )
  28. {
  29. // start Name Service
  30. try
  31. {
  32. NameService nameService = new NameService(orb, dbDir );
  33. NamingContext rootContext =
  34. nameService.initialNamingContext();
  35. ins.bind( ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext,
  36. false);
  37. orb.register_initial_reference(
  38. ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext );
  39. } catch( Exception e ) {
  40. System.err.println(
  41. "NameService did not start successfully" );
  42. e.printStackTrace( );
  43. }
  44. }
  45. }