1. /*
  2. * @(#)INSObjectKeyMap.java 1.6 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.core;
  8. import java.util.Hashtable;
  9. /**
  10. * This is a Singleton class which stores a map of INSObjectKey to the IOR
  11. * and Subcontract. This map is used by SibcontractRegistry and
  12. * ServerSubcontract to reply INS locateMessages.
  13. * NOTE: This class is a singleton and will be shared among multiple ORB's
  14. * in the same process. If you register INS Service with the same name from
  15. * different ORBs then it will have a wrong effect of overwriting the old
  16. * registration.
  17. */
  18. public class INSObjectKeyMap {
  19. private static INSObjectKeyMap instance = null;
  20. private static boolean isInitialized = false;
  21. private static class INSObjectKeyMapHolder {
  22. static final INSObjectKeyMap value = new INSObjectKeyMap() ;
  23. }
  24. public static INSObjectKeyMap getInstance( ) {
  25. return INSObjectKeyMapHolder.value ;
  26. }
  27. // objectKeyMap will have INS ASCII based ObjectKey as the key and
  28. // INSObjectKeyEntry as the entry, which will contain the target IOR and
  29. // subcontract.
  30. private Hashtable objectKeyMap;
  31. private INSObjectKeyMap( ) {
  32. objectKeyMap = new Hashtable();
  33. }
  34. public void setEntry( String objectKey, INSObjectKeyEntry entry )
  35. {
  36. objectKeyMap.put( objectKey, entry );
  37. }
  38. public INSObjectKeyEntry getEntry( String objectKey ) {
  39. return (INSObjectKeyEntry) objectKeyMap.get( objectKey );
  40. }
  41. }