@Test public void threadLocal2Threads() throws InterruptedException {

    AutoreleaseBatcher.forThread(1);
    ID idNSObject = Foundation.cfRetain(autoreleasedObject());
    assertRetainCount(2, idNSObject);
    
    Thread thread = new Thread() {
        public void run() {
            try {
                AutoreleaseBatcher.forThread(1);
                ID idNSObject = Foundation.cfRetain(autoreleasedObject());
                assertRetainCount(2, idNSObject);

                AutoreleaseBatcher.forThread(1).operate();
                assertRetainCount(1, idNSObject);
            } catch (Throwable t) {
                thrown = t;
            }
        }};
    thread.run();
    thread.join();
    
    AutoreleaseBatcher.forThread(1).operate();
    assertRetainCount(1, idNSObject);
    assertNull(thrown);
}