1 28 29 package com.caucho.es; 30 31 import java.util.Hashtable ; 32 33 final public class ESId extends ESString { 34 static Integer LOCK = new Integer (0); 35 static Hashtable intern; 37 38 41 private ESId(String string) 42 { 43 super(string); 44 } 45 46 public static ESId intern(String string) 47 { 48 if (intern == null) { 49 synchronized (LOCK) { 50 if (intern == null) 51 intern = new Hashtable (); 52 } 53 } 54 55 ESId value = (ESId) intern.get(string); 56 if (value != null) 57 return value; 58 59 string = string.intern(); 60 61 value = new ESId(string); 62 63 intern.put(string, value); 64 65 return value; 66 } 67 68 public final boolean equals(Object a) 69 { 70 if (this == a) 71 return true; 72 else if (a instanceof ESId) 73 return false; 74 else if (a instanceof ESString) 75 return string.equals(((ESString) a).string); 76 else 77 return false; 78 } 79 } 80 81 82 | Popular Tags |