protected final int computeHashCode ( Subject subject , ConnectionRequestInfo cri ) { final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "computeHashCode" ) ; } if ( isTracingEnabled && tc . isDebugEnabled ( ) ) { StringBuffer sbuff = new StringBuffer ( ) ; sbuff . append ( "computeHashCode for Subject " ) ; if ( subject == null ) { sbuff . append ( "null" ) ; } else { // synchronized (this) { SubjectToString subjectToString = new SubjectToString ( ) ; subjectToString . setSubject ( subject ) ; sbuff . append ( AccessController . doPrivileged ( subjectToString ) ) ; // } } if ( cri == null ) { sbuff . append ( " and CRI null" ) ; } else { sbuff . append ( " and CRI " + cri . toString ( ) ) ; } Tr . debug ( this , tc , sbuff . toString ( ) ) ; } /* * Future improvement can be if we may * want to check subject a cri before * computing hashcode again */ int sHash , cHash , hashCode ; if ( subject != null ) { // RRA currently returns false for re-authentication support if ( ! gConfigProps . raSupportsReauthentication ) { /* * If we are the rra or re-authentication is not supported, * get the subjects hash code and use it in the computed * hash code value. */ SubjectHashCode subjectHashCode = new SubjectHashCode ( ) ; subjectHashCode . setSubject ( subject ) ; sHash = AccessController . doPrivileged ( subjectHashCode ) ; } else { /* * If re-authentication is supported, do * not use the subjects hash code in the computed hash code value. * Use the default value of 1. */ sHash = 1 ; } } else { sHash = 1 ; } if ( cri != null ) { cHash = cri . hashCode ( ) ; } else { cHash = 1 ; } hashCode = Math . abs ( ( sHash / 2 ) + ( cHash / 2 ) ) ; if ( isTracingEnabled && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "Subject's hash code is " + sHash + " and the CRI's hash code is " + cHash ) ; Tr . debug ( this , tc , "computeHashCode, hashCode is " + hashCode ) ; } if ( isTracingEnabled && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "computeHashCode" ) ; } return hashCode ; }
173212 - computeHashCode