[Java] Update auto-generated bindings to 0.0.115
[ldk-java] / src / main / java / org / ldk / structs / SocketDescriptor.java
index 0c76a24546ffb6c098de565092adbb364f1d3137..cf17dab68c23a529fa25016acace085ffd6b940a 100644 (file)
@@ -12,7 +12,7 @@ import javax.annotation.Nullable;
  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
  * implement Hash to meet the PeerManager API.
  * 
- * For efficiency, Clone should be relatively cheap for this type.
+ * For efficiency, [`Clone`] should be relatively cheap for this type.
  * 
  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
@@ -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.