Michael Pasternak has uploaded a new change for review.

Change subject: sdk: implement AutoCloseable
......................................................................

sdk: implement AutoCloseable

close() method is invoked automatically when API proxy is
managed by the try-with-resources statement

Change-Id: I15786f0f1857c54983602de1f312b234de99bca4
Signed-off-by: Michael pasternak <mpast...@redhat.com>
---
M 
ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/templates/ApiTemplate
M ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java
2 files changed, 22 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk-java 
refs/changes/38/18538/1

diff --git 
a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/templates/ApiTemplate
 
b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/templates/ApiTemplate
index b9fb9e2..05ade21 100644
--- 
a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/templates/ApiTemplate
+++ 
b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/templates/ApiTemplate
@@ -21,7 +21,7 @@
 /**
  * oVirt virtualization Java SDK.
  */
-public class Api {
+public class Api implements AutoCloseable {
 
     private volatile HttpProxyBroker proxy = null;
     private volatile API entryPoint = null;
@@ -500,6 +500,16 @@
         proxy.shutdown();
     }
 
+    /**
+     * Closes this resource, relinquishing any underlying resources.
+     * This method is invoked automatically on objects managed by the
+     * try-with-resources statement.
+     */
+    @Override
+    public void close() throws Exception {
+        shutdown();
+    }
+
 $collectionsGetters$
 
 $rootMethods$
diff --git a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java 
b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java
index 587af02..8d0d79c 100644
--- a/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java
+++ b/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/Api.java
@@ -41,7 +41,7 @@
 /**
  * oVirt virtualization Java SDK.
  */
-public class Api {
+public class Api implements AutoCloseable {
 
     private volatile HttpProxyBroker proxy = null;
     private volatile API entryPoint = null;
@@ -540,6 +540,16 @@
     }
 
     /**
+     * Closes this resource, relinquishing any underlying resources.
+     * This method is invoked automatically on objects managed by the
+     * try-with-resources statement.
+     */
+    @Override
+    public void close() throws Exception {
+        shutdown();
+    }
+
+    /**
      * Gets the value of the Tags property.
      *
      * @return


-- 
To view, visit http://gerrit.ovirt.org/18538
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15786f0f1857c54983602de1f312b234de99bca4
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk-java
Gerrit-Branch: master
Gerrit-Owner: Michael Pasternak <mpast...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to