@@ -337,7 +337,7 @@ public MultithreadedTableWriter(String hostName, int port, String userId, String
337
337
int threadCount , String partitionCol ,
338
338
int [] compressTypes , Mode mode , String [] pModeOption ) throws Exception {
339
339
init (hostName ,port ,userId , password ,dbName , tableName , useSSL ,enableHighAvailability ,highAvailabilitySites ,
340
- batchSize , throttle ,threadCount ,partitionCol ,compressTypes , mode , pModeOption , null , false );
340
+ batchSize , throttle ,threadCount ,partitionCol ,compressTypes , mode , pModeOption , null , false , false , - 1 );
341
341
}
342
342
public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
343
343
String dbName , String tableName , boolean useSSL ,
@@ -346,15 +346,15 @@ public MultithreadedTableWriter(String hostName, int port, String userId, String
346
346
int threadCount , String partitionCol ,
347
347
int [] compressTypes ) throws Exception {
348
348
init (hostName ,port ,userId , password ,dbName , tableName , useSSL ,enableHighAvailability ,highAvailabilitySites ,
349
- batchSize , throttle ,threadCount ,partitionCol ,compressTypes , Mode .M_Append , null , null , false );
349
+ batchSize , throttle ,threadCount ,partitionCol ,compressTypes , Mode .M_Append , null , null , false , false , - 1 );
350
350
}
351
351
public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
352
352
String dbName , String tableName , boolean useSSL ,
353
353
boolean enableHighAvailability , String [] highAvailabilitySites ,
354
354
int batchSize , float throttle ,
355
355
int threadCount , String partitionCol ) throws Exception {
356
356
init (hostName ,port ,userId , password ,dbName , tableName , useSSL ,enableHighAvailability ,highAvailabilitySites ,
357
- batchSize , throttle ,threadCount ,partitionCol ,null , Mode .M_Append , null , null , false );
357
+ batchSize , throttle ,threadCount ,partitionCol ,null , Mode .M_Append , null , null , false , false , - 1 );
358
358
}
359
359
public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
360
360
String dbName , String tableName , boolean useSSL ,
@@ -363,7 +363,7 @@ public MultithreadedTableWriter(String hostName, int port, String userId, String
363
363
int threadCount , String partitionCol ,
364
364
int [] compressTypes , Callback callbackHandler ) throws Exception {
365
365
init (hostName ,port ,userId , password ,dbName , tableName , useSSL ,enableHighAvailability ,highAvailabilitySites ,
366
- batchSize , throttle ,threadCount ,partitionCol ,compressTypes , Mode .M_Append , null , callbackHandler , false );
366
+ batchSize , throttle ,threadCount ,partitionCol ,compressTypes , Mode .M_Append , null , callbackHandler , false , false , - 1 );
367
367
}
368
368
369
369
public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
@@ -374,7 +374,7 @@ public MultithreadedTableWriter(String hostName, int port, String userId, String
374
374
int [] compressTypes , Mode mode , String [] pModeOption ,
375
375
boolean enableActualSendTime ) throws Exception {
376
376
init (hostName , port , userId , password , dbName , tableName , useSSL , enableHighAvailability , highAvailabilitySites ,
377
- batchSize , throttle , threadCount , partitionCol , compressTypes , mode , pModeOption , null , enableActualSendTime );
377
+ batchSize , throttle , threadCount , partitionCol , compressTypes , mode , pModeOption , null , enableActualSendTime , false , - 1 );
378
378
}
379
379
380
380
public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
@@ -385,7 +385,7 @@ public MultithreadedTableWriter(String hostName, int port, String userId, String
385
385
int [] compressTypes ,
386
386
boolean enableActualSendTime ) throws Exception {
387
387
init (hostName , port , userId , password , dbName , tableName , useSSL , enableHighAvailability , highAvailabilitySites ,
388
- batchSize , throttle , threadCount , partitionCol , compressTypes , Mode .M_Append , null , null , enableActualSendTime );
388
+ batchSize , throttle , threadCount , partitionCol , compressTypes , Mode .M_Append , null , null , enableActualSendTime , false , - 1 );
389
389
}
390
390
391
391
public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
@@ -395,7 +395,7 @@ public MultithreadedTableWriter(String hostName, int port, String userId, String
395
395
int threadCount , String partitionCol ,
396
396
boolean enableActualSendTime ) throws Exception {
397
397
init (hostName , port , userId , password , dbName , tableName , useSSL , enableHighAvailability , highAvailabilitySites ,
398
- batchSize , throttle , threadCount , partitionCol , null , Mode .M_Append , null , null , enableActualSendTime );
398
+ batchSize , throttle , threadCount , partitionCol , null , Mode .M_Append , null , null , enableActualSendTime , false , - 1 );
399
399
}
400
400
401
401
public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
@@ -406,7 +406,50 @@ public MultithreadedTableWriter(String hostName, int port, String userId, String
406
406
int [] compressTypes , Callback callbackHandler ,
407
407
boolean enableActualSendTime ) throws Exception {
408
408
init (hostName , port , userId , password , dbName , tableName , useSSL , enableHighAvailability , highAvailabilitySites ,
409
- batchSize , throttle , threadCount , partitionCol , compressTypes , Mode .M_Append , null , callbackHandler , enableActualSendTime );
409
+ batchSize , throttle , threadCount , partitionCol , compressTypes , Mode .M_Append , null , callbackHandler , enableActualSendTime , false , -1 );
410
+ }
411
+
412
+ public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
413
+ String dbName , String tableName , boolean useSSL ,
414
+ boolean enableHighAvailability , String [] highAvailabilitySites ,
415
+ int batchSize , float throttle ,
416
+ int threadCount , String partitionCol ,
417
+ int [] compressTypes , Mode mode , String [] pModeOption ,
418
+ boolean enableActualSendTime , boolean reconnect , int tryReconnectNums ) throws Exception {
419
+ init (hostName , port , userId , password , dbName , tableName , useSSL , enableHighAvailability , highAvailabilitySites ,
420
+ batchSize , throttle , threadCount , partitionCol , compressTypes , mode , pModeOption , null , enableActualSendTime , reconnect , tryReconnectNums );
421
+ }
422
+
423
+ public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
424
+ String dbName , String tableName , boolean useSSL ,
425
+ boolean enableHighAvailability , String [] highAvailabilitySites ,
426
+ int batchSize , float throttle ,
427
+ int threadCount , String partitionCol ,
428
+ int [] compressTypes ,
429
+ boolean enableActualSendTime , boolean reconnect , int tryReconnectNums ) throws Exception {
430
+ init (hostName , port , userId , password , dbName , tableName , useSSL , enableHighAvailability , highAvailabilitySites ,
431
+ batchSize , throttle , threadCount , partitionCol , compressTypes , Mode .M_Append , null , null , enableActualSendTime , reconnect , tryReconnectNums );
432
+ }
433
+
434
+ public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
435
+ String dbName , String tableName , boolean useSSL ,
436
+ boolean enableHighAvailability , String [] highAvailabilitySites ,
437
+ int batchSize , float throttle ,
438
+ int threadCount , String partitionCol ,
439
+ boolean enableActualSendTime , boolean reconnect , int tryReconnectNums ) throws Exception {
440
+ init (hostName , port , userId , password , dbName , tableName , useSSL , enableHighAvailability , highAvailabilitySites ,
441
+ batchSize , throttle , threadCount , partitionCol , null , Mode .M_Append , null , null , enableActualSendTime , reconnect , tryReconnectNums );
442
+ }
443
+
444
+ public MultithreadedTableWriter (String hostName , int port , String userId , String password ,
445
+ String dbName , String tableName , boolean useSSL ,
446
+ boolean enableHighAvailability , String [] highAvailabilitySites ,
447
+ int batchSize , float throttle ,
448
+ int threadCount , String partitionCol ,
449
+ int [] compressTypes , Callback callbackHandler ,
450
+ boolean enableActualSendTime , boolean reconnect , int tryReconnectNums ) throws Exception {
451
+ init (hostName , port , userId , password , dbName , tableName , useSSL , enableHighAvailability , highAvailabilitySites ,
452
+ batchSize , throttle , threadCount , partitionCol , compressTypes , Mode .M_Append , null , callbackHandler , enableActualSendTime , reconnect , tryReconnectNums );
410
453
}
411
454
412
455
private void init (String hostName , int port , String userId , String password ,
@@ -415,7 +458,7 @@ private void init(String hostName, int port, String userId, String password,
415
458
int batchSize , float throttle ,
416
459
int threadCount , String partitionCol ,
417
460
int [] compressTypes , Mode mode , String [] pModeOption , Callback callbackHandler ,
418
- boolean enableActualSendTime ) throws Exception {
461
+ boolean enableActualSendTime , boolean reconnect , int tryReconnectNums ) throws Exception {
419
462
dbName_ =dbName ;
420
463
tableName_ =tableName ;
421
464
batchSize_ =batchSize ;
@@ -450,7 +493,7 @@ private void init(String hostName, int port, String userId, String password,
450
493
compressTypes_ =new int [compressTypes .length ];
451
494
System .arraycopy (compressTypes ,0 ,compressTypes_ ,0 ,compressTypes .length );
452
495
}
453
- DBConnection pConn = newConn (hostName ,port ,userId ,password ,dbName ,tableName ,useSSL ,enableHighAvailability ,highAvailabilitySites ,isCompress );
496
+ DBConnection pConn = newConn (hostName ,port ,userId ,password ,dbName ,tableName ,useSSL ,enableHighAvailability ,highAvailabilitySites ,isCompress , reconnect , tryReconnectNums );
454
497
if (pConn ==null ){
455
498
throw new RuntimeException ("Failed to connect to server " + hostName + ":" + port );
456
499
}
@@ -575,7 +618,7 @@ private void init(String hostName, int port, String userId, String password,
575
618
// init done, start thread now.
576
619
for (int i = 0 ; i < threadCount ; i ++){
577
620
if (pConn == null ) {
578
- pConn = newConn (hostName ,port ,userId ,password ,dbName ,tableName ,useSSL ,enableHighAvailability ,highAvailabilitySites ,isCompress );
621
+ pConn = newConn (hostName ,port ,userId ,password ,dbName ,tableName ,useSSL ,enableHighAvailability ,highAvailabilitySites ,isCompress , reconnect , tryReconnectNums );
579
622
}
580
623
WriterThread writerThread = new WriterThread (this ,pConn , callbackHandler );
581
624
threads_ .add (writerThread );
@@ -863,10 +906,10 @@ private List<Vector> createListVector(){
863
906
private boolean isExiting () { return hasError_ || isExiting_ ; }
864
907
private DBConnection newConn (String hostName , int port , String userId , String password ,
865
908
String dbName , String tableName , boolean useSSL ,
866
- boolean enableHighAvailability , String [] highAvailabilitySites ,boolean compress ) throws IOException {
909
+ boolean enableHighAvailability , String [] highAvailabilitySites ,boolean compress , boolean reconnect , int tryReconnectNums ) throws IOException {
867
910
DBConnection pConn = new DBConnection (false ,useSSL ,compress );
868
911
//String hostName, int port, String userId, String password, String initialScript, boolean enableHighAvailability, String[] highAvailabilitySites
869
- boolean ret = pConn .connect (hostName , port , userId , password , null ,enableHighAvailability ,highAvailabilitySites );
912
+ boolean ret = pConn .connect (hostName , port , userId , password , null ,enableHighAvailability ,highAvailabilitySites , reconnect , tryReconnectNums );
870
913
if (!ret )
871
914
return null ;
872
915
return pConn ;
0 commit comments