Hi,

On Mon, Jun 26, 2006 at 07:22:35AM -0700, Dmitri Trembovetski wrote:
 >
 >   Could you try the workaround I've suggested?
 >   (do some java2d activity  - in particular, create a BufferedImage and
 >   render to it - on a thread created either
 >   prior to creating and setting the InheritableThreadLocalStorage
 >   or started from a separate thread).
 >
 >   I'll think on what we can do to avoid running into this in the
 >   meantime.

  I don't think we could a whole lot here. The Disposer thread
  is created in the static initializer of the Disposer class -
  we don't have any control over which thread creates it.

  Note that pretty much the same issue could happen with,
  say, EventDispatchThread, or any other thread created
  by the JDK in similar fashion (may be even finalizer
  thread?). So perhaps you should reconsider which thread
  have their storage inheritable.

  We could ask for a new API such that a thread would refuse
  the inheritance of local storage from a parent.

  You could probably try to work around this by overriding
  InheritableThreadLocal.childValue() and returning null if
  you're about to give away the ThreadLocal to some unkown thread.
  Not sure how you would distinguish from "unknown" and
  "known" threads, though - I'm assuming childValue() is called
  on the parent thread. You could do something like this:
    ...
    creatingThread = true;
    myThread = new Thread();
    thread.start();

  In your thread local:
  Object InheritableThreadLocal.childValue(Object parentValue) {
    if (!creatingThread) return null;
    // return your regular local object...
    creatingThrad = false;
    return parentValue;
  }

  It ain't pretty, but it might work.

  Thanks,
    Dmitri

 >
 >   Thanks,
 >    Dmitri
 >
 >
 > On Mon, Jun 26, 2006 at 06:00:09AM -0700, [EMAIL PROTECTED] wrote:
 >  > The leak is still there in Mustang b89.
 >  > [Message sent by forum member 'plethora' (plethora)]
 >  >
 >  > http://forums.java.net/jive/thread.jspa?messageID=126968
 >  >
 >  > 
 > ===========================================================================
 >  > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
 >  > of the message "signoff JAVA2D-INTEREST".  For general help, send email to
 >  > [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to