Пример #1
0
 private void addHashEntry(
     final AtomicReferenceArray<ClassInfoEntry> hashTable, final ClassInfo ci) {
   final int hh = ci.getHandle() % hashTable.length();
   final int nh =
       ci.getDescribedClass() == null
           ? -1
           : ((ci.getDescribedClass().getName().hashCode() & 0x7FFFFFFF) % hashTable.length());
   boolean added = addHashEntry(hashTable, ci, hh);
   if (nh != -1 && nh != hh) {
     added |= addHashEntry(hashTable, ci, nh);
   }
   if (!added) {
     _discardedDuplicates.incrementAndGet();
   }
 }
Пример #2
0
 private boolean addHashEntry(
     final AtomicReferenceArray<ClassInfoEntry> hashTable, final ClassInfo ci, final int hash) {
   ClassInfoEntry cie = hashTable.get(hash);
   while (cie != null) {
     if (ci.equals(cie._classInfo)) {
       return false;
     }
     cie = cie._next;
   }
   cie = hashTable.get(hash);
   final ClassInfoEntry newCie = new ClassInfoEntry(ci, cie);
   hashTable.set(hash, newCie);
   _size.incrementAndGet();
   return true;
 }