I think we should call ThreadLocal.remove here instead of trying to reset the original value, since calls to DelayBufferedOutputStream.flushBuffer will always be from a thread in the jenkins.util.Timer thread pool, and so even if we did care about what the original value was (I don't think we do, the default is true, we set it to false just for the call to flush, and then set it back to true, and it is a ThreadLocal so we don't have to worry about interference from other threads, so it will always be true going into flushBuffer IIUC), it would only matter if we happened to use a thread from the pool that we had already used previously, which is not something we can count on. |