Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
K
key_value-server
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
amir.yosef
key_value-server
Commits
f2cfa68b
Commit
f2cfa68b
authored
Aug 19, 2024
by
amir.yosef
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing try-with buffered-reader exception
parent
b7615176
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
12 deletions
+10
-12
Main.java
src/Main.java
+1
-1
FullRsyncCommand.java
src/command/FullRsyncCommand.java
+0
-1
ConnectionHandler.java
src/handlers/replica/ConnectionHandler.java
+3
-3
SendToReplica.java
src/server/SendToReplica.java
+4
-5
ServerBuilder.java
src/server/ServerBuilder.java
+1
-1
RdbFileInfo.java
src/util/RdbFileInfo.java
+1
-1
No files found.
src/Main.java
View file @
f2cfa68b
src/command/FullRsyncCommand.java
View file @
f2cfa68b
...
...
@@ -27,7 +27,6 @@ public class FullRsyncCommand implements CommandExecutable<byte[]> {
public
byte
[]
execute
()
{
synchronized
(
this
)
{
replicaSender
.
addConnection
(
outputStream
);
System
.
out
.
println
(
"hi"
);
byte
[]
decode
=
rdbFileInfo
.
getContent
();
try
{
return
createCommandBytes
(
Command
.
FULLRESYNC
,
decode
,
serverInfo
);
...
...
src/handlers/replica/ConnectionHandler.java
View file @
f2cfa68b
...
...
@@ -33,10 +33,10 @@ public class ConnectionHandler {
}
public
BufferedReader
handleConnection
()
{
try
(
OutputStream
outputStream
=
socket
.
getOutputStream
();
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
socket
.
getInputStream
())))
{
try
{
OutputStream
outputStream
=
socket
.
getOutputStream
();
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
socket
.
getInputStream
()));
commandSender
.
sendCommand
(
bufferedReader
,
outputStream
);
String
line
;
while
((
line
=
bufferedReader
.
readLine
())
!=
null
)
{
if
(
line
.
isEmpty
())
{
...
...
src/server/SendToReplica.java
View file @
f2cfa68b
...
...
@@ -47,10 +47,10 @@ public class SendToReplica implements Closeable {
byte
[]
commandBytes
=
command
.
getBytes
();
connectedReplicas
.
forEach
(
replica
->
{
try
{
try
(
OutputStream
outputStream
=
replica
.
os
())
{
OutputStream
outputStream
=
replica
.
os
();
outputStream
.
write
(
commandBytes
);
outputStream
.
flush
();
}
}
catch
(
IOException
e
)
{
logger
.
log
(
Level
.
SEVERE
,
"Failed to send command to replica "
,
e
);
}
...
...
@@ -67,7 +67,6 @@ public class SendToReplica implements Closeable {
}
public
void
addConnection
(
OutputStream
outputStream
)
{
connectedReplicas
.
add
(
new
ConnectedReplica
(
outputStream
));
logger
.
info
(
"SIZE CONNECTED REPLICAS = "
+
connectedReplicas
.
size
());
...
...
src/server/ServerBuilder.java
View file @
f2cfa68b
...
...
@@ -8,7 +8,7 @@ import java.util.Map;
import
java.util.Optional
;
public
class
ServerBuilder
{
private
int
port
=
163
80
;
private
int
port
=
163
79
;
private
String
role
;
private
final
String
[]
masterPortAndHost
;
private
final
static
ServerInfo
info
=
ServerInfo
.
getInstance
();
...
...
src/util/RdbFileInfo.java
View file @
f2cfa68b
...
...
@@ -51,7 +51,7 @@ public class RdbFileInfo {
}
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"
;
out
.
println
(
parameters
);
if
(
parameters
.
containsKey
(
"--dir"
))
{
...
...
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