commit | 49fff75f7d199423d8e97bae6d744722ff47edb1 | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Tue Feb 09 15:29:09 2016 -0800 |
committer | Gerrit Code Review <gerrit@onlab.us> | Wed Feb 10 03:00:17 2016 +0000 |
tree | 8855b7231eadcedf56365917d3e7a0b1f945c173 | |
parent | 9c02f3af023be5a2cb1458773db61d0220ea84d3 [diff] |
Avoid creating an instance when calling resource() Change-Id: I0d831cc51199bce0e0dc2b7bb1b5bc2df9fbf90b
diff --git a/core/api/src/main/java/org/onosproject/net/newresource/DiscreteFactory.java b/core/api/src/main/java/org/onosproject/net/newresource/DiscreteFactory.java index b285641..a26c7d5 100644 --- a/core/api/src/main/java/org/onosproject/net/newresource/DiscreteFactory.java +++ b/core/api/src/main/java/org/onosproject/net/newresource/DiscreteFactory.java
@@ -23,6 +23,7 @@ @Beta public final class DiscreteFactory { private final DiscreteResourceId id; + private final DiscreteResource resource; /** * Create an instance with the specified resource ID. @@ -32,6 +33,7 @@ */ DiscreteFactory(DiscreteResourceId id) { this.id = id; + this.resource = new DiscreteResource(id); } /** @@ -49,6 +51,6 @@ * @return discrete-type resource */ public DiscreteResource resource() { - return new DiscreteResource(id); + return resource; } }