On Mon, 2005-01-31 at 16:27, Curt Arnold wrote:

> and these messages were dispatched to two distinct appenders (possibly 
> of different types) and that one instance of Chainsaw was listening to 
> both, it could determine that which logging events came from the same 
> iteration of the loop.

An assign sequence number method could first check if a sequence number
was already assigned:

class LoggingEvent ... {
  public synchronized void assignNewSequenceNumber(long count) {
    if (this.sequenceNumber != 0)
      return;
    this.sequenceNumber = count;
  }
}

class ChainsawAppender {
  long seq = 0;
  public synchronized void doAppend(LoggingEvent le) {
    le.assignSequenceNumber(seq++);
  }
}

Or:

class LoggingEvent ... {
  static long count;
  private synchronized void writeObject() {
    if (this.sequenceNumber == 0) {
      synchronized (LoggingEvent.class) {
        this.sequenceNumber = count++;
      }
    }
  }
}



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

Reply via email to