Requested:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1801
"It is useful to know what is on the Thread local stack without having to
remove
it from the stack."

Implementation:
  /**
     Looks at the diagnosticcontext at the top of this NDC without removing
it.

     <p>The returned value is the value that was pushed last. If no
     context is available, then the empty string "" is returned.

     @return String The innermost diagnostic context.

     */
  public
  static
  String peek() {
    Thread key = Thread.currentThread();
    Stack stack = (Stack) ht.get(key);
    if(stack != null && !stack.isEmpty())
      return ((DiagnosticContext) stack.peek()).message;
    else
      return "";
  }

+1

Mathias


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

Reply via email to