16
16
import java .util .concurrent .CompletionStage ;
17
17
import java .util .concurrent .atomic .AtomicLong ;
18
18
19
- public class OriginCountJobSession extends BaseJobSession {
20
- public Logger logger = LoggerFactory .getLogger (this .getClass ().getName ());
19
+ public class OriginCountJobSession extends BaseJobSession {
21
20
private static OriginCountJobSession originCountJobSession ;
21
+ public Logger logger = LoggerFactory .getLogger (this .getClass ().getName ());
22
22
protected AtomicLong readCounter = new AtomicLong (0 );
23
23
protected List <Integer > updateSelectMapping = new ArrayList <Integer >();
24
24
protected Boolean checkTableforColSize ;
@@ -28,17 +28,6 @@ public class OriginCountJobSession extends BaseJobSession{
28
28
protected Integer filterColIndex ;
29
29
protected Integer fieldGuardraillimitMB ;
30
30
protected List <MigrateDataType > checkTableforColSizeTypes = new ArrayList <MigrateDataType >();
31
- public static OriginCountJobSession getInstance (CqlSession sourceSession , SparkConf sparkConf ) {
32
- if (originCountJobSession == null ) {
33
- synchronized (OriginCountJobSession .class ) {
34
- if (originCountJobSession == null ) {
35
- originCountJobSession = new OriginCountJobSession (sourceSession , sparkConf );
36
- }
37
- }
38
- }
39
-
40
- return originCountJobSession ;
41
- }
42
31
43
32
protected OriginCountJobSession (CqlSession sourceSession , SparkConf sparkConf ) {
44
33
this .sourceSession = sourceSession ;
@@ -59,8 +48,8 @@ protected OriginCountJobSession(CqlSession sourceSession, SparkConf sparkConf) {
59
48
checkTableforColSizeTypes = getTypes (sparkConf .get ("spark.origin.checkTableforColSize.cols.types" ));
60
49
filterColName = sparkConf .get ("spark.origin.FilterColumn" );
61
50
filterColType = sparkConf .get ("spark.origin.FilterColumnType" );
62
- filterColIndex = Integer .parseInt (sparkConf .get ("spark.origin.FilterColumnIndex" , "0" ));
63
- fieldGuardraillimitMB = Integer .parseInt (sparkConf .get ("spark.fieldGuardraillimitMB" , "0" ));
51
+ filterColIndex = Integer .parseInt (sparkConf .get ("spark.origin.FilterColumnIndex" , "0" ));
52
+ fieldGuardraillimitMB = Integer .parseInt (sparkConf .get ("spark.fieldGuardraillimitMB" , "0" ));
64
53
65
54
String partionKey = sparkConf .get ("spark.query.cols.partitionKey" );
66
55
idColTypes = getTypes (sparkConf .get ("spark.query.cols.id.types" ));
@@ -77,6 +66,18 @@ protected OriginCountJobSession(CqlSession sourceSession, SparkConf sparkConf) {
77
66
78
67
}
79
68
69
+ public static OriginCountJobSession getInstance (CqlSession sourceSession , SparkConf sparkConf ) {
70
+ if (originCountJobSession == null ) {
71
+ synchronized (OriginCountJobSession .class ) {
72
+ if (originCountJobSession == null ) {
73
+ originCountJobSession = new OriginCountJobSession (sourceSession , sparkConf );
74
+ }
75
+ }
76
+ }
77
+
78
+ return originCountJobSession ;
79
+ }
80
+
80
81
public void getData (BigInteger min , BigInteger max ) {
81
82
logger .info ("TreadID: " + Thread .currentThread ().getId () + " Processing min: " + min + " max:" + max );
82
83
int maxAttempts = maxRetries ;
@@ -93,7 +94,7 @@ public void getData(BigInteger min, BigInteger max) {
93
94
for (Row sourceRow : resultSet ) {
94
95
readLimiter .acquire (1 );
95
96
96
- if (checkTableforColSize ) {
97
+ if (checkTableforColSize ) {
97
98
int rowColcnt = GetRowColumnLength (sourceRow , filterColType , filterColIndex );
98
99
String result = "" ;
99
100
if (rowColcnt > fieldGuardraillimitMB * 1048576 ) {
@@ -115,7 +116,7 @@ public void getData(BigInteger min, BigInteger max) {
115
116
readLimiter .acquire (1 );
116
117
writeLimiter .acquire (1 );
117
118
118
- if (checkTableforColSize ) {
119
+ if (checkTableforColSize ) {
119
120
int rowColcnt = GetRowColumnLength (sourceRow , filterColType , filterColIndex );
120
121
String result = "" ;
121
122
if (rowColcnt > fieldGuardraillimitMB * 1048576 ) {
0 commit comments