private ThreadContextDescriptor captureThreadContext ( Executor executor ) { WSManagedExecutorService managedExecutor = defaultExecutor instanceof WSManagedExecutorService // ? ( WSManagedExecutorService ) defaultExecutor // : executor != defaultExecutor && executor instanceof WSManagedExecutorService // ? ( WSManagedExecutorService ) executor // : null ; if ( managedExecutor == null ) return null ; @ SuppressWarnings ( "unchecked" ) ThreadContextDescriptor contextDescriptor = managedExecutor . getContextService ( ) . captureThreadContext ( XPROPS_SUSPEND_TRAN ) ; return contextDescriptor ; }
Captures thread context if possible first based on the default asynchronous execution facility otherwise based on the specified executor . If neither of these executors are a managed executor then thread context is not captured .