Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-17510

Create an executor service wrapper class that sets the security context in each thread

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • core

      Initially suggested by jglick when I asked a question on the developer group https://groups.google.com/forum/?fromgroups=#!topic/jenkinsci-dev/H8gAZcDOqgc -

      Creates a delegating ExecutorService implementation whose submit and related methods capture the current SecurityContext
      and then wrap the task in a block that resets the context afterwards. Using this one could simply write:

      SomeUtilityClass.wrapExecutorWithSecurity(service).submit(new Callable<Void>() { 
           public Void call() throws Exception { 
               Jenkins.getInstance().getItem(whatever); // should work 
               return null; 
           } 
      }); 
      

            pmaccamp Patrick McKeown
            pmaccamp Patrick McKeown
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: