Browse Source

simpl frame works

master
esoe 2 years ago
parent
commit
3f66250ea0
  1. 11
      src/main/java/ru/molokoin/ExchangeServer.java
  2. 5
      src/main/java/ru/molokoin/ServerLauncher.java
  3. BIN
      target/classes/ru/molokoin/ExchangeServer.class
  4. BIN
      target/classes/ru/molokoin/ServerLauncher.class

11
src/main/java/ru/molokoin/ExchangeServer.java

@ -1,8 +1,11 @@ @@ -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 { @@ -13,6 +16,10 @@ public class ExchangeServer {
//
}
public static void main(String[] args) {
Queue<Connection> connectionQueue = (Queue<Connection>)new ArrayBlockingQueue(1024);
launch = new ServerLauncher(8081, connectionQueue);
server = new Thread(launch);
server.setName("ServerLauncherThread");
server.start();
}

5
src/main/java/ru/molokoin/ServerLauncher.java

@ -16,6 +16,11 @@ public class ServerLauncher implements Runnable{ @@ -16,6 +16,11 @@ public class ServerLauncher implements Runnable{
private Queue<Connection> connectionQueue = null;
private boolean isActive = false;//флаг проверки, запущен ли сервер
ServerLauncher(int port, Queue<Connection> connectionQueue){
tcpPort = port;
this.connectionQueue = connectionQueue;
}
@Override
public void run() {
try{

BIN
target/classes/ru/molokoin/ExchangeServer.class

Binary file not shown.

BIN
target/classes/ru/molokoin/ServerLauncher.class

Binary file not shown.
Loading…
Cancel
Save