brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [09/12] git commit: Adds IllegalStateExceptionSupplier.EMPTY_EXCEPTION
Date Thu, 25 Sep 2014 22:49:33 GMT
Adds IllegalStateExceptionSupplier.EMPTY_EXCEPTION

- don’t create a new instance every time a Maybe.absent is constructed


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

Branch: refs/heads/master
Commit: 435734cf3064777622c7520493458f0160c59f82
Parents: 159745b
Author: Aled Sage <aled.sage@gmail.com>
Authored: Fri Sep 5 11:45:38 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Mon Sep 8 10:00:54 2014 +0100

----------------------------------------------------------------------
 .../java/brooklyn/util/guava/IllegalStateExceptionSupplier.java    | 2 ++
 utils/common/src/main/java/brooklyn/util/guava/Maybe.java          | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/435734cf/utils/common/src/main/java/brooklyn/util/guava/IllegalStateExceptionSupplier.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/guava/IllegalStateExceptionSupplier.java
b/utils/common/src/main/java/brooklyn/util/guava/IllegalStateExceptionSupplier.java
index 4fc8546..14ee639 100644
--- a/utils/common/src/main/java/brooklyn/util/guava/IllegalStateExceptionSupplier.java
+++ b/utils/common/src/main/java/brooklyn/util/guava/IllegalStateExceptionSupplier.java
@@ -22,6 +22,8 @@ import com.google.common.base.Supplier;
 
 public class IllegalStateExceptionSupplier implements Supplier<RuntimeException> {
 
+    public static final IllegalStateExceptionSupplier EMPTY_EXCEPTION = new IllegalStateExceptionSupplier();
+    
     protected final String message;
     protected final Throwable cause;
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/435734cf/utils/common/src/main/java/brooklyn/util/guava/Maybe.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/guava/Maybe.java b/utils/common/src/main/java/brooklyn/util/guava/Maybe.java
index fb60bf8..05bf2bd 100644
--- a/utils/common/src/main/java/brooklyn/util/guava/Maybe.java
+++ b/utils/common/src/main/java/brooklyn/util/guava/Maybe.java
@@ -153,7 +153,7 @@ public abstract class Maybe<T> implements Serializable, Supplier<T>
{
         private static final long serialVersionUID = -757170462010887057L;
         private final Supplier<RuntimeException> exception;
         public Absent() {
-            this(new IllegalStateExceptionSupplier());
+            this(IllegalStateExceptionSupplier.EMPTY_EXCEPTION);
         }
         public Absent(Supplier<RuntimeException> exception) {
             this.exception = exception;


Mime
View raw message