Skip to content

Instantly share code, notes, and snippets.

@spullara
Created September 24, 2010 01:02
Show Gist options
  • Select an option

  • Save spullara/594704 to your computer and use it in GitHub Desktop.

Select an option

Save spullara/594704 to your computer and use it in GitHub Desktop.
private static Set<String> adminNeeded = Collections.synchronizedSet(new HashSet<String>());
...
StringBuilder sb = new StringBuilder();
for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
String className = ste.getClassName();
if (className.startsWith("javax.servlet.http.HttpServlet")) break;
if (className.startsWith("java.lang.Thread")
|| !className.startsWith("bagcheck")
|| className.startsWith("bagcheck.services.Util")) continue;
sb.append(className).append(".").append(ste.getMethodName()).append("(")
.append(ste.getFileName()).append(":").append(ste.getLineNumber()).append(")").append(" ");
}
String fingerprint = sb.toString();
if (adminNeeded.add(fingerprint)) {
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment