< prev index next >
src/java.xml/share/classes/com/sun/xml/internal/stream/util/ThreadLocalBufferAllocator.java
Print this page
*** 37,53 ****
*
* @author Binu.John@sun.com
* @author Santiago.PericasGeertsen@sun.com
*/
public class ThreadLocalBufferAllocator {
! private static ThreadLocal tlba = new ThreadLocal();
public static BufferAllocator getBufferAllocator() {
! SoftReference bAllocatorRef = (SoftReference) tlba.get();
if (bAllocatorRef == null || bAllocatorRef.get() == null) {
bAllocatorRef = new SoftReference(new BufferAllocator());
tlba.set(bAllocatorRef);
}
! return (BufferAllocator) bAllocatorRef.get();
}
}
--- 37,53 ----
*
* @author Binu.John@sun.com
* @author Santiago.PericasGeertsen@sun.com
*/
public class ThreadLocalBufferAllocator {
! private static ThreadLocal<SoftReference> tlba = new ThreadLocal<>();
public static BufferAllocator getBufferAllocator() {
! SoftReference<BufferAllocator> bAllocatorRef = tlba.get();
if (bAllocatorRef == null || bAllocatorRef.get() == null) {
bAllocatorRef = new SoftReference(new BufferAllocator());
tlba.set(bAllocatorRef);
}
! return bAllocatorRef.get();
}
}
< prev index next >