{"action":"created","comment":{"url":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/32565068","id":32565068,"diff_hunk":"@@ -81,4 +93,119 @@ public synchronized static boolean loadExecutionEngineLibrary(boolean mustSucced\n         }\n         return voltSharedLibraryLoaded;\n     }\n+\n+    /*\n+     * Returns the native library file copied into a readable location, if the library from volt jar\n+     * should be used. Returns null otherwise to default to java.library.path as fall back.\n+     */\n+    private static File getNativeLibraryFile(String libname) {\n+        if (Boolean.parseBoolean(System.getProperty(USE_JAVA_LIBRARY_PATH, \"false\"))) {\n+            return null;\n+        }\n+\n+        // for now, arch is always x86_64\n+        String pathFormat = \"/org/voltdb/native/%s/x86_64\";\n+        String libPath = null;\n+        if (System.getProperty(\"os.name\").toLowerCase().contains(\"mac\")) {\n+            libPath = String.format(pathFormat, \"Mac\");\n+        } else {\n+            libPath = String.format(pathFormat, \"Linux\");\n+        }\n+\n+        String libFileName = System.mapLibraryName(libname);\n+        if (EELibraryLoader.class.getResource(libPath + \"/\" + libFileName) == null) {\n+            // mapLibraryName does not give us the correct name on mac sometimes\n+            if (System.getProperty(\"os.name\").toLowerCase().contains(\"mac\")) {\n+                libFileName = \"lib\" + libname + \".jnilib\";\n+            }\n+            if (EELibraryLoader.class.getResource(libPath + \"/\" + libFileName) == null) {\n+                hostLog.warn(\"Could not find library resource using path: \" + libPath + \"/\" + libFileName +\n+                        \". Falling back to using java.library.path\");\n+                return null;\n+            }\n+        }\n+\n+        File tmpFilePath = new File(System.getProperty(\"java.io.tmpdir\"));\n+        try {\n+            return loadLibraryFile(libPath, libFileName, tmpFilePath.getAbsolutePath());\n+        } catch(IOException e) {\n+            hostLog.error(\"Error loading library file from jar. Falling back to using java.library.path\", e);\n+            return null;\n+        }\n+    }\n+\n+    private static File loadLibraryFile(String libFolder, String libFileName, String tmpFolder) throws IOException {\n+        hostLog.debug(\"Loading library from jar using path=\" + libFolder + \"/\" + libFileName);\n+\n+        // Using UUID as in Snappy, but we probably don't need it?\n+        String uuid = UUID.randomUUID().toString();\n+        String extractedLibFileName = String.format(\"voltdb-%s-%s\", uuid, libFileName);\n+        File extractedLibFile = new File(tmpFolder, extractedLibFileName);\n+\n+        String libPath = libFolder + \"/\" + libFileName;\n+        // Extract a native library file into the target directory\n+        InputStream reader = null;\n+        FileOutputStream writer = null;\n+        try {\n+            reader = EELibraryLoader.class.getResourceAsStream(libPath);\n+            try {\n+                writer = new FileOutputStream(extractedLibFile);\n+\n+                byte[] buffer = new byte[8192];\n+                int bytesRead = 0;\n+                while ((bytesRead = reader.read(buffer)) != -1) {\n+                    writer.write(buffer, 0, bytesRead);\n+                }\n+            }\n+            finally {\n+                if (writer != null) {\n+                    writer.close();\n+                }\n+            }\n+        }\n+        finally {\n+            if (reader != null) {\n+                reader.close();\n+            }\n+\n+            // Delete the extracted lib file on JVM exit.\n+            extractedLibFile.deleteOnExit();\n+        }\n+\n+        // Set executable (x) flag to enable Java to load the native library\n+        boolean success = extractedLibFile.setReadable(true) &&\n+                extractedLibFile.setWritable(true, true) &&\n+                extractedLibFile.setExecutable(true);\n+        if (!success) {\n+            hostLog.warn(\"Could not update extracted lib file \" + extractedLibFile +\n+                    \" to be rwx. Falling back to using java.library.path\");\n+            return null;\n+        }\n+\n+        /* Do we need this check that is in SnappyLoader?","path":"src/frontend/org/voltdb/EELibraryLoader.java","position":125,"original_position":125,"commit_id":"d351c40a8e57e6c16dd69edccd0c9647aa47495c","original_commit_id":"d351c40a8e57e6c16dd69edccd0c9647aa47495c","user":{"login":"akhanzode","id":1675698,"avatar_url":"https://avatars.githubusercontent.com/u/1675698?v=3","gravatar_id":"","url":"https://api.github.com/users/akhanzode","html_url":"https://github.com/akhanzode","followers_url":"https://api.github.com/users/akhanzode/followers","following_url":"https://api.github.com/users/akhanzode/following{/other_user}","gists_url":"https://api.github.com/users/akhanzode/gists{/gist_id}","starred_url":"https://api.github.com/users/akhanzode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akhanzode/subscriptions","organizations_url":"https://api.github.com/users/akhanzode/orgs","repos_url":"https://api.github.com/users/akhanzode/repos","events_url":"https://api.github.com/users/akhanzode/events{/privacy}","received_events_url":"https://api.github.com/users/akhanzode/received_events","type":"User","site_admin":false},"body":"Can you remove this commented code.","created_at":"2015-06-16T20:11:47Z","updated_at":"2015-06-16T20:11:47Z","html_url":"https://github.com/VoltDB/voltdb/pull/2434#discussion_r32565068","pull_request_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/2434","_links":{"self":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/32565068"},"html":{"href":"https://github.com/VoltDB/voltdb/pull/2434#discussion_r32565068"},"pull_request":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/2434"}}},"pull_request":{"url":"https://api.github.com/repos/VoltDB/voltdb/pulls/2434","id":37833640,"html_url":"https://github.com/VoltDB/voltdb/pull/2434","diff_url":"https://github.com/VoltDB/voltdb/pull/2434.diff","patch_url":"https://github.com/VoltDB/voltdb/pull/2434.patch","issue_url":"https://api.github.com/repos/VoltDB/voltdb/issues/2434","number":2434,"state":"open","locked":false,"title":"ENG-8372: Now including lib files also in voltdb jar and EELibraryLoa…","user":{"login":"manjujames","id":12613581,"avatar_url":"https://avatars.githubusercontent.com/u/12613581?v=3","gravatar_id":"","url":"https://api.github.com/users/manjujames","html_url":"https://github.com/manjujames","followers_url":"https://api.github.com/users/manjujames/followers","following_url":"https://api.github.com/users/manjujames/following{/other_user}","gists_url":"https://api.github.com/users/manjujames/gists{/gist_id}","starred_url":"https://api.github.com/users/manjujames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manjujames/subscriptions","organizations_url":"https://api.github.com/users/manjujames/orgs","repos_url":"https://api.github.com/users/manjujames/repos","events_url":"https://api.github.com/users/manjujames/events{/privacy}","received_events_url":"https://api.github.com/users/manjujames/received_events","type":"User","site_admin":false},"body":"…der will\r\n\r\npick it up from the jar. It is still possible to use java.library.path instead using\r\nthe flag \"use.javalib\".","created_at":"2015-06-16T19:46:50Z","updated_at":"2015-06-16T20:11:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c7b37522a2d1f26dc74643a2d95a39e3ae6b0a44","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/2434/commits","review_comments_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/2434/comments","review_comment_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/issues/2434/comments","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/d351c40a8e57e6c16dd69edccd0c9647aa47495c","head":{"label":"VoltDB:ENG-8372","ref":"ENG-8372","sha":"d351c40a8e57e6c16dd69edccd0c9647aa47495c","user":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2445970,"name":"voltdb","full_name":"VoltDB/voltdb","owner":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VoltDB/voltdb","description":"VoltDB","fork":false,"url":"https://api.github.com/repos/VoltDB/voltdb","forks_url":"https://api.github.com/repos/VoltDB/voltdb/forks","keys_url":"https://api.github.com/repos/VoltDB/voltdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VoltDB/voltdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VoltDB/voltdb/teams","hooks_url":"https://api.github.com/repos/VoltDB/voltdb/hooks","issue_events_url":"https://api.github.com/repos/VoltDB/voltdb/issues/events{/number}","events_url":"https://api.github.com/repos/VoltDB/voltdb/events","assignees_url":"https://api.github.com/repos/VoltDB/voltdb/assignees{/user}","branches_url":"https://api.github.com/repos/VoltDB/voltdb/branches{/branch}","tags_url":"https://api.github.com/repos/VoltDB/voltdb/tags","blobs_url":"https://api.github.com/repos/VoltDB/voltdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VoltDB/voltdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VoltDB/voltdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/VoltDB/voltdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/{sha}","languages_url":"https://api.github.com/repos/VoltDB/voltdb/languages","stargazers_url":"https://api.github.com/repos/VoltDB/voltdb/stargazers","contributors_url":"https://api.github.com/repos/VoltDB/voltdb/contributors","subscribers_url":"https://api.github.com/repos/VoltDB/voltdb/subscribers","subscription_url":"https://api.github.com/repos/VoltDB/voltdb/subscription","commits_url":"https://api.github.com/repos/VoltDB/voltdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/VoltDB/voltdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/VoltDB/voltdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/VoltDB/voltdb/contents/{+path}","compare_url":"https://api.github.com/repos/VoltDB/voltdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VoltDB/voltdb/merges","archive_url":"https://api.github.com/repos/VoltDB/voltdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VoltDB/voltdb/downloads","issues_url":"https://api.github.com/repos/VoltDB/voltdb/issues{/number}","pulls_url":"https://api.github.com/repos/VoltDB/voltdb/pulls{/number}","milestones_url":"https://api.github.com/repos/VoltDB/voltdb/milestones{/number}","notifications_url":"https://api.github.com/repos/VoltDB/voltdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VoltDB/voltdb/labels{/name}","releases_url":"https://api.github.com/repos/VoltDB/voltdb/releases{/id}","created_at":"2011-09-23T18:46:12Z","updated_at":"2015-06-16T16:55:23Z","pushed_at":"2015-06-16T20:02:55Z","git_url":"git://github.com/VoltDB/voltdb.git","ssh_url":"git@github.com:VoltDB/voltdb.git","clone_url":"https://github.com/VoltDB/voltdb.git","svn_url":"https://github.com/VoltDB/voltdb","homepage":"http://community.voltdb.com/","size":671174,"stargazers_count":576,"watchers_count":576,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":166,"mirror_url":null,"open_issues_count":28,"forks":166,"open_issues":28,"watchers":576,"default_branch":"master"}},"base":{"label":"VoltDB:master","ref":"master","sha":"ae436ba390c2fff87bba05568f1ba7add75926df","user":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2445970,"name":"voltdb","full_name":"VoltDB/voltdb","owner":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VoltDB/voltdb","description":"VoltDB","fork":false,"url":"https://api.github.com/repos/VoltDB/voltdb","forks_url":"https://api.github.com/repos/VoltDB/voltdb/forks","keys_url":"https://api.github.com/repos/VoltDB/voltdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VoltDB/voltdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VoltDB/voltdb/teams","hooks_url":"https://api.github.com/repos/VoltDB/voltdb/hooks","issue_events_url":"https://api.github.com/repos/VoltDB/voltdb/issues/events{/number}","events_url":"https://api.github.com/repos/VoltDB/voltdb/events","assignees_url":"https://api.github.com/repos/VoltDB/voltdb/assignees{/user}","branches_url":"https://api.github.com/repos/VoltDB/voltdb/branches{/branch}","tags_url":"https://api.github.com/repos/VoltDB/voltdb/tags","blobs_url":"https://api.github.com/repos/VoltDB/voltdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VoltDB/voltdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VoltDB/voltdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/VoltDB/voltdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/{sha}","languages_url":"https://api.github.com/repos/VoltDB/voltdb/languages","stargazers_url":"https://api.github.com/repos/VoltDB/voltdb/stargazers","contributors_url":"https://api.github.com/repos/VoltDB/voltdb/contributors","subscribers_url":"https://api.github.com/repos/VoltDB/voltdb/subscribers","subscription_url":"https://api.github.com/repos/VoltDB/voltdb/subscription","commits_url":"https://api.github.com/repos/VoltDB/voltdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/VoltDB/voltdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/VoltDB/voltdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/VoltDB/voltdb/contents/{+path}","compare_url":"https://api.github.com/repos/VoltDB/voltdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VoltDB/voltdb/merges","archive_url":"https://api.github.com/repos/VoltDB/voltdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VoltDB/voltdb/downloads","issues_url":"https://api.github.com/repos/VoltDB/voltdb/issues{/number}","pulls_url":"https://api.github.com/repos/VoltDB/voltdb/pulls{/number}","milestones_url":"https://api.github.com/repos/VoltDB/voltdb/milestones{/number}","notifications_url":"https://api.github.com/repos/VoltDB/voltdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VoltDB/voltdb/labels{/name}","releases_url":"https://api.github.com/repos/VoltDB/voltdb/releases{/id}","created_at":"2011-09-23T18:46:12Z","updated_at":"2015-06-16T16:55:23Z","pushed_at":"2015-06-16T20:02:55Z","git_url":"git://github.com/VoltDB/voltdb.git","ssh_url":"git@github.com:VoltDB/voltdb.git","clone_url":"https://github.com/VoltDB/voltdb.git","svn_url":"https://github.com/VoltDB/voltdb","homepage":"http://community.voltdb.com/","size":671174,"stargazers_count":576,"watchers_count":576,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":166,"mirror_url":null,"open_issues_count":28,"forks":166,"open_issues":28,"watchers":576,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/2434"},"html":{"href":"https://github.com/VoltDB/voltdb/pull/2434"},"issue":{"href":"https://api.github.com/repos/VoltDB/voltdb/issues/2434"},"comments":{"href":"https://api.github.com/repos/VoltDB/voltdb/issues/2434/comments"},"review_comments":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/2434/comments"},"review_comment":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/2434/commits"},"statuses":{"href":"https://api.github.com/repos/VoltDB/voltdb/statuses/d351c40a8e57e6c16dd69edccd0c9647aa47495c"}}}}