Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
D
Distributes-Search
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohammad.salama
Distributes-Search
Commits
edef04e6
Commit
edef04e6
authored
Jan 24, 2024
by
mohammad.salama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Second commit
parent
8f751f16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
Coordinator.java
src/main/java/AutoHealerAndClusterSearch/Coordinator.java
+6
-5
No files found.
src/main/java/AutoHealerAndClusterSearch/Coordinator.java
View file @
edef04e6
...
...
@@ -92,10 +92,10 @@ public class Coordinator
}
private
Request
extractRequest
(
Socket
clientSocket
)
throws
IOException
,
ClassNotFoundException
private
String
extractRequest
(
Socket
clientSocket
)
throws
IOException
,
ClassNotFoundException
{
ObjectInputStream
objectInputStream
=
new
ObjectInputStream
(
clientSocket
.
getInputStream
());
Request
request
=
(
Request
)
objectInputStream
.
readObject
();
String
request
=
(
String
)
objectInputStream
.
readObject
();
return
request
;
}
...
...
@@ -103,8 +103,8 @@ public class Coordinator
{
try
{
Request
request
=
extractRequest
(
clientSocket
);
List
<
Response
>
responses
=
spreadQuery
(
request
);
String
query
=
extractRequest
(
clientSocket
);
List
<
Response
>
responses
=
spreadQuery
(
query
);
processResultsAndPrepareAnswer
(
responses
);
}
catch
(
IOException
|
InterruptedException
|
ClassNotFoundException
|
KeeperException
e
)
...
...
@@ -160,7 +160,7 @@ public class Coordinator
* response is tree-map here the keys are words
* and values are list of pair<fileName,Number Of Appearance of the word in it>
* */
public
List
<
Response
>
spreadQuery
(
Request
request
)
throws
InterruptedException
,
KeeperException
,
IOException
,
ExecutionException
public
List
<
Response
>
spreadQuery
(
String
query
)
throws
InterruptedException
,
KeeperException
,
IOException
,
ExecutionException
{
List
<
String
>
physicalZnodes
=
zooKeeper
.
getChildren
(
PHYSICAL_ZNODES_PATH
,
false
);
...
...
@@ -191,6 +191,7 @@ public class Coordinator
PHYSICAL_ZNODES_PATH
+
"/"
+
physicalZnodes
.
get
(
index
),
false
,
stat
)
);
Request
request
=
new
Request
(
query
,
filesNumberforNode
,
filesOffset
);
tasks
.
add
(()
->
sendRequestToNode
(
request
,
ipAddress
));
index
=
(
1
+
index
)
%
physicalZnodes
.
size
();
filesOffset
=
(
filesOffset
+
filesNumberforNode
)
%
totalFilesNumber
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment