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
5a79f2a4
Commit
5a79f2a4
authored
Aug 26, 2024
by
amir.yosef
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating where sending to replica invoked
parent
aa94992a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
6 deletions
+8
-6
CommandInvoker.java
src/command/CommandInvoker.java
+1
-1
ClientCommandHandler.java
src/handlers/ClientCommandHandler.java
+1
-1
SendToReplica.java
src/server/SendToReplica.java
+2
-2
Server.java
src/server/Server.java
+2
-0
ServerBuilder.java
src/server/ServerBuilder.java
+1
-1
ServerInfo.java
src/server/ServerInfo.java
+1
-1
No files found.
src/command/CommandInvoker.java
View file @
5a79f2a4
...
@@ -4,7 +4,7 @@ import java.io.IOException;
...
@@ -4,7 +4,7 @@ import java.io.IOException;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
public
final
class
CommandInvoker
{
public
final
class
CommandInvoker
{
private
static
final
Logger
logger
=
Logger
.
getLogger
(
CommandInvoker
.
class
.
getName
());
private
static
final
Logger
logger
=
Logger
.
getLogger
(
CommandInvoker
.
class
.
getName
());
public
static
byte
[]
invoke
(
CommandExecutable
<
byte
[]>
command
)
throws
IOException
{
public
static
byte
[]
invoke
(
CommandExecutable
<
byte
[]>
command
)
throws
IOException
{
...
...
src/handlers/ClientCommandHandler.java
View file @
5a79f2a4
...
@@ -29,7 +29,7 @@ public final class ClientCommandHandler {
...
@@ -29,7 +29,7 @@ public final class ClientCommandHandler {
this
.
os
=
outputStream
;
this
.
os
=
outputStream
;
this
.
commandParser
=
new
CommandParser
();
this
.
commandParser
=
new
CommandParser
();
this
.
sendToReplica
=
SendToReplica
.
getInstance
();
this
.
sendToReplica
=
SendToReplica
.
getInstance
();
sendToReplica
.
start
();
}
}
public
void
execute
()
{
public
void
execute
()
{
...
...
src/server/SendToReplica.java
View file @
5a79f2a4
...
@@ -14,7 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger;
...
@@ -14,7 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
public
class
SendToReplica
implements
Closeable
{
public
final
class
SendToReplica
implements
Closeable
{
private
static
final
Logger
logger
=
Logger
.
getLogger
(
SendToReplica
.
class
.
getName
());
private
static
final
Logger
logger
=
Logger
.
getLogger
(
SendToReplica
.
class
.
getName
());
private
final
Queue
<
ConnectedReplica
>
connectedReplicas
;
private
final
Queue
<
ConnectedReplica
>
connectedReplicas
;
private
final
Queue
<
String
>
commands
;
private
final
Queue
<
String
>
commands
;
...
@@ -24,7 +24,7 @@ public class SendToReplica implements Closeable {
...
@@ -24,7 +24,7 @@ public class SendToReplica implements Closeable {
private
SendToReplica
()
{
private
SendToReplica
()
{
this
.
connectedReplicas
=
new
ConcurrentLinkedQueue
<>();
this
.
connectedReplicas
=
new
ConcurrentLinkedQueue
<>();
this
.
commands
=
new
ConcurrentLinkedQueue
<>();
this
.
commands
=
new
ConcurrentLinkedQueue
<>();
this
.
executorService
=
Executors
.
new
VirtualThreadPerTask
Executor
();
this
.
executorService
=
Executors
.
new
SingleThread
Executor
();
this
.
countCommands
=
new
AtomicInteger
(
0
);
this
.
countCommands
=
new
AtomicInteger
(
0
);
}
}
...
...
src/server/Server.java
View file @
5a79f2a4
...
@@ -27,6 +27,8 @@ public final class Server implements AutoCloseable {
...
@@ -27,6 +27,8 @@ public final class Server implements AutoCloseable {
this
.
executor
=
Executors
.
newVirtualThreadPerTaskExecutor
();
this
.
executor
=
Executors
.
newVirtualThreadPerTaskExecutor
();
this
.
manager
=
new
StorageManager
();
this
.
manager
=
new
StorageManager
();
this
.
replicaConnectionService
=
replicaConnectionService
;
this
.
replicaConnectionService
=
replicaConnectionService
;
SendToReplica
sendToReplica
=
SendToReplica
.
getInstance
();
sendToReplica
.
start
();
}
}
public
void
start
()
{
public
void
start
()
{
...
...
src/server/ServerBuilder.java
View file @
5a79f2a4
...
@@ -7,7 +7,7 @@ import java.io.IOException;
...
@@ -7,7 +7,7 @@ import java.io.IOException;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
public
class
ServerBuilder
{
public
final
class
ServerBuilder
{
private
static
final
Logger
logger
=
Logger
.
getLogger
(
ServerBuilder
.
class
.
getName
());
private
static
final
Logger
logger
=
Logger
.
getLogger
(
ServerBuilder
.
class
.
getName
());
private
int
port
=
6379
;
private
int
port
=
6379
;
private
String
role
=
"master"
;
private
String
role
=
"master"
;
...
...
src/server/ServerInfo.java
View file @
5a79f2a4
...
@@ -4,7 +4,7 @@ package server;
...
@@ -4,7 +4,7 @@ package server;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
public
class
ServerInfo
{
public
final
class
ServerInfo
{
private
static
ServerInfo
serverInfo
;
private
static
ServerInfo
serverInfo
;
private
final
Map
<
String
,
String
>
info
=
new
ConcurrentHashMap
<>();
private
final
Map
<
String
,
String
>
info
=
new
ConcurrentHashMap
<>();
...
...
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