diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2979491..db72c2d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -7,13 +7,22 @@ - + + + + + - - + + + + + + + @@ -36,55 +45,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -93,19 +58,21 @@ - - + + - - + + - - - + + + + + @@ -113,33 +80,67 @@ - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -151,20 +152,6 @@ - timeoy - timeo - timeou - timeout - timeout f - timeout fi - timeout fini - timeout finit - i - inio g - inio - inio - in - inv invio h invio multic @@ -181,6 +168,20 @@ Config.WordsRe Config.WordsRec Config.WordsRece + remo + login unsu + s + client + add + print + printall + Syst + System + System. + System.o + System.ou + thread + System.out C:\Users\loke\TextTwist\out\production @@ -319,12 +320,6 @@ @@ -424,6 +425,7 @@ + @@ -639,7 +641,7 @@ @@ -669,125 +671,8 @@ - @@ -1318,47 +1203,48 @@ - + + - - - - - - - - - - - - + + + - - + + - + + + + + + + + + @@ -1378,61 +1264,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1440,14 +1271,6 @@ - - - - - - - - @@ -1559,26 +1382,16 @@ - - - - - - - - - - - - - - - - - + + + + + + + @@ -1595,14 +1408,6 @@ - - - - - - - - @@ -1611,16 +1416,6 @@ - - - - - - - - - - @@ -1639,10 +1434,70 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1655,43 +1510,85 @@ - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + - + - - + + - + - + @@ -1701,100 +1598,96 @@ - - - + + + + + - + - - - + + + + + - + - - + + - - + + - - + + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/Client/src/com/texttwist/client/controllers/HomeController.java b/Client/src/com/texttwist/client/controllers/HomeController.java index 2197bbd..30faf9c 100644 --- a/Client/src/com/texttwist/client/controllers/HomeController.java +++ b/Client/src/com/texttwist/client/controllers/HomeController.java @@ -18,6 +18,11 @@ public class HomeController { public Response login(String userName, String password) throws RemoteException, NotBoundException, MalformedURLException { Response res = authService.login(userName,password); if (res.code == 200){ + try { + App.registerForNotifications(); + } catch (RemoteException e) { + App.logger.write("AUTH SERVICE: Can't register for notification"); + } App.session = (new Session(new User(userName,password,0), res.data.get("token").toString())); } return res; diff --git a/Client/src/com/texttwist/client/services/AuthService.java b/Client/src/com/texttwist/client/services/AuthService.java index 7944483..5936dcf 100644 --- a/Client/src/com/texttwist/client/services/AuthService.java +++ b/Client/src/com/texttwist/client/services/AuthService.java @@ -20,11 +20,6 @@ public class AuthService { private String baseUrl = Config.getAuthServerURI().concat("/auth"); public Response login(String userName, String password) throws RemoteException, NotBoundException, MalformedURLException { - try { - App.registerForNotifications(); - } catch (RemoteException e) { - App.logger.write("AUTH SERVICE: Can't register for notification"); - } IAuth auth = (IAuth) Naming.lookup(baseUrl); return auth.login(userName, password); } diff --git a/Client/src/com/texttwist/client/tasks/SendWords.java b/Client/src/com/texttwist/client/tasks/SendWords.java index 4b0a74d..cb4c1c5 100644 --- a/Client/src/com/texttwist/client/tasks/SendWords.java +++ b/Client/src/com/texttwist/client/tasks/SendWords.java @@ -36,7 +36,6 @@ public class SendWords extends SwingWorker { buffer.flip(); App.clientUDP.send(buffer, App.clientUDPSocketAddress); - System.out.println("SENDED" + sentence); } catch (UnknownHostException e) { App.logger.write("SEND WORDS: Host address not correct"); } catch (IOException e) { diff --git a/Client/src/com/texttwist/client/tasks/WaitForPlayers.java b/Client/src/com/texttwist/client/tasks/WaitForPlayers.java index e0dfabb..cdc096a 100644 --- a/Client/src/com/texttwist/client/tasks/WaitForPlayers.java +++ b/Client/src/com/texttwist/client/tasks/WaitForPlayers.java @@ -35,8 +35,6 @@ public class WaitForPlayers extends SwingWorker { while (App.clientTCP.read(buffer) != -1) { String line = new String(buffer.array(), buffer.position(), buffer.remaining()); buffer.clear(); - System.out.println("ASPETTO GAM_STARTED"); - System.out.println(line); if (line.startsWith("MESSAGE")) { buffer.clear(); diff --git a/Server/src/com/texttwist/server/Server.java b/Server/src/com/texttwist/server/Server.java index 0dd6373..f57822b 100644 --- a/Server/src/com/texttwist/server/Server.java +++ b/Server/src/com/texttwist/server/Server.java @@ -59,7 +59,7 @@ public class Server { private void startMessageService(){ //Starting the Message service based on TCP - new Thread(new MessageService(Config.GameServerPort)).start(); + new Thread(new MessageService()).start(); } private void startWordsReceiverService(){ diff --git a/Server/src/com/texttwist/server/models/Match.java b/Server/src/com/texttwist/server/models/Match.java index 45edfb0..7592a42 100644 --- a/Server/src/com/texttwist/server/models/Match.java +++ b/Server/src/com/texttwist/server/models/Match.java @@ -10,8 +10,6 @@ import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import static com.texttwist.server.services.MessageService.activeMatches; - /** * Author: Lorenzo Iovino on 23/06/2017. @@ -32,6 +30,9 @@ public class Match { //Players score: A list of pair where elements are . public final List> playersScore = Collections.synchronizedList(new ArrayList<>()); + //Players score: A list of active matches. + public static List activeMatches = Collections.synchronizedList(new ArrayList<>()); + /****SINGLE INSTANCE OF MATCH****/ //If match is started @@ -50,7 +51,7 @@ public class Match { //Letters of the match public DefaultListModel letters; - protected ExecutorService matchTimeoutThread = Executors.newSingleThreadExecutor(); + private ExecutorService matchTimeoutThread = Executors.newSingleThreadExecutor(); public Match(String matchCreator, DefaultListModel players){ for (int i =0; i < players.size(); i++){ @@ -61,7 +62,6 @@ public class Match { this.multicastId = this.generateMulticastId(); this.matchCreator = matchCreator; - } public static Match findMatch(List matches, String matchName){ @@ -73,12 +73,6 @@ public class Match { return null; } - public void printAll(){ - for (Pair aPlayersScore : playersScore) { - System.out.println(aPlayersScore.getKey() + " : " + aPlayersScore.getValue()); - } - } - public static int findMatchIndex(List matches, String matchName){ for (int i = 0; i < matches.size(); i++) { if (matches.get(i).matchCreator.equals(matchName)) { diff --git a/Server/src/com/texttwist/server/servers/ProxyDispatcher.java b/Server/src/com/texttwist/server/proxies/MessageDispatcher.java similarity index 86% rename from Server/src/com/texttwist/server/servers/ProxyDispatcher.java rename to Server/src/com/texttwist/server/proxies/MessageDispatcher.java index b823a7d..2f0c217 100644 --- a/Server/src/com/texttwist/server/servers/ProxyDispatcher.java +++ b/Server/src/com/texttwist/server/proxies/MessageDispatcher.java @@ -1,4 +1,4 @@ -package com.texttwist.server.servers; +package com.texttwist.server.proxies; import com.texttwist.server.services.SessionsService; import com.texttwist.server.models.Match; @@ -10,25 +10,22 @@ import java.nio.ByteBuffer; import java.nio.channels.SocketChannel; import java.util.concurrent.*; -import static com.texttwist.server.services.MessageService.activeMatches; /** * Author: Lorenzo Iovino on 18/06/2017. * Description: Proxy Dispatcher * */ -public class ProxyDispatcher implements Callable { - protected final ExecutorService threadPool = Executors.newCachedThreadPool(); +public class MessageDispatcher implements Callable { + private final ExecutorService threadPool = Executors.newCachedThreadPool(); private final Message request; private final SocketChannel socketChannel; private ByteBuffer bufferMessage; - boolean matchNotAvailable =false; + private boolean matchNotAvailable = false; - - public ProxyDispatcher(Message request, SocketChannel socketChannel, ByteBuffer bufferMessage) { + public MessageDispatcher(Message request, SocketChannel socketChannel, ByteBuffer bufferMessage) { this.request = request; this.socketChannel = socketChannel; this.bufferMessage = bufferMessage; - } @Override @@ -47,12 +44,10 @@ public class ProxyDispatcher implements Callable { Boolean invitationSended = sendInvitations.get(); if (invitationSended) { - //Crea nuova partita e attendi i giocatori + //Create new match and wait users joins request.data.addElement(request.sender); final Match match = new Match(request.sender, request.data); - match.printAll(); - - activeMatches.add(match); + Match.activeMatches.add(match); DefaultListModel matchName = new DefaultListModel<>(); matchName.addElement(request.sender); @@ -62,28 +57,24 @@ public class ProxyDispatcher implements Callable { if(!joinMatchRes){ bufferMessage = ByteBuffer.allocate(1024); - - //NON FARE NULLA, ASPETTA GLI ALTRI Message message = new Message("INVITES_ALL_SENDED", "", "", new DefaultListModel<>()); byteMessage = message.toString().getBytes(); bufferMessage = ByteBuffer.wrap(byteMessage); socketChannel.write(bufferMessage); } - Future joinTimeout = threadPool.submit(new JoinTimeout(match)); Boolean joinTimeoutRes = joinTimeout.get(); if(joinTimeoutRes){ Future sendMessageJoinTimeout = threadPool.submit( - new SendMessageToAllPlayers(match, new Message("JOIN_TIMEOUT", "", "", new DefaultListModel<>()), socketChannel)); - + new SendMessageToAllPlayers(match, + new Message("JOIN_TIMEOUT", "", "", new DefaultListModel<>()), socketChannel)); Boolean sendMessageJoinTimeoutRes = sendMessageJoinTimeout.get(); if(!sendMessageJoinTimeoutRes){ - activeMatches.remove(Match.findMatchIndex(activeMatches, match.matchCreator)); + Match.activeMatches.remove(Match.findMatchIndex(Match.activeMatches, match.matchCreator)); return sendMessageJoinTimeoutRes; } } else { - System.out.println("TIMEOUT FINITO SENZA EFFETTI"); return true; } @@ -124,7 +115,6 @@ public class ProxyDispatcher implements Callable { bufferMessage = ByteBuffer.wrap(byteMessage); try { - String s = new String(bufferMessage.array(), bufferMessage.position(), bufferMessage.remaining()); socketChannel.write(bufferMessage); } catch (IOException e) { e.printStackTrace(); @@ -139,7 +129,7 @@ public class ProxyDispatcher implements Callable { case "JOIN_GAME": Future joinMatch = threadPool.submit(new JoinMatch(request.sender, request.data, socketChannel)); try { - Match match = Match.findMatch(activeMatches, request.data.get(0));; + Match match = Match.findMatch(Match.activeMatches, request.data.get(0));; Boolean joinMatchRes = joinMatch.get(); if(joinMatchRes){ @@ -153,23 +143,17 @@ public class ProxyDispatcher implements Callable { if (socketClient != null) { bufferMessage.clear(); bufferMessage = ByteBuffer.allocate(1024); - Message message = new Message("GAME_STARTED", "", "", match.letters); match.startGame(); - - System.out.println("TIMEOUT CANCELLEd"); byteMessage = message.toString().getBytes(); - bufferMessage = ByteBuffer.wrap(byteMessage); try { String s = new String(bufferMessage.array(), bufferMessage.position(), bufferMessage.remaining()); - System.out.println("INVIO GAME_STARTED "+ s); socketClient.write(bufferMessage); } catch (IOException e) { e.printStackTrace(); } } - } if (matchNotAvailable) { return false; @@ -180,7 +164,6 @@ public class ProxyDispatcher implements Callable { bufferMessage = ByteBuffer.allocate(1024); if (socketChannel != null) { bufferMessage = ByteBuffer.allocate(1024); - Message msg = new Message("MATCH_NOT_AVAILABLE", "", null, new DefaultListModel<>()); bufferMessage.clear(); byteMessage = msg.toString().getBytes(); @@ -188,7 +171,6 @@ public class ProxyDispatcher implements Callable { socketChannel.write(bufferMessage); matchNotAvailable = true; } - } } } catch (InterruptedException e) { @@ -198,17 +180,13 @@ public class ProxyDispatcher implements Callable { } catch (IOException e) { e.printStackTrace(); } - default: - break; } - } else { threadPool.submit(new TokenInvalid(request.sender, socketChannel, bufferMessage)); return false; } - return false; } } diff --git a/Server/src/com/texttwist/server/services/JedisService.java b/Server/src/com/texttwist/server/services/JedisService.java index 6d796cd..78f519f 100644 --- a/Server/src/com/texttwist/server/services/JedisService.java +++ b/Server/src/com/texttwist/server/services/JedisService.java @@ -16,10 +16,6 @@ import static com.texttwist.server.Server.jedisPool; */ public class JedisService { - public JedisService(){ - - } - /** Read the object from Base64 string. */ public static Object fromString(String s) throws IOException, ClassNotFoundException { byte [] data = Base64.getDecoder().decode(s); @@ -57,11 +53,8 @@ public class JedisService { Jedis jedis = null; List l = new ArrayList<>(); try { - System.out.println("USER ss"); - jedis = jedisPool.getResource(); String usersString = jedis.get(key); - System.out.println("USER "+usersString); if(usersString!=null) { String[] lines = usersString.split("\n"); for (int i = 0; i < lines.length; i++) { diff --git a/Server/src/com/texttwist/server/services/MessageService.java b/Server/src/com/texttwist/server/services/MessageService.java index a09f033..2d94cd1 100644 --- a/Server/src/com/texttwist/server/services/MessageService.java +++ b/Server/src/com/texttwist/server/services/MessageService.java @@ -1,76 +1,53 @@ - package com.texttwist.server.services; + import com.texttwist.server.Server; -import com.texttwist.server.servers.ProxyDispatcher; +import com.texttwist.server.proxies.MessageDispatcher; import com.texttwist.server.models.Dictionary; -import com.texttwist.server.models.Match; import constants.Config; import models.Message; import java.net.*; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.*; -import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; -import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; - import static java.nio.channels.SelectionKey.OP_ACCEPT; import static java.nio.channels.SelectionKey.OP_READ; /** * Author: Lorenzo Iovino on 17/06/2017. - * Description: Game Server + * Description: Message Service */ public class MessageService implements Runnable{ - private int serverPort; - private ProxyDispatcher proxy; - private ReceiveWordsService wordsReceiver; - - private DatagramChannel datagramChannel; private Selector selector = null; - private ExecutorService threadPool = Executors.newCachedThreadPool(); + private ExecutorService dispatcherPool = Executors.newCachedThreadPool(); private String dictionaryPath = "./Server/resources/dictionary"; public static Dictionary dict; - SocketChannel client; - ByteBuffer bufferWords = ByteBuffer.allocate(1024); - ByteBuffer bufferMessages = ByteBuffer.allocate(1024); - - - public static List activeMatches = Collections.synchronizedList(new ArrayList<>()); public static Integer multicastId = 4000; - public MessageService(int port){ - this.serverPort = port; - } - - public void run(){ - + public MessageService() + { dict = new Dictionary(dictionaryPath); try { selector = Selector.open(); ServerSocketChannel serverSocketChannel = ServerSocketChannel.open(); serverSocketChannel.configureBlocking(false); - serverSocketChannel.socket().bind(new InetSocketAddress(serverPort)); + serverSocketChannel.socket().bind(new InetSocketAddress(Config.GameServerPort)); serverSocketChannel.register(selector, OP_ACCEPT); - - - - Server.logger.write("GameService Service is running at "+this.serverPort+" port..."); - + Server.logger.write("GameService Service is running at "+Config.GameServerPort+" port..."); } catch (IOException e) { e.printStackTrace(); } + } + public void run(){ while (true) { - System.out.println("WAITING FOR MSG"); try { selector.select(); } catch (IOException e) { @@ -79,9 +56,9 @@ public class MessageService implements Runnable{ Iterator iter = selector.selectedKeys().iterator(); while (iter.hasNext()) { - bufferMessages = ByteBuffer.allocate(1024); + ByteBuffer bufferMessages = ByteBuffer.allocate(1024); bufferMessages.clear(); - client = null; + SocketChannel client = null; SelectionKey key = iter.next(); iter.remove(); @@ -99,10 +76,9 @@ public class MessageService implements Runnable{ bufferMessages.flip(); String line = new String(bufferMessages.array(), bufferMessages.position(), bufferMessages.remaining()); if (line.startsWith("MESSAGE")) { - SessionsService.getInstance().printAll(); Message msg = Message.toMessage(line); - proxy = new ProxyDispatcher(msg, client, bufferMessages); - threadPool.submit(proxy); + MessageDispatcher proxy = new MessageDispatcher(msg, client, bufferMessages); + dispatcherPool.submit(proxy); } if (line.startsWith("CLOSE")) { diff --git a/Server/src/com/texttwist/server/services/NotificationService.java b/Server/src/com/texttwist/server/services/NotificationService.java index f630028..7c085e6 100644 --- a/Server/src/com/texttwist/server/services/NotificationService.java +++ b/Server/src/com/texttwist/server/services/NotificationService.java @@ -25,32 +25,21 @@ public class NotificationService implements INotificationServer { public synchronized void registerForCallback(INotificationClient clientInterface) throws RemoteException { if(!clients.contains(clientInterface)){ clients.add(clientInterface); - System.out.println(clientInterface); - System.out.println("New client registered"); } } public synchronized void unregisterForCallback(INotificationClient client) throws RemoteException { - if (clients.remove(client)) { - System.out.println("Client unregistered"); - } else { - System.out.println("Unable to unregister client"); - } - + clients.remove(client); } public synchronized void sendInvitations(String username, DefaultListModel users){ Iterator i = clients.iterator(); INotificationClient client = null; - System.out.println("Starting callbacks"); while (i.hasNext()) { client = (INotificationClient) i.next(); try { - - System.out.println("SENDING INVITE TO "+users); client.sendInvite(username, users); } catch (RemoteException e) { - System.out.println("Sembra down"); try { unregisterForCallback(client); } catch (RemoteException e1) { diff --git a/Server/src/com/texttwist/server/services/SessionsService.java b/Server/src/com/texttwist/server/services/SessionsService.java index 9489a99..2f80540 100644 --- a/Server/src/com/texttwist/server/services/SessionsService.java +++ b/Server/src/com/texttwist/server/services/SessionsService.java @@ -40,12 +40,6 @@ public class SessionsService { return sessions.add(new Session(new User(userName,"",0), token)); } - public void printAll(){ - for (Session elem : sessions) { - System.out.println(elem.account.userName + " | " + elem.token); - } - } - public boolean remove(String userName){ if(exists(userName)) { Session s = getSession(userName); diff --git a/Server/src/com/texttwist/server/tasks/ComputeScore.java b/Server/src/com/texttwist/server/tasks/ComputeScore.java index 4aa5453..97113c4 100644 --- a/Server/src/com/texttwist/server/tasks/ComputeScore.java +++ b/Server/src/com/texttwist/server/tasks/ComputeScore.java @@ -14,10 +14,10 @@ import java.util.concurrent.Callable; */ public class ComputeScore implements Callable { - public DefaultListModel words; - public final String sender; + private DefaultListModel words; + private final String sender; public Match match; - public DefaultListModel wordsValid; + private DefaultListModel wordsValid; public ComputeScore(String sender, DefaultListModel words, Match match){ this.words = words; @@ -33,31 +33,18 @@ public class ComputeScore implements Callable { for (int i = 0; i < words.size(); i++) { if (isValid(words.get(i), match.letters)) { score += words.get(i).length(); - System.out.println(words.get(i) + " is valid!" + " : " + score ); wordsValid.addElement(words.get(i)); } } - - - System.out.println(sender +" totalize SCORE = " + score); match.setScore(sender, score); - for (Pair player : match.playersScore) { - System.out.println(player.getValue()); - - } - System.out.println(score); User u = AccountsService.getInstance().findUser(sender); u.addScore(score); if(match.allPlayersSendedHisScore()) { - match.matchTimeout = false; - System.out.println("MATCH TIMEOUT CANCELLATO"); - match.setUndefinedScorePlayersToZero(); new SendScores(match).call(); - } return score; } @@ -74,7 +61,6 @@ public class ComputeScore implements Callable { if(word.equals("")){ return true; } - if(!isCharacterPresent || wordsValid.indexOf(word)!=-1){ return false; } diff --git a/Server/src/com/texttwist/server/tasks/JoinMatch.java b/Server/src/com/texttwist/server/tasks/JoinMatch.java index 78ad16c..d9c7b36 100644 --- a/Server/src/com/texttwist/server/tasks/JoinMatch.java +++ b/Server/src/com/texttwist/server/tasks/JoinMatch.java @@ -5,7 +5,6 @@ import javafx.util.Pair; import javax.swing.*; import java.nio.channels.SocketChannel; import java.util.concurrent.Callable; -import static com.texttwist.server.services.MessageService.activeMatches; /** * Author: Lorenzo Iovino on 23/06/2017. @@ -24,7 +23,7 @@ public class JoinMatch implements Callable { @Override public Boolean call() throws Exception { - final Match thisMatch = Match.findMatch(activeMatches, this.matchName); + final Match thisMatch = Match.findMatch(Match.activeMatches, this.matchName); if (thisMatch != null) { for (int j = 0; j < thisMatch.playersStatus.size(); j++) { String name = thisMatch.playersStatus.get(j).getKey(); @@ -40,25 +39,12 @@ public class JoinMatch implements Callable { return false; } - - private void printAll(Match match){ - for (int i = 0; i < match.playersStatus.size(); i++) { - - System.out.println(match.playersStatus.get(i).getKey()); - System.out.println(match.playersStatus.get(i).getValue()); - System.out.println(match.playersSocket.get(i).getKey()); - System.out.println(match.playersSocket.get(i).getValue()); - - } - } - private Boolean allJoined(Match match) { for (int i = 0; i < match.playersStatus.size(); i++) { if (match.playersStatus.get(i).getValue() == 0) { return false; } } - match.printAll(); match.joinTimeout = false; return true; } diff --git a/Server/src/com/texttwist/server/tasks/SendInvitations.java b/Server/src/com/texttwist/server/tasks/SendInvitations.java index 7b05d97..768094e 100644 --- a/Server/src/com/texttwist/server/tasks/SendInvitations.java +++ b/Server/src/com/texttwist/server/tasks/SendInvitations.java @@ -21,12 +21,9 @@ public class SendInvitations implements Callable { @Override public Boolean call() throws Exception { try { - System.out.println("INVIA INVITO A" + users); - Server.notificationServer.sendInvitations(sender, users); } catch (Exception e) { - System.out.println("Eccezione" + e); e.printStackTrace(); } diff --git a/Server/src/com/texttwist/server/tasks/SendScores.java b/Server/src/com/texttwist/server/tasks/SendScores.java index 62ec42f..b5383ac 100644 --- a/Server/src/com/texttwist/server/tasks/SendScores.java +++ b/Server/src/com/texttwist/server/tasks/SendScores.java @@ -10,8 +10,6 @@ import java.net.InetAddress; import java.net.MulticastSocket; import java.util.concurrent.Callable; -import static com.texttwist.server.services.MessageService.activeMatches; - /** * Created by loke on 13/07/2017. */ @@ -27,9 +25,7 @@ public class SendScores implements Callable { public Void call() throws Exception { while (true) { - System.out.println("SENDING"); Message msg = new Message("FINALSCORE", "SERVER", "", match.getMatchPlayersScoreAsStringList()); - MulticastSocket multicastSocket = null; try { multicastSocket = new MulticastSocket(match.multicastId); @@ -39,7 +35,7 @@ public class SendScores implements Callable { } catch (IOException e) { e.printStackTrace(); } - activeMatches.remove(Match.findMatchIndex(activeMatches, match.matchCreator)); + Match.activeMatches.remove(Match.findMatchIndex(Match.activeMatches, match.matchCreator)); return null; } } diff --git a/notificationServer.log b/notificationServer.log index b067fe7..1892600 100644 --- a/notificationServer.log +++ b/notificationServer.log @@ -1761,3 +1761,126 @@ LOGGER (Server): Thu Jul 13 23:29:53 CEST 2017 - Invoked login with username=a A LOGGER (Server): Thu Jul 13 23:29:53 CEST 2017 - Login successfull LOGGER (Server): Thu Jul 13 23:29:57 CEST 2017 - Invoked login with username=b AND password=b LOGGER (Server): Thu Jul 13 23:29:57 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:32:24 CEST 2017 - Services starting ... +LOGGER (Server): Thu Jul 13 23:32:25 CEST 2017 - AuthService Service running at 9999 port... +LOGGER (Server): Thu Jul 13 23:32:25 CEST 2017 - GameService Service is running at 10000 port... +LOGGER (Server): Thu Jul 13 23:32:25 CEST 2017 - Services started correctly ... +LOGGER (Server): Thu Jul 13 23:32:37 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 13 23:32:37 CEST 2017 - Login unsuccessfull +LOGGER (Server): Thu Jul 13 23:32:40 CEST 2017 - Invoked register with username=a AND password=a +LOGGER (Server): Thu Jul 13 23:32:40 CEST 2017 - Registration successfull +LOGGER (Server): Thu Jul 13 23:32:42 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 13 23:32:42 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:32:49 CEST 2017 - Invoked register with username=b AND password=b +LOGGER (Server): Thu Jul 13 23:32:49 CEST 2017 - Registration successfull +LOGGER (Server): Thu Jul 13 23:32:51 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 13 23:32:51 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:32:59 CEST 2017 - Invoked register with username=c AND password=c +LOGGER (Server): Thu Jul 13 23:32:59 CEST 2017 - Registration successfull +LOGGER (Server): Thu Jul 13 23:33:01 CEST 2017 - Invoked login with username=c AND password=c +LOGGER (Server): Thu Jul 13 23:33:01 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:33:05 CEST 2017 - Invoked register with username=d AND password=d +LOGGER (Server): Thu Jul 13 23:33:05 CEST 2017 - Registration successfull +LOGGER (Server): Thu Jul 13 23:33:07 CEST 2017 - Invoked login with username=d AND password=d +LOGGER (Server): Thu Jul 13 23:33:07 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:36:00 CEST 2017 - Invoked register with username=e AND password=e +LOGGER (Server): Thu Jul 13 23:36:00 CEST 2017 - Registration successfull +LOGGER (Server): Thu Jul 13 23:36:01 CEST 2017 - Invoked login with username=e AND password=e +LOGGER (Server): Thu Jul 13 23:36:01 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:36:06 CEST 2017 - Invoked register with username=f AND password=f +LOGGER (Server): Thu Jul 13 23:36:06 CEST 2017 - Registration successfull +LOGGER (Server): Thu Jul 13 23:36:07 CEST 2017 - Invoked login with username=f AND password=f +LOGGER (Server): Thu Jul 13 23:36:07 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:36:55 CEST 2017 - Invoked logout with username=e AND token=4fhehlcg3dhur4c4fm32gjeglm +LOGGER (Server): Thu Jul 13 23:36:55 CEST 2017 - Logout successfull +LOGGER (Server): Thu Jul 13 23:36:55 CEST 2017 - Logout successfull (but something gone wrong) +LOGGER (Server): Thu Jul 13 23:36:57 CEST 2017 - Invoked login with username=e AND password=dd +LOGGER (Server): Thu Jul 13 23:36:57 CEST 2017 - Login unsuccessfull +LOGGER (Server): Thu Jul 13 23:37:00 CEST 2017 - Invoked login with username=e AND password=e +LOGGER (Server): Thu Jul 13 23:37:00 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:37:09 CEST 2017 - Invoked logout with username=e AND token=o8eehhsq8og3ct9b6g5lo9k3v9 +LOGGER (Server): Thu Jul 13 23:37:09 CEST 2017 - Logout successfull +LOGGER (Server): Thu Jul 13 23:37:09 CEST 2017 - Logout successfull (but something gone wrong) +LOGGER (Server): Thu Jul 13 23:37:13 CEST 2017 - Invoked login with username=e AND password=fdf +LOGGER (Server): Thu Jul 13 23:37:13 CEST 2017 - Login unsuccessfull +LOGGER (Server): Thu Jul 13 23:37:20 CEST 2017 - Invoked login with username=e AND password=dd +LOGGER (Server): Thu Jul 13 23:37:20 CEST 2017 - Login unsuccessfull +LOGGER (Server): Thu Jul 13 23:37:22 CEST 2017 - Invoked login with username=e AND password=e +LOGGER (Server): Thu Jul 13 23:37:22 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:37:30 CEST 2017 - Invoked logout with username=e AND token=rjtq0cis3fqhdb2c5pipui8nmd +LOGGER (Server): Thu Jul 13 23:37:30 CEST 2017 - Logout successfull +LOGGER (Server): Thu Jul 13 23:37:30 CEST 2017 - Logout successfull (but something gone wrong) +LOGGER (Server): Thu Jul 13 23:37:33 CEST 2017 - Invoked login with username=e AND password=e +LOGGER (Server): Thu Jul 13 23:37:33 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:40:08 CEST 2017 - Services starting ... +LOGGER (Server): Thu Jul 13 23:40:08 CEST 2017 - AuthService Service running at 9999 port... +LOGGER (Server): Thu Jul 13 23:40:09 CEST 2017 - Services started correctly ... +LOGGER (Server): Thu Jul 13 23:40:09 CEST 2017 - GameService Service is running at 10000 port... +LOGGER (Server): Thu Jul 13 23:40:14 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 13 23:40:14 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:40:19 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 13 23:40:19 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:40:37 CEST 2017 - Invoked logout with username=b AND token=68b5nnp61fsopvg2s1826kismv +LOGGER (Server): Thu Jul 13 23:40:37 CEST 2017 - Logout successfull +LOGGER (Server): Thu Jul 13 23:40:37 CEST 2017 - Logout successfull (but something gone wrong) +LOGGER (Server): Thu Jul 13 23:40:39 CEST 2017 - Invoked login with username=b AND password=fd +LOGGER (Server): Thu Jul 13 23:40:39 CEST 2017 - Login unsuccessfull +LOGGER (Server): Thu Jul 13 23:40:41 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 13 23:40:41 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:41:17 CEST 2017 - Services starting ... +LOGGER (Server): Thu Jul 13 23:41:17 CEST 2017 - AuthService Service running at 9999 port... +LOGGER (Server): Thu Jul 13 23:41:17 CEST 2017 - GameService Service is running at 10000 port... +LOGGER (Server): Thu Jul 13 23:41:17 CEST 2017 - Services started correctly ... +LOGGER (Server): Thu Jul 13 23:41:24 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 13 23:41:24 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:41:27 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 13 23:41:27 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:41:45 CEST 2017 - Invoked logout with username=b AND token=vs8ti17hhbdjfsg48elebpa3ld +LOGGER (Server): Thu Jul 13 23:41:45 CEST 2017 - Logout successfull +LOGGER (Server): Thu Jul 13 23:41:45 CEST 2017 - Logout successfull (but something gone wrong) +LOGGER (Server): Thu Jul 13 23:41:47 CEST 2017 - Invoked login with username=b AND password=ds +LOGGER (Server): Thu Jul 13 23:41:47 CEST 2017 - Login unsuccessfull +LOGGER (Server): Thu Jul 13 23:41:49 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 13 23:41:49 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:43:16 CEST 2017 - Services starting ... +LOGGER (Server): Thu Jul 13 23:43:16 CEST 2017 - AuthService Service running at 9999 port... +LOGGER (Server): Thu Jul 13 23:43:16 CEST 2017 - Services started correctly ... +LOGGER (Server): Thu Jul 13 23:43:16 CEST 2017 - GameService Service is running at 10000 port... +LOGGER (Server): Thu Jul 13 23:43:20 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 13 23:43:20 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:44:11 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 13 23:44:11 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:44:22 CEST 2017 - Services starting ... +LOGGER (Server): Thu Jul 13 23:44:22 CEST 2017 - AuthService Service running at 9999 port... +LOGGER (Server): Thu Jul 13 23:44:22 CEST 2017 - Services started correctly ... +LOGGER (Server): Thu Jul 13 23:44:22 CEST 2017 - GameService Service is running at 10000 port... +LOGGER (Server): Thu Jul 13 23:44:29 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 13 23:44:29 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:44:33 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 13 23:44:33 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:59:14 CEST 2017 - Services starting ... +LOGGER (Server): Thu Jul 13 23:59:14 CEST 2017 - AuthService Service running at 9999 port... +LOGGER (Server): Thu Jul 13 23:59:14 CEST 2017 - GameService Service is running at 10000 port... +LOGGER (Server): Thu Jul 13 23:59:14 CEST 2017 - Services started correctly ... +LOGGER (Server): Thu Jul 13 23:59:20 CEST 2017 - Invoked login with username=a AND password=aa +LOGGER (Server): Thu Jul 13 23:59:20 CEST 2017 - Login unsuccessfull +LOGGER (Server): Thu Jul 13 23:59:21 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Thu Jul 13 23:59:21 CEST 2017 - Login successfull +LOGGER (Server): Thu Jul 13 23:59:26 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Thu Jul 13 23:59:26 CEST 2017 - Login successfull +LOGGER (Server): Fri Jul 14 00:00:11 CEST 2017 - Invoked login with username=c AND password=c +LOGGER (Server): Fri Jul 14 00:00:11 CEST 2017 - Login successfull +LOGGER (Server): Fri Jul 14 00:00:17 CEST 2017 - Invoked login with username=d AND password=d +LOGGER (Server): Fri Jul 14 00:00:17 CEST 2017 - Login successfull +LOGGER (Server): Fri Jul 14 00:04:50 CEST 2017 - Services starting ... +LOGGER (Server): Fri Jul 14 00:04:50 CEST 2017 - AuthService Service running at 9999 port... +LOGGER (Server): Fri Jul 14 00:04:50 CEST 2017 - GameService Service is running at 10000 port... +LOGGER (Server): Fri Jul 14 00:04:50 CEST 2017 - Services started correctly ... +LOGGER (Server): Fri Jul 14 00:04:57 CEST 2017 - Invoked login with username=a AND password=a +LOGGER (Server): Fri Jul 14 00:04:57 CEST 2017 - Login successfull +LOGGER (Server): Fri Jul 14 00:05:00 CEST 2017 - Invoked login with username=b AND password=b +LOGGER (Server): Fri Jul 14 00:05:00 CEST 2017 - Login successfull +LOGGER (Server): Fri Jul 14 00:05:27 CEST 2017 - Invoked login with username=c AND password=c +LOGGER (Server): Fri Jul 14 00:05:27 CEST 2017 - Login successfull +LOGGER (Server): Fri Jul 14 00:05:31 CEST 2017 - Invoked login with username=d AND password=d +LOGGER (Server): Fri Jul 14 00:05:31 CEST 2017 - Login successfull