Skip to content
Snippets Groups Projects
Commit f0101c8f authored by tmp1u19's avatar tmp1u19 :octopus:
Browse files

Modify the classes, add a main function to each of it

parent 6a49dec7
No related branches found
No related tags found
No related merge requests found
public class Client {
// controller port to communicate with
int cport;
// timeout in milliseconds
long timeout;
public Client(int cport, long timeout) {
this.cport = cport;
this.timeout = timeout;
}
}
\ No newline at end of file
...@@ -3,22 +3,6 @@ import java.net.*; ...@@ -3,22 +3,6 @@ import java.net.*;
public class Controller { public class Controller {
// port to listen on
private int cport;
// replication factor => number of Dstores to join
private int R;
// timeout in milliseconds
private long timeout;
// how long to wait to start the next rebalance operation
private long rebalance_period;
public Controller (int cport, int R, long timeout, long rebalance_period) {
this.cport = cport;
this.R = R;
this.timeout = timeout;
this.rebalance_period = rebalance_period;
}
// orchestrates client requests // orchestrates client requests
// maintains an index with the allocation of files to Dstores // maintains an index with the allocation of files to Dstores
// waits for Dstores to join the datastore (rebalance operation) // waits for Dstores to join the datastore (rebalance operation)
...@@ -26,5 +10,15 @@ public class Controller { ...@@ -26,5 +10,15 @@ public class Controller {
public static void main (String[] args) { public static void main (String[] args) {
// port to listen on
final int cport = Integer.parseInt(args[0]);
// replication factor => number of Dstores to join
int R = Integer.parseInt(args[1]);
// timeout in milliseconds
int timeout = Integer.parseInt(args[2]);
// how long to wait to start the next rebalance operation
int rebalance_period = Integer.parseInt(args[3]);
} }
} }
\ No newline at end of file
public class Dstore { public class Dstore {
// port to listen on public static void main (String[] args) {
int port;
// controller's port to talk to
int cport;
// timeout in milliseconds
long timeout;
// where to store the data locally
String file_folder;
public Dstore (int port, int cport, long timeout, String file_folder) { // port to listen on
this.port = port; final int port = Integer.parseInt(args[0]);
this.cport = cport; // controller's port to talk to
this.timeout = timeout; final int cport = Integer.parseInt(args[1]);
this. file_folder = file_folder; // timeout in milliseconds
} int timeout = Integer.parseInt(args[2]);
// where to store the data locally
String file_folder = args[3];
public static void main (String[] args) {
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment