Commit 886d3322 authored by mohammad.salama's avatar mohammad.salama

Web and GRPC Working - No Web Client as html

parent e854fc87
...@@ -9,40 +9,20 @@ ...@@ -9,40 +9,20 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="b8bcd35c-99f3-44c8-a866-59f81c3c8bd0" name="Changes" comment=""> <list default="true" id="b8bcd35c-99f3-44c8-a866-59f81c3c8bd0" name="Changes" comment="Working as Strings, no json, problem in coordinator address">
<change afterPath="$PROJECT_DIR$/src/main/java/GRPCConnection/AddressProxy.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/logs/app.log" beforeDir="false" afterPath="$PROJECT_DIR$/logs/app.log" afterDir="false" /> <change beforePath="$PROJECT_DIR$/logs/app.log" beforeDir="false" afterPath="$PROJECT_DIR$/logs/app.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/GRPCConnection/GRPCClient/GRPCClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/GRPCConnection/GRPCClient/GRPCClient.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/GRPCConnection/GRPCClient/GRPCClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/GRPCConnection/GRPCClient/GRPCClient.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/WebSide/WebClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/WebSide/WebClient.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/WebSide/WebServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/WebSide/WebServer.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/WebSide/WebServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/WebSide/WebServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/SearchWebApp/WebClient/Aggregator.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/SearchWebApp/WebClient/Application.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/SearchWebApp/WebClient/WebClient.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/SearchWebApp/WebServer/WebServer.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/generalTesting/test.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/generalTesting/test.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/testTransmitting/MyClass.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/testTransmitting/Receiver.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/testTransmitting/Sender.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/GRPCConnection/GRPCClient/GRPCClient$1.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/GRPCConnection/GRPCClient/GRPCClient.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/GRPCConnection/GRPCClient/GRPCClient.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/target/classes/GRPCConnection/GRPCClient/GRPCClient.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/GRPCConnection/GRPCClient/GRPCClient.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/WebSide/WebClient.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/WebSide/WebClient.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/WebSide/WebServer$1.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/WebSide/WebServer.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/WebSide/WebServer.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/target/classes/WebSide/WebServer.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/WebSide/WebServer.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator$1.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator$1.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/Coordinator.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry$1.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry$1.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/SearchWebApp/WebClient/Aggregator.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/SearchWebApp/WebClient/Application.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/SearchWebApp/WebClient/WebClient.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/SearchWebApp/WebServer/WebServer$1.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/SearchWebApp/WebServer/WebServer.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/generalTesting/test.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/generalTesting/test.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/testTransmitting/MyClass.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/testTransmitting/Receiver.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/org/AutoHealerAndClusterSearch/testTransmitting/Sender.class" beforeDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -192,23 +172,22 @@ ...@@ -192,23 +172,22 @@
</map> </map>
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Working as Strings, no json, problem in coordinator address" />
<option name="LAST_COMMIT_MESSAGE" value="Working as Strings, no json, problem in coordinator address" />
</component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
<breakpoints> <breakpoints>
<line-breakpoint enabled="true" type="java-line"> <line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/WebSide/WebClient.java</url> <url>file://$PROJECT_DIR$/src/main/java/WebSide/WebServer.java</url>
<line>27</line> <line>85</line>
<option name="timeStamp" value="11" /> <option name="timeStamp" value="22" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/WebSide/WebClient.java</url>
<line>32</line>
<option name="timeStamp" value="20" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="java-line"> <line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/org/AutoHealerAndClusterSearch/AutoHealerAndClusterSearch/ServiceRegistry.java</url> <url>file://$PROJECT_DIR$/src/main/java/GRPCConnection/GRPCClient/GRPCClient.java</url>
<line>74</line> <line>37</line>
<option name="timeStamp" value="21" /> <option name="timeStamp" value="24" />
</line-breakpoint> </line-breakpoint>
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
......
...@@ -690,3 +690,166 @@ java.lang.NullPointerException: Cannot invoke "java.util.List.isEmpty()" because ...@@ -690,3 +690,166 @@ java.lang.NullPointerException: Cannot invoke "java.util.List.isEmpty()" because
2024-01-31 22:17:57,032 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:36, 127.0.0.1:68] 2024-01-31 22:17:57,032 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:36, 127.0.0.1:68]
2024-01-31 22:18:21,823 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Coordinator connected: /127.0.0.1 2024-01-31 22:18:21,823 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Coordinator connected: /127.0.0.1
2024-01-31 22:18:21,823 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Coordinator connected: /127.0.0.1 2024-01-31 22:18:21,823 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Coordinator connected: /127.0.0.1
2024-01-31 22:27:41,091 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 22:27:41,110 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000210
2024-01-31 22:27:41,114 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am LEADER
2024-01-31 22:27:41,115 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] The cluster addresses are: []
2024-01-31 22:27:41,118 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to be Coordinator and I am Master !
2024-01-31 22:27:41,615 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Starting Application using Java 17.0.5 on M-Salameh with PID 5484 (D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search\target\classes started by M_Salameh in D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search)
2024-01-31 22:27:41,616 DEBUG org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Running with Spring Boot v2.6.8, Spring v5.3.20
2024-01-31 22:27:41,616 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] No active profile set, falling back to 1 default profile: "default"
2024-01-31 22:27:43,057 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Started Application in 1.797 seconds (JVM running for 6.481)
2024-01-31 22:27:46,101 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 22:27:46,125 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000211
2024-01-31 22:27:46,130 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 22:27:46,138 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 22:27:46,145 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 98
2024-01-31 22:27:46,152 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:98]
2024-01-31 22:27:56,829 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 22:27:56,846 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000212
2024-01-31 22:27:56,849 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 22:27:56,854 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 22:27:56,859 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 888
2024-01-31 22:27:56,865 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:98, 127.0.0.1:888]
2024-01-31 22:34:17,948 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 22:34:17,967 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000213
2024-01-31 22:34:17,970 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am LEADER
2024-01-31 22:34:17,971 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] The cluster addresses are: []
2024-01-31 22:34:17,974 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to be Coordinator and I am Master !
2024-01-31 22:34:18,467 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Starting Application using Java 17.0.5 on M-Salameh with PID 7328 (D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search\target\classes started by M_Salameh in D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search)
2024-01-31 22:34:18,468 DEBUG org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Running with Spring Boot v2.6.8, Spring v5.3.20
2024-01-31 22:34:18,468 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] No active profile set, falling back to 1 default profile: "default"
2024-01-31 22:34:19,855 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Started Application in 1.75 seconds (JVM running for 4.729)
2024-01-31 22:34:28,033 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 22:34:28,049 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000214
2024-01-31 22:34:28,054 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 22:34:28,058 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 22:34:28,064 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 99
2024-01-31 22:34:28,069 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:99]
2024-01-31 22:34:37,795 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 22:34:37,812 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000215
2024-01-31 22:34:37,815 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 22:34:37,820 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 22:34:37,826 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 88
2024-01-31 22:34:37,829 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:99, 127.0.0.1:88]
2024-01-31 22:36:34,692 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 22:36:34,708 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000216
2024-01-31 22:36:34,711 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am LEADER
2024-01-31 22:36:34,713 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] The cluster addresses are: []
2024-01-31 22:36:34,715 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to be Coordinator and I am Master !
2024-01-31 22:36:35,259 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Starting Application using Java 17.0.5 on M-Salameh with PID 4068 (D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search\target\classes started by M_Salameh in D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search)
2024-01-31 22:36:35,259 DEBUG org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Running with Spring Boot v2.6.8, Spring v5.3.20
2024-01-31 22:36:35,260 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] No active profile set, falling back to 1 default profile: "default"
2024-01-31 22:36:36,714 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Started Application in 1.858 seconds (JVM running for 9.928)
2024-01-31 22:36:37,362 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 22:36:37,380 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000217
2024-01-31 22:36:37,383 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 22:36:37,388 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 22:36:37,394 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 66
2024-01-31 22:36:37,400 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:66]
2024-01-31 22:36:39,564 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 22:36:39,587 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000218
2024-01-31 22:36:39,590 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 22:36:39,596 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 22:36:39,601 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 77
2024-01-31 22:36:39,604 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:77, 127.0.0.1:66]
2024-01-31 22:37:39,200 WARN org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Disconnected from Zookeeper
2024-01-31 22:37:39,200 WARN org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Disconnected from Zookeeper
2024-01-31 22:37:39,230 WARN org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Disconnected from Zookeeper
2024-01-31 23:33:20,083 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:33:20,102 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000219
2024-01-31 23:33:20,106 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am LEADER
2024-01-31 23:33:20,109 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] The cluster addresses are: []
2024-01-31 23:33:20,112 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to be Coordinator and I am Master !
2024-01-31 23:33:20,664 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Starting Application using Java 17.0.5 on M-Salameh with PID 16256 (D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search\target\classes started by M_Salameh in D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search)
2024-01-31 23:33:20,664 DEBUG org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Running with Spring Boot v2.6.8, Spring v5.3.20
2024-01-31 23:33:20,665 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] No active profile set, falling back to 1 default profile: "default"
2024-01-31 23:33:22,264 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Started Application in 2.03 seconds (JVM running for 4.687)
2024-01-31 23:33:26,213 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:33:26,232 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000220
2024-01-31 23:33:26,236 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 23:33:26,242 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 23:33:26,248 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 66
2024-01-31 23:33:26,253 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:66]
2024-01-31 23:33:32,170 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:33:32,191 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000221
2024-01-31 23:33:32,195 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 23:33:32,199 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 23:33:32,205 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 77
2024-01-31 23:33:32,209 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:66, 127.0.0.1:77]
2024-01-31 23:45:29,850 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:45:29,866 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000222
2024-01-31 23:45:29,870 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am LEADER
2024-01-31 23:45:29,871 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] The cluster addresses are: []
2024-01-31 23:45:29,874 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to be Coordinator and I am Master !
2024-01-31 23:45:30,381 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Starting Application using Java 17.0.5 on M-Salameh with PID 11012 (D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search\target\classes started by M_Salameh in D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search)
2024-01-31 23:45:30,382 DEBUG org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Running with Spring Boot v2.6.8, Spring v5.3.20
2024-01-31 23:45:30,382 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] No active profile set, falling back to 1 default profile: "default"
2024-01-31 23:45:31,845 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Started Application in 1.837 seconds (JVM running for 4.596)
2024-01-31 23:45:45,747 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:45:45,764 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000223
2024-01-31 23:45:45,768 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 23:45:45,772 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 23:45:45,778 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 66
2024-01-31 23:45:45,784 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:66]
2024-01-31 23:45:48,171 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:45:48,188 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000224
2024-01-31 23:45:48,191 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 23:45:48,196 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 23:45:48,201 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 77
2024-01-31 23:45:48,205 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:66, 127.0.0.1:77]
2024-01-31 23:47:58,488 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:47:58,505 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000225
2024-01-31 23:47:58,508 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am LEADER
2024-01-31 23:47:58,510 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] The cluster addresses are: []
2024-01-31 23:47:58,514 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to be Coordinator and I am Master !
2024-01-31 23:47:59,004 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Starting Application using Java 17.0.5 on M-Salameh with PID 12720 (D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search\target\classes started by M_Salameh in D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search)
2024-01-31 23:47:59,005 DEBUG org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Running with Spring Boot v2.6.8, Spring v5.3.20
2024-01-31 23:47:59,005 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] No active profile set, falling back to 1 default profile: "default"
2024-01-31 23:48:00,449 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Started Application in 1.801 seconds (JVM running for 12.172)
2024-01-31 23:48:01,997 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:48:02,015 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000226
2024-01-31 23:48:02,018 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 23:48:02,023 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 23:48:02,030 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 66
2024-01-31 23:48:02,035 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:66]
2024-01-31 23:48:04,094 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:48:04,113 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000227
2024-01-31 23:48:04,117 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 23:48:04,121 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 23:48:04,126 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 77
2024-01-31 23:48:04,129 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:66, 127.0.0.1:77]
2024-01-31 23:50:52,100 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:50:52,117 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000228
2024-01-31 23:50:52,121 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am LEADER
2024-01-31 23:50:52,123 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] The cluster addresses are: []
2024-01-31 23:50:52,125 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to be Coordinator and I am Master !
2024-01-31 23:50:52,637 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Starting Application using Java 17.0.5 on M-Salameh with PID 6268 (D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search\target\classes started by M_Salameh in D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search)
2024-01-31 23:50:52,638 DEBUG org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Running with Spring Boot v2.6.8, Spring v5.3.20
2024-01-31 23:50:52,638 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] No active profile set, falling back to 1 default profile: "default"
2024-01-31 23:50:54,098 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Started Application in 1.84 seconds (JVM running for 5.731)
2024-01-31 23:50:59,738 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:50:59,756 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000229
2024-01-31 23:50:59,759 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 23:50:59,764 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 23:50:59,770 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 66
2024-01-31 23:50:59,776 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:66]
2024-01-31 23:52:52,375 WARN org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Disconnected from Zookeeper
2024-01-31 23:52:52,389 WARN org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Disconnected from Zookeeper
2024-01-31 23:53:06,843 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:53:06,860 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000230
2024-01-31 23:53:06,864 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am LEADER
2024-01-31 23:53:06,866 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] The cluster addresses are: []
2024-01-31 23:53:06,869 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to be Coordinator and I am Master !
2024-01-31 23:53:07,447 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Starting Application using Java 17.0.5 on M-Salameh with PID 10408 (D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search\target\classes started by M_Salameh in D:\HIAST\FIY\FS\Distributed Systems\Lab\8\Distributed-Search)
2024-01-31 23:53:07,448 DEBUG org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Running with Spring Boot v2.6.8, Spring v5.3.20
2024-01-31 23:53:07,448 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] No active profile set, falling back to 1 default profile: "default"
2024-01-31 23:53:09,048 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main] Started Application in 2.014 seconds (JVM running for 4.884)
2024-01-31 23:53:13,568 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application [main-EventThread] Successfully connected to Zookeeper
2024-01-31 23:53:13,590 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] My Node under Election is/election/c_0000000231
2024-01-31 23:53:13,594 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.LeaderElection [main] I am NOT LEADER
2024-01-31 23:53:13,599 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main] Registered to service registry
2024-01-31 23:53:13,605 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Server started on port 66
2024-01-31 23:53:13,611 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.ServiceRegistry [main-EventThread] The cluster addresses are: [127.0.0.1:66]
2024-02-01 01:30:11,071 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Coordinator connected: /127.0.0.1
2024-02-01 01:31:10,521 INFO org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.TransientWorker [main] Coordinator connected: /127.0.0.1
package GRPCConnection;
import org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Application;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.List;
public class AddressProxy implements Watcher
{
private static final String address = "192.168.184.10:2181";
private static final int SESSION_TIMEOUT = 3000; //dead client
private static final String COORDINATOR_ZNODE_PATH = "/coordinator_node";
private ZooKeeper zooKeeper;
private String IP;
private final Logger logger = LoggerFactory.getLogger(AddressProxy.class);
public static AddressProxy start() throws IOException, InterruptedException {
AddressProxy addressProxy = new AddressProxy();
ZooKeeper zooKeeper = addressProxy.connectToZookeeper();
//addressProxy.run();
//addressProxy.close();
return addressProxy;
}
private synchronized void updateAddress() throws InterruptedException, KeeperException
{
List<String> temp = zooKeeper.getChildren(COORDINATOR_ZNODE_PATH , this);
if (temp.isEmpty()) return;
String node = temp.get(0);
node = COORDINATOR_ZNODE_PATH + "/" + node;
Stat stat = zooKeeper.exists(node , false);
IP = new String(zooKeeper.getData(node , false , stat));
IP = IP.split(":")[0];
}
public String getAddress() throws InterruptedException, KeeperException
{
if (IP==null)
{
updateAddress();
}
return IP;
}
@Override
public void process(WatchedEvent watchedEvent) {
switch (watchedEvent.getType())
{
case NodeChildrenChanged ->
{
try {
updateAddress();
} catch (InterruptedException | KeeperException e)
{
logger.error("Error Updating Coordinator address in Proxy");
throw new RuntimeException(e);
}
}
}
}
public ZooKeeper connectToZookeeper() throws IOException
{
this.zooKeeper = new ZooKeeper(address, SESSION_TIMEOUT, this);
return zooKeeper;
}
public void run() throws InterruptedException {
synchronized (zooKeeper) {
zooKeeper.wait();
}
}
private void close() throws InterruptedException {
this.zooKeeper.close();
}
}
...@@ -2,6 +2,7 @@ package GRPCConnection.GRPCClient; ...@@ -2,6 +2,7 @@ package GRPCConnection.GRPCClient;
import GRPCConnection.AddressProxy;
import io.grpc.ManagedChannel; import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder; import io.grpc.ManagedChannelBuilder;
import org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Coordinator; import org.AutoHealerAndClusterSearch.AutoHealerAndClusterSearch.Coordinator;
...@@ -13,6 +14,7 @@ import org.apache.zookeeper.WatchedEvent; ...@@ -13,6 +14,7 @@ import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher; import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper; import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat; import org.apache.zookeeper.data.Stat;
import org.checkerframework.checker.units.qual.A;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
...@@ -23,14 +25,11 @@ import java.util.List; ...@@ -23,14 +25,11 @@ import java.util.List;
* */ * */
public class GRPCClient public class GRPCClient
{ {
private String COORDINATOR_ADDRESS; public List<String> search(String query , String ip) throws InterruptedException, KeeperException
public List<String> search(String query) throws InterruptedException, KeeperException
{ {
COORDINATOR_ADDRESS = Coordinator.getIP();
ManagedChannel channel = ManagedChannelBuilder. ManagedChannel channel = ManagedChannelBuilder.
forAddress("localhost" , 6565). forAddress(ip, 6565).
usePlaintext().build(); usePlaintext().build();
SearchServiceGrpc.SearchServiceBlockingStub stub = SearchServiceGrpc.newBlockingStub(channel); SearchServiceGrpc.SearchServiceBlockingStub stub = SearchServiceGrpc.newBlockingStub(channel);
......
package WebSide; package WebSide;
import GRPCConnection.AddressProxy;
import GRPCConnection.GRPCClient.GRPCClient; import GRPCConnection.GRPCClient.GRPCClient;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.Headers;
...@@ -10,6 +11,7 @@ import org.apache.zookeeper.KeeperException; ...@@ -10,6 +11,7 @@ import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
...@@ -22,6 +24,7 @@ public class WebServer ...@@ -22,6 +24,7 @@ public class WebServer
{ {
private final String Search_EndPoint = "/search"; private final String Search_EndPoint = "/search";
private GRPCClient grpcClient; private GRPCClient grpcClient;
private AddressProxy addressProxy;
private static final Logger logger = LoggerFactory.getLogger(WebServer.class); private static final Logger logger = LoggerFactory.getLogger(WebServer.class);
private final int port; private final int port;
private HttpServer server; private HttpServer server;
...@@ -30,6 +33,7 @@ public class WebServer ...@@ -30,6 +33,7 @@ public class WebServer
{ {
this.port = port; this.port = port;
grpcClient = new GRPCClient(); grpcClient = new GRPCClient();
addressProxy = AddressProxy.start();
} }
public static void main(String[] args) throws IOException, InterruptedException { public static void main(String[] args) throws IOException, InterruptedException {
int serverPort = 5566; int serverPort = 5566;
...@@ -78,7 +82,8 @@ public class WebServer ...@@ -78,7 +82,8 @@ public class WebServer
List<String> files = new ArrayList<>(); List<String> files = new ArrayList<>();
try try
{ {
files = grpcClient.search(query); String o = addressProxy.getAddress();
files = grpcClient.search(query , o);
} }
catch (InterruptedException | KeeperException e) catch (InterruptedException | KeeperException e)
{ {
......
...@@ -19,7 +19,6 @@ import java.util.stream.Stream; ...@@ -19,7 +19,6 @@ import java.util.stream.Stream;
public class Coordinator public class Coordinator
{ {
private static String ipAdress;
private static String FILES_DIRECTORY = System.getProperty("user.dir") + "/SearchFiles/";; private static String FILES_DIRECTORY = System.getProperty("user.dir") + "/SearchFiles/";;
private static final Logger logger = LoggerFactory.getLogger(Coordinator.class); private static final Logger logger = LoggerFactory.getLogger(Coordinator.class);
...@@ -43,12 +42,6 @@ public class Coordinator ...@@ -43,12 +42,6 @@ public class Coordinator
return answer; return answer;
} }
public static String getIP()
{
ipAdress = ServiceRegistry.getCoordinatorAddress();
return ipAdress;
}
private static SearchQueryResponse sendRequestToNode(SearchQueryRequest searchQueryRequest, String ipAddress) private static SearchQueryResponse sendRequestToNode(SearchQueryRequest searchQueryRequest, String ipAddress)
{ {
SearchQueryResponse searchQueryResponse = null; SearchQueryResponse searchQueryResponse = null;
......
...@@ -19,12 +19,10 @@ public class ServiceRegistry implements Watcher ...@@ -19,12 +19,10 @@ public class ServiceRegistry implements Watcher
private static final String COORDINATOR_ZNODE_PATH = "/coordinator_node"; private static final String COORDINATOR_ZNODE_PATH = "/coordinator_node";
private final Logger logger = LoggerFactory.getLogger(ServiceRegistry.class); private final Logger logger = LoggerFactory.getLogger(ServiceRegistry.class);
private final ZooKeeper zooKeeper; private final ZooKeeper zooKeeper;
private Coordinator coordinator = null;
private TransientWorker transientWorker = null; private TransientWorker transientWorker = null;
private String currentZnode = null; private String currentZnode = null;
private static List<String> allServiceAddresses = null; private static List<String> allServiceAddresses = null;
private static String Coordinator_Address;
public ServiceRegistry(ZooKeeper zooKeeper) public ServiceRegistry(ZooKeeper zooKeeper)
{ {
...@@ -72,15 +70,9 @@ public class ServiceRegistry implements Watcher ...@@ -72,15 +70,9 @@ public class ServiceRegistry implements Watcher
this.currentZnode = zooKeeper.create(COORDINATOR_ZNODE_PATH + "/coordinator_", metadata.getBytes(), this.currentZnode = zooKeeper.create(COORDINATOR_ZNODE_PATH + "/coordinator_", metadata.getBytes(),
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL); ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
logger.info("Registered to be Coordinator and I am Master !"); logger.info("Registered to be Coordinator and I am Master !");
Coordinator_Address = metadata.split(":")[0]; //Coordinator coordinator = new Coordinator();
GRPCServiceStart.start(); GRPCServiceStart.start();
/*Thread thread = new Thread(()-> new Runnable() {
@Override
public void run() {
GRPCServiceStart.start();
}
});
thread.start();*/
} }
public void registerForUpdates() { public void registerForUpdates() {
try try
...@@ -141,10 +133,7 @@ public class ServiceRegistry implements Watcher ...@@ -141,10 +133,7 @@ public class ServiceRegistry implements Watcher
{ {
return allServiceAddresses; return allServiceAddresses;
} }
public static String getCoordinatorAddress()
{
return Coordinator_Address;
}
@Override @Override
public void process(WatchedEvent watchedEvent) public void process(WatchedEvent watchedEvent)
......
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