File tree 2 files changed +8
-4
lines changed
connector/src/source/cdc/source
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ use risingwave_common::bail;
23
23
use risingwave_common:: metrics:: GLOBAL_ERROR_METRICS ;
24
24
use risingwave_common:: util:: addr:: HostAddr ;
25
25
use risingwave_jni_core:: jvm_runtime:: { execute_with_jni_env, JVM } ;
26
- use risingwave_jni_core:: { call_static_method, JniReceiverType } ;
26
+ use risingwave_jni_core:: { call_static_method, JniReceiverType , OwnedPointer } ;
27
27
use risingwave_pb:: connector_service:: { GetEventStreamRequest , GetEventStreamResponse } ;
28
28
use thiserror_ext:: AsReport ;
29
29
use tokio:: sync:: mpsc;
@@ -130,15 +130,15 @@ impl<T: CdcSourceTypeTrait> SplitReader for CdcSplitReader<T> {
130
130
} ;
131
131
132
132
// `runJniDbzSourceThread` will take ownership of `tx`, and release it later in
133
- // `Java_com_risingwave_java_binding_Binding_cdcSourceSenderClose` with `AutoClosable`.
134
- let tx = Box :: into_raw ( Box :: new ( tx ) ) ;
133
+ // `Java_com_risingwave_java_binding_Binding_cdcSourceSenderClose` via `AutoClosable`.
134
+ let tx: OwnedPointer < _ > = tx . into ( ) ;
135
135
136
136
let result = call_static_method ! (
137
137
env,
138
138
{ com. risingwave. connector. source. core. JniDbzSourceHandler } ,
139
139
{ void runJniDbzSourceThread( byte[ ] getEventStreamRequestBytes, long channelPtr) } ,
140
140
& get_event_stream_request_bytes,
141
- tx
141
+ tx. pointer ( )
142
142
) ;
143
143
144
144
match result {
Original file line number Diff line number Diff line change @@ -151,6 +151,10 @@ impl<T> From<T> for Pointer<'static, T> {
151
151
}
152
152
153
153
impl < ' a , T > Pointer < ' a , T > {
154
+ pub fn pointer ( & self ) -> jlong {
155
+ self . pointer
156
+ }
157
+
154
158
fn as_ref ( & self ) -> & ' a T {
155
159
debug_assert ! ( self . pointer != 0 ) ;
156
160
unsafe { & * ( self . pointer as * const T ) }
You can’t perform that action at this time.
0 commit comments