m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/fetcher
diff options
context:
space:
mode:
authorMartin <marcin.j.chrzanowski@gmail.com>2019-11-24 22:09:41 +0100
committerGitHub <noreply@github.com>2019-11-24 22:09:41 +0100
commitac7aa67be63bea11246b5d39d1ff2bd7d16d2a1c (patch)
treed88a506d46f4c9410d0575805bde01528192bb5e /src/main/java/pl/edu/mimuw/cloudatlas/fetcher
parente24fbbecfb9b631d9467b204a1b87c593746886b (diff)
Pass registry address to fetcher (#41)
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/fetcher')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java
index 1d4a2ce..7583c14 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java
@@ -15,6 +15,9 @@ import com.google.gson.Gson;
import pl.edu.mimuw.cloudatlas.model.*;
public class Fetcher {
+ private static String host;
+ private static int port;
+
private static final List<String> fetcherAttributeNames = Arrays.asList(
"avg_load",
"free_disk",
@@ -71,7 +74,7 @@ public class Fetcher {
}
private static void initializeApiStub() throws RemoteException, NotBoundException {
- Registry registry = LocateRegistry.getRegistry("localhost");
+ Registry registry = LocateRegistry.getRegistry(host, port);
api = (Api) registry.lookup("Api");
System.out.println("Fetcher runs with registry");
}
@@ -124,7 +127,23 @@ public class Fetcher {
}
}
+ private static void parseArgs(String[] args) {
+ System.out.println("args length: " + args.length);
+ if (args.length < 2) {
+ port = 1099;
+ } else {
+ port = Integer.parseInt(args[1]);
+ }
+
+ if (args.length < 1) {
+ host = "localhost";
+ } else {
+ host = args[0];
+ }
+ }
+
public static void main(String[] args) {
+ parseArgs(args);
fetchData();
}
}