Commit eb57815b authored by amir.yosef's avatar amir.yosef

Adding Director

parent 5c89bdef
import builder.Director;
import builder.ServerBuilder;
import server.Server; import server.Server;
import java.io.IOException;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
try { Director director = new Director();
Server.getInstance().start(); ServerBuilder builder = new ServerBuilder();
} catch (IOException e) { director.buildMaster(builder);
System.err.println("Server failed to start: " + e.getMessage()); builder.port(16379);
} Server server = builder.build();
server.start();
} }
} }
\ No newline at end of file
package builder;
public class Director {
public void buildMaster(ServerBuilder builder) {
builder.role("Master");
}
public void buildReplica(ServerBuilder builder) {
builder.role("Replica");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment