From 3f66250ea07d1ed161c03d04b8c89ac0735daa51 Mon Sep 17 00:00:00 2001 From: esoe Date: Mon, 10 Oct 2022 17:09:44 +0300 Subject: [PATCH] simpl frame works --- src/main/java/ru/molokoin/ExchangeServer.java | 11 +++++++++-- src/main/java/ru/molokoin/ServerLauncher.java | 5 +++++ .../classes/ru/molokoin/ExchangeServer.class | Bin 910 -> 1185 bytes .../classes/ru/molokoin/ServerLauncher.class | Bin 1756 -> 1926 bytes 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/molokoin/ExchangeServer.java b/src/main/java/ru/molokoin/ExchangeServer.java index 84a6a55..9f0a8ff 100644 --- a/src/main/java/ru/molokoin/ExchangeServer.java +++ b/src/main/java/ru/molokoin/ExchangeServer.java @@ -1,8 +1,11 @@ package ru.molokoin; +import java.util.Queue; +import java.util.concurrent.ArrayBlockingQueue; + public class ExchangeServer { - private static ServerLauncher launch = new ServerLauncher(); - public static Thread server = new Thread(launch); + private static ServerLauncher launch; + public static Thread server; //Запуск сервера public void enable(ExchangeServer server){ @@ -13,6 +16,10 @@ public class ExchangeServer { // } public static void main(String[] args) { + Queue connectionQueue = (Queue)new ArrayBlockingQueue(1024); + launch = new ServerLauncher(8081, connectionQueue); + server = new Thread(launch); + server.setName("ServerLauncherThread"); server.start(); } diff --git a/src/main/java/ru/molokoin/ServerLauncher.java b/src/main/java/ru/molokoin/ServerLauncher.java index cd4d9f0..b894bb8 100644 --- a/src/main/java/ru/molokoin/ServerLauncher.java +++ b/src/main/java/ru/molokoin/ServerLauncher.java @@ -16,6 +16,11 @@ public class ServerLauncher implements Runnable{ private Queue connectionQueue = null; private boolean isActive = false;//флаг проверки, запущен ли сервер + ServerLauncher(int port, Queue connectionQueue){ + tcpPort = port; + this.connectionQueue = connectionQueue; + } + @Override public void run() { try{ diff --git a/target/classes/ru/molokoin/ExchangeServer.class b/target/classes/ru/molokoin/ExchangeServer.class index 74793444b8ccd752f264bb759a58f85203e79917..7e06e5d94adcd6d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gc^PpuEtc_s|qizm#4#I*hb zVDJZNZesaP*@0T+&M)ls;E+71(976>Z_T8?x;2FMDy?;jGTfk3&s71PD+H$tY+Yje z3a!%%Y%g&85}mJ(V~Xh(~`^6eI8pbiU#7QcE#=lYHD+ P8HD2*LN`d)$v^rH(3h#T diff --git a/target/classes/ru/molokoin/ServerLauncher.class b/target/classes/ru/molokoin/ServerLauncher.class index db3190ac6672b5054faf440f84c1154672db53d3..f4c8e6126d1e16f928df4539ae2ff675c99fc3a1 100644 GIT binary patch delta 903 zcmZ8fO-~b16g_XIWXdp5KBPcfX!(-q6ey^O3aE&Pl_FqkYemqZj992`Gqy$&6L#*K z*&4TO++d(pNn9H@YFwF^7=D5OK)kOcEX+&pJ@3Bz?mg$-_pA1mL;mvj<0k;4*xZ$6 z=5AI);SK${9xUWj>EL3)C>Ue@7(-AE6~6|?IkZh>*9;jVoC+Gy!XT>tSTz{h6iBdh z3)pSTn-h#3(LGxWLd3&E^l~S> z7LG}nhE9d=VU|Iv@JeSS+^5$m9y;q}B=CS&UuNi0t=~dtr$1JMhtMTFA|d}xNx>?T z)@$33ZP1-Y2&kp83TVP9@N8c(pcaA<+nz+zT|GgU##K<2j9VD87n?A6I)U~67 zRu^gPrWGJDlSDRxKE&z2ERkleS|id#xuP1BUxhUo7-Dom#bd0Kwm7BmAj1<%t%0~K PVYJF5L!lIf1Z?~Rv|6M- delta 806 zcmYk4K~ED=5Xb*-w`E~@SX!h&fwl^0yHzS8f>hLssFfmMfm%^?T~<=Tmej406E_du z$R>UT4xVaktCARx#*>LxFMa~QfjDn5hHNr#c4prEfAijZ<@wp7e*5$3Gk{U7RaBLY z$&u(1gKM(5YO0XY&f$fx2@D+^3L1si#nA*+c-?ObTq+k-^y7qr0fqs4 zP8x7?oJ7Q)lt!3lZ%Lu9C{BrqJHPy@ibdQN zk~#Z}E84q^2MX@fn2vVY%5TKy%Vyc+SiwWP!Tn>KxZ$HSZ=-9=K_U<6*6KK_c|$u@ z_%&8Vr!W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