You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2015/09/21 18:57:38 UTC

[3/4] incubator-brooklyn git commit: Optimize Os.isMicrosoftWindows()

Optimize Os.isMicrosoftWindows()


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/4fde5cdc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/4fde5cdc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/4fde5cdc

Branch: refs/heads/master
Commit: 4fde5cdc194bc5c324456db604aba737a72be33d
Parents: 56e75af
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Thu Sep 17 20:01:32 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Thu Sep 17 20:16:19 2015 +0300

----------------------------------------------------------------------
 .../common/src/main/java/org/apache/brooklyn/util/os/Os.java  | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4fde5cdc/utils/common/src/main/java/org/apache/brooklyn/util/os/Os.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/os/Os.java b/utils/common/src/main/java/org/apache/brooklyn/util/os/Os.java
index 13ba63b..6c4ee56 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/util/os/Os.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/util/os/Os.java
@@ -51,6 +51,7 @@ import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.common.io.ByteStreams;
 import com.google.common.io.Files;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 public class Os {
 
@@ -63,6 +64,8 @@ public class Os {
     
     public static final String LINE_SEPARATOR = System.getProperty("line.separator");
 
+    private static final boolean isMSWin = testForMicrosoftWindows();
+
     /** returns the best tmp dir to use; see {@link TmpDirFinder} for the logic
      * (and the explanation why this is needed!) */
     public static String tmp() {
@@ -514,6 +517,10 @@ public class Os {
     }
 
     public static boolean isMicrosoftWindows() {
+        return isMSWin;
+    }
+
+    private static boolean testForMicrosoftWindows() {
         String os = System.getProperty("os.name").toLowerCase();
         //see org.apache.commons.lang.SystemUtils.IS_WINDOWS
         return os.startsWith("windows");