From 894b300ad0a373a2ae95485007af4f4b0ad40dbf Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 20 Feb 2005 00:06:25 +0000 Subject: [PATCH] synchronize close methods that are invoked by the finalize method --- bindings/java/src/net/hyperic/sigar/win32/Pdh.java | 2 +- bindings/java/src/net/hyperic/sigar/win32/RegistryKey.java | 2 +- bindings/java/src/net/hyperic/sigar/win32/Service.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/win32/Pdh.java b/bindings/java/src/net/hyperic/sigar/win32/Pdh.java index a92584ea..13aae5b0 100644 --- a/bindings/java/src/net/hyperic/sigar/win32/Pdh.java +++ b/bindings/java/src/net/hyperic/sigar/win32/Pdh.java @@ -28,7 +28,7 @@ public class Pdh extends Win32Bindings { } } - public void close() throws Win32Exception { + public synchronized void close() throws Win32Exception { if (h_counter != -1l) { pdhRemoveCounter(h_counter); h_counter = -1l; diff --git a/bindings/java/src/net/hyperic/sigar/win32/RegistryKey.java b/bindings/java/src/net/hyperic/sigar/win32/RegistryKey.java index 35fda300..0076edce 100644 --- a/bindings/java/src/net/hyperic/sigar/win32/RegistryKey.java +++ b/bindings/java/src/net/hyperic/sigar/win32/RegistryKey.java @@ -41,7 +41,7 @@ public class RegistryKey extends Win32Bindings this.m_hkey = hkey; } - public void close() + public synchronized void close() { if (this.m_hkey != 0) { RegCloseKey(this.m_hkey); diff --git a/bindings/java/src/net/hyperic/sigar/win32/Service.java b/bindings/java/src/net/hyperic/sigar/win32/Service.java index e4b0fcd0..2a3e1229 100644 --- a/bindings/java/src/net/hyperic/sigar/win32/Service.java +++ b/bindings/java/src/net/hyperic/sigar/win32/Service.java @@ -125,7 +125,7 @@ public class Service extends Win32Bindings implements java.io.Serializable this.close(); } - public void close() + public synchronized void close() { if(this.m_hService != 0) { CloseServiceHandle(this.m_hService);