Skip to content

Commit dfd2f0d

Browse files
committed
started to work on remote control.
1 parent c2ffe02 commit dfd2f0d

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/main/java/com/ss/editor/config/Config.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ public final class Config {
7474
@NotNull
7575
public static final OperatingSystem OPERATING_SYSTEM;
7676

77+
/**
78+
* The remote control port.
79+
*/
80+
public static int REMOTE_CONTROL_PORT = -1;
81+
7782
/**
7883
* The flag to enable debug mode.
7984
*/
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.ss.editor.manager;
2+
3+
import com.ss.editor.config.Config;
4+
import com.ss.rlib.logging.Logger;
5+
import com.ss.rlib.logging.LoggerManager;
6+
import com.ss.rlib.network.NetworkFactory;
7+
import com.ss.rlib.network.server.ServerNetwork;
8+
import org.jetbrains.annotations.NotNull;
9+
import org.jetbrains.annotations.Nullable;
10+
11+
/**
12+
* The manager to process remote control.
13+
*
14+
* @author JavaSaBr
15+
*/
16+
public class RemoteControlManager {
17+
18+
@NotNull
19+
private static final Logger LOGGER = LoggerManager.getLogger(RemoteControlManager.class);
20+
21+
@Nullable
22+
private static RemoteControlManager instance;
23+
24+
private static @NotNull RemoteControlManager getInstance() {
25+
if (instance == null) instance = new RemoteControlManager();
26+
return instance;
27+
}
28+
29+
@Nullable
30+
private ServerNetwork serverNetwork;
31+
32+
private RemoteControlManager() {
33+
if(Config.REMOTE_CONTROL_PORT == -1) {
34+
return;
35+
}
36+
37+
serverNetwork = NetworkFactory.newDefaultAsynchronousServerNetwork();
38+
}
39+
}

0 commit comments

Comments
 (0)