karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [02/11] git commit: [KARAF-2865] Avoid uninteresting exception stack traces while running load-test
Date Tue, 01 Apr 2014 11:43:35 GMT
[KARAF-2865] Avoid uninteresting exception stack traces while running load-test


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/504dbcae
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/504dbcae
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/504dbcae

Branch: refs/heads/master
Commit: 504dbcaefcdbb36acbf5d5b24928067f561bebd0
Parents: c57532d
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Sat Mar 29 11:36:51 2014 +0100
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Tue Apr 1 10:14:56 2014 +0200

----------------------------------------------------------------------
 .../org/apache/karaf/bundle/command/LoadTest.java     | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/504dbcae/bundle/command/src/main/java/org/apache/karaf/bundle/command/LoadTest.java
----------------------------------------------------------------------
diff --git a/bundle/command/src/main/java/org/apache/karaf/bundle/command/LoadTest.java b/bundle/command/src/main/java/org/apache/karaf/bundle/command/LoadTest.java
index 7ca43b2..8ed318f 100644
--- a/bundle/command/src/main/java/org/apache/karaf/bundle/command/LoadTest.java
+++ b/bundle/command/src/main/java/org/apache/karaf/bundle/command/LoadTest.java
@@ -32,6 +32,7 @@ import org.apache.karaf.shell.api.action.lifecycle.Reference;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 import org.osgi.framework.FrameworkEvent;
 import org.osgi.framework.FrameworkListener;
 import org.osgi.framework.wiring.FrameworkWiring;
@@ -135,7 +136,18 @@ public class LoadTest implements Action {
                                         }
                                         Thread.sleep(rand.nextInt(delay));
                                     } catch (Exception e) {
-                                        e.printStackTrace();
+                                        boolean ignore = false;
+                                        if (e instanceof BundleException && e.getMessage()
!= null) {
+                                            String msg = e.getMessage();
+                                            if ("Cannot acquire global lock to update the
bundle.".equals(msg) ||
+                                                    "Unable to acquire global lock for resolve.".equals(msg)
||
+                                                    msg.matches("Bundle .* cannot be update,
since it is either starting or stopping.")) {
+                                                ignore = true;
+                                            }
+                                        }
+                                        if (!ignore) {
+                                            e.printStackTrace();
+                                        }
                                     } finally {
                                         locks[b].set(false);
                                     }


Mime
View raw message