@@ -27,18 +27,27 @@ public ElasticSearchMetricSender(RestClient cli, String index) {
2727 this .metricList = new LinkedList <String >();
2828 }
2929
30- public int getListSize () {
31- return this .metricList .size ();
32- }
30+ /**
31+ * This method returns the current size of the ElasticSearch documents list
32+ * @return integer representing the size of the ElasticSearch documents list
33+ */
34+ public int getListSize () { return this .metricList .size (); }
3335
34- public void clearList () {
35- this .metricList .clear ();
36- }
36+ /**
37+ * This method clears the ElasticSearch documents list
38+ */
39+ public void clearList () { this .metricList .clear (); }
3740
38- public void addToList (String metric ) {
39- this .metricList .add (metric );
40- }
41+ /**
42+ * This method adds a metric to the list (metricList).
43+ * @param metric String parameter representing a JSON document for ElasticSearch
44+ */
45+ public void addToList (String metric ) { this .metricList .add (metric ); }
4146
47+ /**
48+ * This method creates the ElasticSearch index.
49+ * Throws an exception if index already exists.
50+ */
4251 public void createIndex () {
4352 try {
4453 this .client .performRequest ("PUT" , "/" + this .esIndex );
@@ -47,6 +56,11 @@ public void createIndex() {
4756 }
4857 }
4958
59+ /**
60+ * This method sends the ElasticSearch documents for each document present in the list (metricList).
61+ * All is being sent through the low-level ElasticSearch REST Client.
62+ * @throws IOException
63+ */
5064 public void sendRequest () throws IOException {
5165 String actionMetaData = String .format ("{ \" index\" : { \" _index\" : \" %s\" , \" _type\" : \" %s\" } }%n" , this .esIndex , "SampleResult" );
5266
0 commit comments