mirror of https://github.com/LOOHP/Limbo.git
Refactoring
This commit is contained in:
parent
68a97ec670
commit
9beae66898
|
|
@ -1,30 +0,0 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
# See https://github.com/actions/checkout/releases
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
- name: Set up JDK 21
|
||||
# See https://github.com/actions/setup-java/releases
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00
|
||||
with:
|
||||
java-version: 21
|
||||
distribution: temurin
|
||||
- name: Build with Maven
|
||||
run: mvn clean package
|
||||
- name: Archive Artifacts
|
||||
# See https://github.com/actions/upload-artifact/releases
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
if: success()
|
||||
with:
|
||||
name: Limbo
|
||||
path: target/Limbo-*.jar
|
||||
if-no-files-found: error
|
||||
2
pom.xml
2
pom.xml
|
|
@ -24,7 +24,7 @@
|
|||
<groupId>com.loohp</groupId>
|
||||
<artifactId>Limbo</artifactId>
|
||||
<name>Limbo</name>
|
||||
<version>0.7.17-ALPHA</version>
|
||||
<version>0.7.18-ALPHA</version>
|
||||
|
||||
<description>Standalone Limbo Minecraft Server.</description>
|
||||
<url>https://github.com/LOOHP/Limbo</url>
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ package com.loohp.limbo.consolegui;
|
|||
|
||||
import com.loohp.limbo.Limbo;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class SystemInfo {
|
||||
|
||||
@SuppressWarnings("InfiniteLoopStatement")
|
||||
public static void printInfo() {
|
||||
if (!Limbo.noGui) {
|
||||
while (true) {
|
||||
|
|
@ -47,11 +47,11 @@ public class SystemInfo {
|
|||
|
||||
try {
|
||||
@SuppressWarnings("restriction")
|
||||
com.sun.management.OperatingSystemMXBean operatingSystemMXBean = (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
|
||||
com.sun.management.OperatingSystemMXBean operatingSystemMXBean = (com.sun.management.OperatingSystemMXBean) java.lang.management.ManagementFactory.getOperatingSystemMXBean();
|
||||
@SuppressWarnings("restriction")
|
||||
double processLoad = operatingSystemMXBean.getProcessCpuLoad();
|
||||
@SuppressWarnings("restriction")
|
||||
double systemLoad = operatingSystemMXBean.getSystemCpuLoad();
|
||||
double systemLoad = operatingSystemMXBean.getCpuLoad();
|
||||
int processors = runtime.availableProcessors();
|
||||
|
||||
sb.append("Available Processors: ").append(processors).append("\n");
|
||||
|
|
|
|||
|
|
@ -35,18 +35,21 @@ public class ServerConnection extends Thread {
|
|||
private final String ip;
|
||||
private final int port;
|
||||
private final boolean silent;
|
||||
private final ExecutorService virtualThreadExecutor = Executors.newVirtualThreadPerTaskExecutor();
|
||||
private final ExecutorService executorService;
|
||||
private final List<ClientConnection> clients;
|
||||
|
||||
private ServerSocket serverSocket;
|
||||
private List<ClientConnection> clients;
|
||||
|
||||
public ServerConnection(String ip, int port, boolean silent) {
|
||||
this.clients = new ArrayList<>();
|
||||
this.ip = ip;
|
||||
this.port = port;
|
||||
this.silent = silent;
|
||||
this.executorService = Executors.newVirtualThreadPerTaskExecutor();
|
||||
start();
|
||||
}
|
||||
|
||||
@SuppressWarnings("InfiniteLoopStatement")
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
|
@ -58,9 +61,9 @@ public class ServerConnection extends Thread {
|
|||
Socket connection = serverSocket.accept();
|
||||
ClientConnection clientTask = new ClientConnection(connection);
|
||||
clients.add(clientTask);
|
||||
virtualThreadExecutor.submit(clientTask);
|
||||
executorService.submit(clientTask);
|
||||
}
|
||||
} catch(IOException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue