You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2013/07/24 21:25:41 UTC

[4/4] git commit: Fixed JenkinsScheduler to not crash when the Mesos native library is not bundled with the plugin.

Fixed JenkinsScheduler to not crash when the Mesos
native library is not bundled with the plugin.

Review: https://reviews.apache.org/r/12884


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/869beade
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/869beade
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/869beade

Branch: refs/heads/master
Commit: 869beade1a771312d12d69a8b37c0c8609c6a2e5
Parents: 2996a80
Author: Vinod Kone <vi...@twitter.com>
Authored: Tue Jul 23 15:45:38 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Wed Jul 24 12:25:11 2013 -0700

----------------------------------------------------------------------
 .../org/jenkinsci/plugins/mesos/JenkinsScheduler.java     | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/869beade/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
----------------------------------------------------------------------
diff --git a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
index ce33d57..a68e1ea 100644
--- a/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
+++ b/jenkins/src/main/java/org/jenkinsci/plugins/mesos/JenkinsScheduler.java
@@ -76,7 +76,15 @@ public class JenkinsScheduler implements Scheduler {
       MESOS_NATIVE_LIBRARY = resourceURL.getPath() + "libmesos.dylib";
     }
 
-    MesosNativeLibrary.load(MESOS_NATIVE_LIBRARY);
+    // First, we attempt to load the library from the plugin directory.
+    // If unsuccessful, we attempt to load using 'MesosNativeLibrary.load()'.
+    try {
+      MesosNativeLibrary.load(MESOS_NATIVE_LIBRARY);
+    } catch (UnsatisfiedLinkError error) {
+      LOGGER.warning("Failed to load native Mesos library from '" + MESOS_NATIVE_LIBRARY +
+                     "': " + error.getMessage());
+      MesosNativeLibrary.load();
+    }
 
     // Start the framework.
     new Thread(new Runnable() {