]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/MessageSendEventsProvider.java
Fix race in tests
[ldk-java] / src / main / java / org / ldk / structs / MessageSendEventsProvider.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class MessageSendEventsProvider extends CommonBase {
10         final bindings.LDKMessageSendEventsProvider bindings_instance;
11         MessageSendEventsProvider(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
12         private MessageSendEventsProvider(bindings.LDKMessageSendEventsProvider arg) {
13                 super(bindings.LDKMessageSendEventsProvider_new(arg));
14                 this.ptrs_to.add(arg);
15                 this.bindings_instance = arg;
16         }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 if (ptr != 0) { bindings.MessageSendEventsProvider_free(ptr); } super.finalize();
20         }
21
22         public static interface MessageSendEventsProviderInterface {
23                 MessageSendEvent[] get_and_clear_pending_msg_events();
24         }
25         private static class LDKMessageSendEventsProviderHolder { MessageSendEventsProvider held; }
26         public static MessageSendEventsProvider new_impl(MessageSendEventsProviderInterface arg) {
27                 final LDKMessageSendEventsProviderHolder impl_holder = new LDKMessageSendEventsProviderHolder();
28                 impl_holder.held = new MessageSendEventsProvider(new bindings.LDKMessageSendEventsProvider() {
29                         @Override public long[] get_and_clear_pending_msg_events() {
30                                 MessageSendEvent[] ret = arg.get_and_clear_pending_msg_events();
31                                 long[] result = Arrays.stream(ret).mapToLong(arr_conv_18 -> arr_conv_18.ptr).toArray();
32                                 /* TODO 2 MessageSendEvent  */;
33                                 return result;
34                         }
35                 });
36                 return impl_holder.held;
37         }
38         public MessageSendEvent[] get_and_clear_pending_msg_events() {
39                 long[] ret = bindings.MessageSendEventsProvider_get_and_clear_pending_msg_events(this.ptr);
40                 MessageSendEvent[] arr_conv_18_arr = new MessageSendEvent[ret.length];
41                 for (int s = 0; s < ret.length; s++) {
42                         long arr_conv_18 = ret[s];
43                         MessageSendEvent arr_conv_18_hu_conv = MessageSendEvent.constr_from_ptr(arr_conv_18);
44                         arr_conv_18_hu_conv.ptrs_to.add(this);
45                         arr_conv_18_arr[s] = arr_conv_18_hu_conv;
46                 }
47                 return arr_conv_18_arr;
48         }
49
50 }