Skip to content

Commit e4a442c

Browse files
committed
Rename field name for bulk requests
1 parent 070704d commit e4a442c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/main/java/jp/dip/ysfactory/heapstats/hsloader/Option.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ public static enum ParserMode{
6565
private int port;
6666

6767
/**
68-
* Default bulk level.
68+
* Default number of bulk requests.
6969
*/
70-
public static final int DEFAULT_BULK_LEVEL = 1000;
70+
public static final int DEFAULT_BULK_REQUESTS = 1000;
7171

7272
/**
7373
* Num of bulk requests.
7474
*/
75-
private int bulkLevel;
75+
private int bulkRequests;
7676

7777
/**
7878
* Default timezone.
@@ -111,7 +111,7 @@ public static void printOptions(){
111111
System.out.println(" --mode <snapshot>: Parser mode. (default: snapshot)");
112112
System.out.println(" --host <hostname>: Hostname of Elasticsearch. (default: localhost)");
113113
System.out.println(" --port <num>: HTTP port of Elasticsearch. (default: 9200)");
114-
System.out.println(" --bulk <num>: Number of bulk requests to Elasticsearch. (default: 10)");
114+
System.out.println(" --bulk <num>: Number of bulk requests to Elasticsearch. (default: 1000)");
115115
System.out.println(" --timezone <zone id>: Timezone of SnapShot. (default: System Default)");
116116
System.out.println(" --timeout <num>: Timeout in seconds (default: 60)");
117117
}
@@ -126,7 +126,7 @@ public Option(String[] args) throws IllegalArgumentException{
126126
parserMode = DEFAULT_PARSER_MODE;
127127
host = DEFAULT_HOST;
128128
port = DEFAULT_PORT;
129-
bulkLevel = DEFAULT_BULK_LEVEL;
129+
bulkRequests = DEFAULT_BULK_REQUESTS;
130130
zoneId = DEFAULT_TIMEZONE;
131131
files = new ArrayList<>();
132132
timeout = DEFAULT_TIMEOUT;
@@ -159,7 +159,7 @@ public Option(String[] args) throws IllegalArgumentException{
159159
break;
160160

161161
case "--bulk":
162-
bulkLevel = Integer.parseInt(itr.next());
162+
bulkRequests = Integer.parseInt(itr.next());
163163
break;
164164

165165
case "--timezone":
@@ -207,11 +207,11 @@ public int getPort() {
207207
}
208208

209209
/**
210-
* Get bulk level.
211-
* @return Bulk level.
210+
* Get number of bulk requests.
211+
* @return Number of bulk requests.
212212
*/
213-
public int getBulkLevel() {
214-
return bulkLevel;
213+
public int getBulkRequests() {
214+
return bulkRequests;
215215
}
216216

217217
/**

src/main/java/jp/dip/ysfactory/heapstats/hsloader/Processor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public String toString() {
103103
*/
104104
public Processor(Option opt){
105105
this.opt = opt;
106-
this.indexDataList = new ArrayList<>(opt.getBulkLevel());
106+
this.indexDataList = new ArrayList<>(opt.getBulkRequests());
107107
this.succeeded = true;
108108

109109
int timeoutVal = opt.getTimeout() * 1000;
@@ -152,7 +152,7 @@ public synchronized void publish(){
152152

153153
public synchronized void pushData(String indexName, String indexType, String jsonData){
154154
indexDataList.add(new IndexData(indexName, indexType, jsonData));
155-
if(indexDataList.size() == opt.getBulkLevel()){
155+
if(indexDataList.size() == opt.getBulkRequests()){
156156
publish();
157157
}
158158
}

0 commit comments

Comments
 (0)