private ThreadContextProvider findConflictingProvider ( ThreadContextProvider provider , ClassLoader classloader ) { String conflictingType = provider . getThreadContextType ( ) ; for ( ThreadContextProvider p : ServiceLoader . load ( ThreadContextProvider . class , classloader ) ) { if ( conflictingType . equals ( p . getThreadContextType ( ) ) && ! provider . equals ( p ) ) return p ; } // Not found: probably a conflict with a built-in type if ( ThreadContext . APPLICATION . equals ( conflictingType ) ) return cmProvider . applicationContextProvider ; if ( ThreadContext . CDI . equals ( conflictingType ) ) return cmProvider . cdiContextProvider ; if ( ThreadContext . SECURITY . equals ( conflictingType ) ) return cmProvider . securityContextProvider ; if ( ThreadContext . TRANSACTION . equals ( conflictingType ) ) return cmProvider . transactionContextProvider ; if ( WLMContextProvider . CLASSIFICATION . equals ( conflictingType ) ) return cmProvider . wlmContextProvider ; // should be unreachable throw new IllegalStateException ( conflictingType ) ; }
Finds and returns the first thread context provider that provides the same thread context type as the specified provider .