Skip to content

Instantly share code, notes, and snippets.

@maurociancio
Created February 11, 2015 17:48
Show Gist options
  • Save maurociancio/0d3f5a082454479490b7 to your computer and use it in GitHub Desktop.
Save maurociancio/0d3f5a082454479490b7 to your computer and use it in GitHub Desktop.
import java.lang.reflect.*
Thread thread = Thread.currentThread()
Field threadLocalsField = Thread.class.getDeclaredField("threadLocals")
threadLocalsField.setAccessible(true)
Object threadLocalTable = threadLocalsField.get(thread)
def values = threadLocalTable.table.grep().collect { it?.value }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment