Custom field thread-local cache problem

Simply, how do we ensure that the values of a custom field are current when running on a job thread via the CustomFieldManager?

Less simply, we are running a job in another thread to disconnect processing from the EventListener thread. We notice that the value of a custom field differs when accessed from inside the EventListener execution thread (value is current and correct) versus a separate thread (value is old and incorrect). Attempts to use the same CustomFieldManager in both places still results in different values. This seems to indicate a thread-local cache, but we see no way to clear the cache or force an update of the cached value (have tried refresh() and clear() in CustomFieldManager).


I have the same problem today, did you find the solution @mike1?

I know it has been 4 years since you posted this question, but this is my solution.
Please use JiraThreadLocalUtil to solve this problem:

try {
  // Do your runnable code here
} finally {

Note that you must place everything which is running in the new thread into the try block, so the JiraThreadLocalUtil will clean up the old issue’s value before executing a new task in that thread.