I actually dislike ThreadContextStack but it is there for compatibility with 
Log4j 1.x.  I guess there are people who use it.  I didn’t make it a Collection 
in the first place for the exact reasons you mention - they aren’t used.

Ralph

On May 14, 2014, at 9:24 PM, Remko Popma <[email protected]> wrote:

> Well, the difference is that now the api (the ThreadContext.ContextStack 
> interface) extends Collection, so all implementations now *must* support all 
> methods declared on Collection. This was not a requirement before. 
> (Not sure why spi.ThreadContextStack extends Collection, by the way. 
> ThreadContext will not use these methods...)
> 
> Remko
> 
> Sent from my iPhone
> 
>> On 2014/05/08, at 4:35, [email protected] wrote:
>> 
>> Author: ggregory
>> Date: Wed May  7 19:35:45 2014
>> New Revision: 1593125
>> 
>> URL: http://svn.apache.org/r1593125
>> Log:
>> ThreadContext.ContextStack is already (conceptually) a collection of Strings 
>> so it should be a Collection<String> instead of it's sub-interface 
>> ThreadContextStack being a Collection<String>. What's the value of 
>> ThreadContextStack now? Should we keep it as a placeholder? It is not 
>> documented in its Javadoc. Note that all implementations of ContextStack are 
>> implementations of ThreadContextStack, so this change has no effect on 
>> implementors. Note that Log4jLogEvent holds a ContextStack so this makes it 
>> a Collection<String> which happens to save a lot of work for XML and JSON IO 
>> for the Jackson based receivers and layouts I am working on.
>> 
>> Modified:
>>   
>> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
>>   
>> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java
>> 
>> Modified: 
>> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
>> URL: 
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java?rev=1593125&r1=1593124&r2=1593125&view=diff
>> ==============================================================================
>> --- 
>> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
>>  (original)
>> +++ 
>> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
>>  Wed May  7 19:35:45 2014
>> @@ -347,12 +347,7 @@ public final class ThreadContext  {
>>    /**
>>     * The ThreadContext Stack interface.
>>     */
>> -    public interface ContextStack extends Serializable {
>> -
>> -        /**
>> -         * Clears all elements from the stack.
>> -         */
>> -        void clear();
>> +    public interface ContextStack extends Serializable, Collection<String> {
>> 
>>        /**
>>         * Returns the element at the top of the stack.
>> 
>> Modified: 
>> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java
>> URL: 
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java?rev=1593125&r1=1593124&r2=1593125&view=diff
>> ==============================================================================
>> --- 
>> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java
>>  (original)
>> +++ 
>> logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextStack.java
>>  Wed May  7 19:35:45 2014
>> @@ -16,12 +16,10 @@
>> */
>> package org.apache.logging.log4j.spi;
>> 
>> -import java.util.Collection;
>> -
>> import org.apache.logging.log4j.ThreadContext;
>> 
>> /**
>> *
>> */
>> -public interface ThreadContextStack extends ThreadContext.ContextStack, 
>> Collection<String> {
>> +public interface ThreadContextStack extends ThreadContext.ContextStack {
>> }
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to