@@ -65,9 +65,9 @@ public class DorisSinkWriter
65
65
private final int intervalTime ;
66
66
private final DorisSerializer serializer ;
67
67
private final CatalogTable catalogTable ;
68
- private final transient ScheduledExecutorService scheduledExecutorService ;
69
- private transient Thread executorThread ;
70
- private transient volatile Exception loadException = null ;
68
+ private final ScheduledExecutorService scheduledExecutorService ;
69
+ private Thread executorThread ;
70
+ private volatile Exception loadException = null ;
71
71
72
72
public DorisSinkWriter (
73
73
SinkWriter .Context context ,
@@ -114,8 +114,6 @@ private void initializeLoad() {
114
114
} catch (Exception e ) {
115
115
throw new DorisConnectorException (DorisConnectorErrorCode .STREAM_LOAD_FAILED , e );
116
116
}
117
- // get main work thread.
118
- executorThread = Thread .currentThread ();
119
117
startLoad (labelGenerator .generateLabel (lastCheckpointId + 1 ));
120
118
// when uploading data in streaming mode, we need to regularly detect whether there are
121
119
// exceptions.
@@ -125,7 +123,7 @@ private void initializeLoad() {
125
123
126
124
@ Override
127
125
public void write (SeaTunnelRow element ) throws IOException {
128
- checkLoadException ();
126
+ checkLoadExceptionAndResetThread ();
129
127
byte [] serialize =
130
128
serializer .serialize (
131
129
dorisConfig .isNeedsUnsupportedTypeCasting ()
@@ -222,9 +220,11 @@ private void checkDone() {
222
220
}
223
221
}
224
222
225
- private void checkLoadException () {
223
+ private void checkLoadExceptionAndResetThread () {
226
224
if (loadException != null ) {
227
225
throw new RuntimeException ("error while loading data." , loadException );
226
+ } else {
227
+ executorThread = Thread .currentThread ();
228
228
}
229
229
}
230
230
0 commit comments