Hi !

I just looked at the serialization of Priority/Level in LoggingEvent and
... it's a bit messy ;)

I think a better way is to use the readResolve Method documented here: 
http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/input.doc6.html#5903

This would look like:

public class Priority implements Serializable {  
  private static HashSet priorities = Collections.synchronizedSet(new
HashSet());

  protected Priority(int level, String levelStr, int syslogEquivalent) {
    priorities.add(this);

    ...
  }

  private Object readResolve() {
    if (priorities.contains(this))
      return priorities.get(this);

    priorities.add(this);
    return this;
  }
  
  public boolean equals(Object obj) {
    // override, so that levels which have the same level/class/levelStr
are equal
  }

  public int hashCode() {
    // override, so that levels which have the same level/class/levelStr 
    // have the same hashCode
  }
}

I you are interested, I will write a patch for this.

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to