[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / SocketDescriptor.java
index 0c76a24546ffb6c098de565092adbb364f1d3137..de4ccb0ae4cb9748ec7415b0e38ed9e5910c77c2 100644 (file)
@@ -34,7 +34,19 @@ public class SocketDescriptor extends CommonBase {
        protected void finalize() throws Throwable {
                if (ptr != 0) { bindings.SocketDescriptor_free(ptr); } super.finalize();
        }
-
+       /**
+        * Destroys the object, freeing associated resources. After this call, any access
+        * to this object may result in a SEGFAULT or worse.
+        *
+        * You should generally NEVER call this method. You should let the garbage collector
+        * do this for you when it finalizes objects. However, it may be useful for types
+        * which represent locks and should be closed immediately to avoid holding locks
+        * until the GC runs.
+        */
+       public void destroy() {
+               if (ptr != 0) { bindings.SocketDescriptor_free(ptr); }
+               ptr = 0;
+       }
        public static interface SocketDescriptorInterface {
                /**
                 * Attempts to send some data from the given slice to the peer.