avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject [logkit] Closeable
Date Mon, 03 Mar 2003 10:48:22 GMT

> From: Peter Donald [mailto:peter@realityforge.org] 
> Hi,
> I have added a Closeable interface into Logkit

OK, but even with a closeable interface the question is:

  If a LogTarget wraps another LogTarget, should it
  close the wrapped target when it is closed?

The answer so far is *no*. OK, so we can solve this in
two ways (I'm sure there are more):

 1. Include a flag indicating close or not:

      LogTarget myWrappedTarget = 
          new WrappedLogTarget (targetToWrap, 
                                true /* close targetToWrap when 
                                        myWrappedTarget is closed */ );

    Default to false (don't close) to maintain backwards

 2. Change the answer to "yes" - that is, if a LogTarget wraps 
    another LogTarget, it should close the wrapped target when 
    it is closed. We can then inhibit the closing by introducing 
    a NonClosingWrapper that will *not* propagate the close()
    call to the wrapped target.

      LogTarget myWrappedTarget = 
          new WrappedLogTarget (targetToWrap);
      myWrappedTarget.close (); // Closes targetToWrap as well

      LogTarget myWrappedTarget = 
          new WrappedLogTarget (
              new NonClosingWrapper (targetToWrap));
      myWrappedTarget.close (); // Does not close targetToWrap 


We could get this thing into LogKit1.2.1 or LogKit1.3.


To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org

View raw message