Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2008, 2010 VMware Inc. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: VMware Inc. - initial contribution /
package org.eclipse.virgo.nano.serviceability.dump;

Maintains state about which java.lang.Throwable was last seen for the current thread.

Concurrent Semantics
State is thread local.

final class FFDCExceptionState {
    private static final State STATE = new State();

    
Record that the supplied java.lang.Throwable has been seen.

Parameters:
t the Throwable.
    public static void record(Throwable t) {
        .set(t);
    }

    
Query whether the supplied java.lang.Throwable or one of its causes has been seen.

Parameters:
t the Throwable
Returns:
true if the Throwable has been seen, otherwise false.
    public static boolean seen(Throwable t) {
        boolean seen = false;
        Throwable s = t;
        do {
            if (s.equals(.get())) {
                seen = true;
                break;
            }
            s = s.getCause();
        } while (s != null);
        return seen;
    }
    private static class State extends ThreadLocal<Throwable> {

        
        @Override public String toString() {
            return String.format("FFDC Exception State [lastSeen = '" + get() + "']");
        }
    }
New to GrepCode? Check out our FAQ X