Class Unbox.WebSafeState

  • Enclosing class:
    Unbox

    private static class Unbox.WebSafeState
    extends java.lang.Object
    State implementation that only puts JDK classes in ThreadLocals, so this is safe to be used from web applications. Web application containers have thread pools that may hold on to ThreadLocal objects after the application was stopped. This may prevent the classes of the application from being unloaded, causing memory leaks.

    Such memory leaks will not occur if only JDK classes are stored in ThreadLocals.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.ThreadLocal<int[]> current  
      private java.lang.ThreadLocal<java.lang.StringBuilder[]> ringBuffer  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private WebSafeState()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.StringBuilder getStringBuilder()  
      boolean isBoxedPrimitive​(java.lang.StringBuilder text)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ringBuffer

        private final java.lang.ThreadLocal<java.lang.StringBuilder[]> ringBuffer
      • current

        private final java.lang.ThreadLocal<int[]> current
    • Constructor Detail

      • WebSafeState

        private WebSafeState()
    • Method Detail

      • getStringBuilder

        public java.lang.StringBuilder getStringBuilder()
      • isBoxedPrimitive

        public boolean isBoxedPrimitive​(java.lang.StringBuilder text)