Note: this method should only be called while holding the class lock. For performance, the lock is not explicitly
acquired.
347194
private void updateTokensStored(long now) {
    if (now <= this.nextTokenAvailableMillis) {
      return;
    }
    long millisUnaccounted = now - this.nextTokenAvailableMillis;
    double newTokens = millisUnaccounted * this.tokensPerMilli;
    this.nextTokenAvailableMillis = now;
    this.tokensStored = Math.min(this.tokensStored + newTokens, Math.max(this.tokensStored, this.maxBucketSizeInTokens));
  }
279490
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            if ((runtimeExceptionClass != null) && (exceptionClass != null)) {
                stack = new OpcodeStack();
                declaredCheckedExceptions = new HashSet<>(6);
                JavaClass cls = classContext.getJavaClass();
                classIsFinal = cls.isFinal();
                classIsAnonymous = cls.isAnonymous();
                super.visitClassContext(classContext);
            }
        } finally {
            declaredCheckedExceptions = null;
            stack = null;
        }
    }
252244
public synchronized void unlockExclusive()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "unlockExclusive", this);

    // Synchronize on the locking Mutex.
    synchronized (iMutex)
    {
      // Only release the lock if the holder is the current thread.
      if (Thread.currentThread() == iExclusiveLockHolder)
      {
        if (tc.isDebugEnabled())
          SibTr.debug(tc, "Unlocking current thread " + (iExclusiveLockCount - 1));

        // Decrement the exclusive lock count,
        // if the count reaches 0 then we know that 
        // we can safely remove the exclusive lock
        if (--iExclusiveLockCount == 0)
        {
          // Set the flag to indicate that the exclusive lock
          // has been released.
          iExclusivelyLocked = false;

          // Set the exclusive lock holder thread to be null
          iExclusiveLockHolder = null;

          // Notify any threads waiting for this lock.
          notifyAll();
        }
      }
      else if (tc.isDebugEnabled())
        SibTr.debug(tc, "Thread not the current thread to unlock exclusively");
    }

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "unlockExclusive");

  }
414271
@Override
    public void visitClassContext(ClassContext classContext) {
        JavaClass jclass = classContext.getJavaClass();

        // We can ignore classes that were compiled for anything
        // less than JDK 1.5. This should avoid lots of unnecessary work
        // when analyzing code for older VM targets.
        if (BCELUtil.preTiger(jclass)) {
            return;
        }

        boolean sawUtilConcurrentLocks = false;
        for (Constant c : jclass.getConstantPool().getConstantPool()) {
            if (c instanceof ConstantMethodref) {
                ConstantMethodref m = (ConstantMethodref) c;
                ConstantClass cl = (ConstantClass) jclass.getConstantPool().getConstant(m.getClassIndex());
                ConstantUtf8 name = (ConstantUtf8) jclass.getConstantPool().getConstant(cl.getNameIndex());
                String nameAsString = name.getBytes();
                if (nameAsString.startsWith("java/util/concurrent/locks")) {
                    sawUtilConcurrentLocks = true;
                }

            }
        }
        if (sawUtilConcurrentLocks) {
            super.visitClassContext(classContext);
        }
    }
51522
public synchronized void unlock()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "unlock", this);

    // If the subscription locks are down to zero then notify the threads waiting
    // for the subscriptionTable lock.
    synchronized (iMutex)
    {
      if (readLockCount == 0)
      {
        if (tc.isEntryEnabled()) 
          SibTr.exit(tc, "unlock", "SIErrorException");
        
        SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
          new Object[] {
            "com.ibm.ws.sib.processor.utils.AdvancedLockManager",
            "1:237:1.3" });
          
        throw new SIErrorException(
          nls.getFormattedMessage(
            "INTERNAL_MESSAGING_ERROR_CWSIP0001",
            new Object[] {
              "com.ibm.ws.sib.processor.utils.AdvancedLockManager",
              "1:244:1.3" },
            null));
      }
      
      decrementThreadLockCount();
      // Decrement the lock count and notify the other threads if no 
      // one holds the lock any more.
      if (readLockCount == 0)
        notifyAll();        
    }

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "unlock");
  }
880737
@Override
    public void visitClassContext(final ClassContext context) {
        try {
            classContext = context;
            classContext.getJavaClass().accept(this);
        } finally {
            classContext = null;
        }
    }
