private Subject getSubject ( ) { return AccessController . doPrivileged ( new PrivilegedAction < Subject > ( ) { /** * run method */ public Subject run ( ) { try { String domain = recoverSecurityDomain ; if ( domain != null && subjectFactory != null ) { Subject subject = SecurityActions . createSubject ( subjectFactory , domain ) ; Set < PasswordCredential > pcs = SecurityActions . getPasswordCredentials ( subject ) ; if ( ! pcs . isEmpty ( ) ) { for ( PasswordCredential pc : pcs ) { pc . setManagedConnectionFactory ( mcf ) ; } } log . debugf ( "Recovery Subject=%s" , subject ) ; return subject ; } else { log . noCrashRecoverySecurityDomain ( jndiName ) ; } } catch ( Throwable t ) { log . exceptionDuringCrashRecoverySubject ( jndiName , t . getMessage ( ) , t ) ; } return null ; } } ) ; }
This method provide the Subject used for the XA Resource Recovery integration with the XAResourceRecoveryRegistry .