|
3 | 3 | import java.util.ArrayList;
|
4 | 4 | import java.util.List;
|
5 | 5 | import java.util.logging.Level;
|
| 6 | +import java.util.regex.Matcher; |
| 7 | +import java.util.regex.Pattern; |
6 | 8 |
|
7 | 9 | import com.newrelic.api.agent.Config;
|
8 | 10 | import com.newrelic.api.agent.NewRelic;
|
@@ -42,6 +44,25 @@ public static void addIgnore(String s) {
|
42 | 44 | }
|
43 | 45 |
|
44 | 46 | public static boolean ignoreSuspend(Object obj) {
|
45 |
| - return ignoredSuspends.contains(obj.toString()) || ignoredSuspends.contains(obj.getClass().getName()); |
| 47 | + String objString = obj.toString(); |
| 48 | + String className = obj.getClass().getName(); |
| 49 | + NewRelic.getAgent().getLogger().log(Level.FINE, "Call to SuspendIgnores.ignoreSuspend, objString = {0}, className = {1}" , objString, className); |
| 50 | + |
| 51 | + if(ignoredSuspends.contains(objString) || ignoredSuspends.contains(className)) { |
| 52 | + NewRelic.getAgent().getLogger().log(Level.FINE, "Matched classname or objString"); |
| 53 | + return true; |
| 54 | + } |
| 55 | + |
| 56 | + for(String s : ignoredSuspends) { |
| 57 | + NewRelic.getAgent().getLogger().log(Level.FINE, "Comparing to regex {0}", s); |
| 58 | + Pattern pattern = Pattern.compile(s); |
| 59 | + Matcher matcher1 = pattern.matcher(objString); |
| 60 | + Matcher matcher2 = pattern.matcher(className); |
| 61 | + NewRelic.getAgent().getLogger().log(Level.FINE, matcher1.matches() ? "Matched objString" : matcher2.matches() ? "Matched Classname" : "not a match for object string or classname"); |
| 62 | + if(matcher1.matches() || matcher2.matches()) return true; |
| 63 | + } |
| 64 | + |
| 65 | + return false; |
| 66 | +// return ignoredSuspends.contains(obj.toString()) || ignoredSuspends.contains(obj.getClass().getName()); |
46 | 67 | }
|
47 | 68 | }
|
0 commit comments