Commit 62cf7a72 authored by amir.yosef's avatar amir.yosef

Merge remote-tracking branch 'origin/master'

parents cddb4a54 f2cfa68b
...@@ -10,7 +10,7 @@ import java.util.concurrent.Executors; ...@@ -10,7 +10,7 @@ import java.util.concurrent.Executors;
public class Main { public class Main {
public static ExecutorService executor; public static ExecutorService executor;
public static void main(String[] args) { public static void main(String[] args) {
executor = Executors.newFixedThreadPool(2); executor = Executors.newFixedThreadPool(2);
Director director = new Director(); Director director = new Director();
ServerBuilder builder = new ServerBuilder(args); ServerBuilder builder = new ServerBuilder(args);
......
...@@ -47,10 +47,10 @@ public class SendToReplica implements Closeable { ...@@ -47,10 +47,10 @@ public class SendToReplica implements Closeable {
byte[] commandBytes = command.getBytes(); byte[] commandBytes = command.getBytes();
connectedReplicas.forEach(replica -> { connectedReplicas.forEach(replica -> {
try { try {
try (OutputStream outputStream = replica.os()) { OutputStream outputStream = replica.os();
outputStream.write(commandBytes); outputStream.write(commandBytes);
outputStream.flush(); outputStream.flush();
}
} catch (IOException e) { } catch (IOException e) {
logger.log(Level.SEVERE, "Failed to send command to replica ", e); logger.log(Level.SEVERE, "Failed to send command to replica ", e);
} }
...@@ -67,7 +67,6 @@ public class SendToReplica implements Closeable { ...@@ -67,7 +67,6 @@ public class SendToReplica implements Closeable {
} }
public void addConnection(OutputStream outputStream) { public void addConnection(OutputStream outputStream) {
connectedReplicas.add(new ConnectedReplica(outputStream)); connectedReplicas.add(new ConnectedReplica(outputStream));
logger.info("SIZE CONNECTED REPLICAS = " + connectedReplicas.size()); logger.info("SIZE CONNECTED REPLICAS = " + connectedReplicas.size());
......
...@@ -8,7 +8,7 @@ import java.util.Map; ...@@ -8,7 +8,7 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
public class ServerBuilder { public class ServerBuilder {
private int port = 16380; private int port = 16379;
private String role; private String role;
private final String[] masterPortAndHost; private final String[] masterPortAndHost;
private final static ServerInfo info = ServerInfo.getInstance(); private final static ServerInfo info = ServerInfo.getInstance();
......
...@@ -51,7 +51,7 @@ public class RdbFileInfo { ...@@ -51,7 +51,7 @@ public class RdbFileInfo {
} }
public void setFile(Map<String, String> parameters) { public void setFile(Map<String, String> parameters) {
String path = "C:\\Users\\Amir\\Desktop\\Projects\\Redis\\tmp"; String path = "C:\\Users\\Amir\\Desktop\\Games\\Redis\\tmp\\";
String fileName = "rdb.rdb"; String fileName = "rdb.rdb";
out.println(parameters); out.println(parameters);
if (parameters.containsKey("--dir")) { if (parameters.containsKey("--dir")) {
......
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