> From: Peter Donald [mailto:[EMAIL PROTECTED]
>
> 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
compatibility.
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.
a:
LogTarget myWrappedTarget =
new WrappedLogTarget (targetToWrap);
myWrappedTarget.close (); // Closes targetToWrap as well
b:
LogTarget myWrappedTarget =
new WrappedLogTarget (
new NonClosingWrapper (targetToWrap));
myWrappedTarget.close (); // Does not close targetToWrap
Thoughts?
We could get this thing into LogKit1.2.1 or LogKit1.3.
/LS
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]