final void detectMultithreadedAccess ( ) { Thread currentThreadID = Thread . currentThread ( ) ; if ( currentThreadID == threadID ) return ; if ( threadID == null ) threadID = currentThreadID ; else { mcf . detectedMultithreadedAccess = true ; java . io . StringWriter writer = new java . io . StringWriter ( ) ; new Error ( ) . printStackTrace ( new java . io . PrintWriter ( writer ) ) ; Tr . warning ( tc , "MULTITHREADED_ACCESS_DETECTED" , this , Integer . toHexString ( threadID . hashCode ( ) ) + ' ' + threadID , Integer . toHexString ( currentThreadID . hashCode ( ) ) + ' ' + currentThreadID , writer . getBuffer ( ) . delete ( 0 , "java.lang.Error" . length ( ) ) ) ; } }
Detect multithreaded access . This method is called only if detection is enabled . The method ensures that the current thread id matches the saved thread id for this MC . If the MC was just taken out the pool the thread id may not have been recorded yet . In this case we save the current thread id . Otherwise if the thread ids don t match log a message indicating that multithreaded access was detected .