changeset 835:32c92e015459

SocketReporterClient improvements
author Devel 2
date Mon, 22 Jan 2018 10:45:01 +0100
parents 3606eff602c0
children 5b0a48631dd6
files stress-tester-reporter/src/main/java/com/passus/st/reporter/trx/SocketReporterClient.java
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester-reporter/src/main/java/com/passus/st/reporter/trx/SocketReporterClient.java	Mon Jan 22 10:13:38 2018 +0100
+++ b/stress-tester-reporter/src/main/java/com/passus/st/reporter/trx/SocketReporterClient.java	Mon Jan 22 10:45:01 2018 +0100
@@ -5,22 +5,37 @@
 import com.passus.st.reporter.ReporterClient;
 import com.passus.st.reporter.protocol.MetricRecord;
 import com.passus.st.reporter.protocol.MetricsCollectionRecord;
+
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
+
 import org.apache.avro.AvroRemoteException;
 
 /**
- *
  * @author mikolaj.podbielski
  */
 public class SocketReporterClient extends ReporterClient {
 
+    public static final String DEFAULT_HOST = "localhost";
+
+    public static final int DEFAULT_PORT = 11111;
+
+    public static final int DEFAULT_THREADS = 2;
+
     private final SenderThread[] senders;
 
+    public SocketReporterClient() {
+        this(DEFAULT_HOST, DEFAULT_PORT, DEFAULT_THREADS);
+    }
+
+    public SocketReporterClient(String host, int port, int threads) {
+        this(new InetSocketAddress(host, port), threads);
+    }
+
     public SocketReporterClient(InetSocketAddress serverAddress, int threads) {
         this(serverAddress, threads, new ArrayBlockingQueue<>(4096), true);
     }