1320847
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            ignoreRegs = new BitSet();
            tryBlocks = new BitSet();
            catchHandlers = new BitSet();
            switchTargets = new BitSet();
            monitorSyncPCs = new ArrayList<>(5);
            stack = new OpcodeStack();
            super.visitClassContext(classContext);
        } finally {
            ignoreRegs = null;
            tryBlocks = null;
            catchHandlers = null;
            switchTargets = null;
            monitorSyncPCs = null;
            stack = null;
        }
    }
725958
static void setThreadContextClassLoader(final ClassLoader cl)
   {
      AccessController.doPrivileged(new PrivilegedAction<Object>()
      {
         public Object run()
         {
            Thread.currentThread().setContextClassLoader(cl);
            return null;
         }
      });
   }
419548
public static void initializeClass(Class clazz) {
		try {
			Class.forName(clazz.getName(), true, Thread.currentThread().getContextClassLoader());
		}
		catch (ClassNotFoundException e) {
			throw new RuntimeException(e);
		}
	}
752824
public void lock() {
        Thread t = Thread.currentThread();
        if (t == owner.get()) { // if re-enter, increment the count.
            count++;
            return;
        }
        while (owner.compareAndSet(null, t)) {
        } //spin
    }
841577
private void lock_data() {
    source.read_lock(self());
    if( validation != null && source._key != null && validation._key !=null && !source._key.equals(validation._key) )
      validation.read_lock(self());
  }
275190
@Override
  public void acquire(HLock lock) {
    acquire(lock, Long.MAX_VALUE - System.currentTimeMillis() - 10000);
  }
378788
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            JavaClass cls = classContext.getJavaClass();
            if (isSingleton(cls)) {
                syncBlockBranchResetValues = new HashMap<>();
                stack = new OpcodeStack();
                super.visitClassContext(classContext);
            }
        } finally {
            syncBlockBranchResetValues = null;
            stack = null;
        }
    }
559278
public void eventLocked()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "eventLocked");

    // modify prefetching info
    synchronized (this)
    {
      RemoteDispatchableKey dkey = key.getRemoteDispatchableKey();
      RemoteQPConsumerKey ck = null;
      if (dkey instanceof RemoteQPConsumerKey)
        ck = (RemoteQPConsumerKey) dkey;

      if (ck != null)
      {
        ck.messageLocked(key);
        informedConsumerKeyThatLocked = true;
      }
    }

    // call superclass
    super.eventLocked();

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "eventLocked");
  }
706291
private void lockAndRegisterReferences(ClassDescriptor cld, Object sourceObject, int lockMode, List registeredObjects) throws LockNotGrantedException
    {
        if (implicitLocking)
        {
            Iterator i = cld.getObjectReferenceDescriptors(true).iterator();
            while (i.hasNext())
            {
                ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
                Object refObj = rds.getPersistentField().get(sourceObject);
                if (refObj != null)
                {
                    boolean isProxy = ProxyHelper.isProxy(refObj);
                    RuntimeObject rt = isProxy ? new RuntimeObject(refObj, this, false) : new RuntimeObject(refObj, this);
                    if (!registrationList.contains(rt.getIdentity()))
                    {
                        lockAndRegister(rt, lockMode, registeredObjects);
                    }
                }
            }
        }
    }
446430
private void blockingRefresh() {
        try {
            if (blockingRefreshLock
                    .tryLock(BLOCKING_REFRESH_MAX_WAIT_IN_SECONDS, TimeUnit.SECONDS)) {
                try {
                    // Return if successful refresh occurred while waiting for the lock
                    if (!shouldDoBlockingRefresh()) {
                        return;
                    } else {
                        // Otherwise do a synchronous refresh if the last lock holder was unable to
                        // refresh the value
                        refreshValue();
                        return;
                    }
                } finally {
                    blockingRefreshLock.unlock();
                }
            }
        } catch (InterruptedException ex) {
            handleInterruptedException("Interrupted waiting to refresh the value.", ex);
        }
        // Couldn't acquire the lock. Just try a synchronous refresh
        refreshValue();
    }
1161715
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            stack = new OpcodeStack();
            storeToUserValue = new HashMap<>();
            allocLocation = new HashMap<>();
            allocToAddPCs = new HashMap<>();
            optionalRanges = new ArrayList<>();
            super.visitClassContext(classContext);
        } finally {
            stack = null;
            storeToUserValue = null;
            allocLocation = null;
            allocToAddPCs = null;
            optionalRanges = null;
        }
    }