UPPPP FINISH
This commit is contained in:
parent
e1622dfaa1
commit
ab307b0a97
24 changed files with 857 additions and 526 deletions
1083
.idea/workspace.xml
generated
1083
.idea/workspace.xml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -27,6 +27,7 @@ public class GameService {
|
||||||
public DefaultListModel<Pair<String,Integer>> globalRanks = new DefaultListModel<>();
|
public DefaultListModel<Pair<String,Integer>> globalRanks = new DefaultListModel<>();
|
||||||
public DefaultListModel<Pair<String,Integer>> ranks = new DefaultListModel<>();
|
public DefaultListModel<Pair<String,Integer>> ranks = new DefaultListModel<>();
|
||||||
private Boolean gameIsStarted = false;
|
private Boolean gameIsStarted = false;
|
||||||
|
public Boolean isWaiting = false;
|
||||||
|
|
||||||
private void addToPendingList(String username) throws IOException {
|
private void addToPendingList(String username) throws IOException {
|
||||||
pendingList.addElement(username);
|
pendingList.addElement(username);
|
||||||
|
|
@ -44,7 +45,7 @@ public class GameService {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!App.gameService.gameIsStarted) {
|
if(!App.gameService.gameIsStarted && !App.gameService.isWaiting) {
|
||||||
//Show invite popup
|
//Show invite popup
|
||||||
new TTDialog("success", "New invite from: " + userName + "!",
|
new TTDialog("success", "New invite from: " + userName + "!",
|
||||||
new Callable() {
|
new Callable() {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ public class WaitForPlayers extends SwingWorker<Void,Void> {
|
||||||
@Override
|
@Override
|
||||||
public Void doInBackground() {
|
public Void doInBackground() {
|
||||||
try {
|
try {
|
||||||
|
App.gameService.isWaiting = true;
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(1024);
|
ByteBuffer buffer = ByteBuffer.allocate(1024);
|
||||||
TTDialog loading = new TTDialog("alert", "Waiting for users joins",null,null);
|
TTDialog loading = new TTDialog("alert", "Waiting for users joins",null,null);
|
||||||
buffer.flip();
|
buffer.flip();
|
||||||
|
|
@ -42,6 +43,7 @@ public class WaitForPlayers extends SwingWorker<Void,Void> {
|
||||||
Message msg = Message.toMessage(line);
|
Message msg = Message.toMessage(line);
|
||||||
if (msg.message.equals("JOIN_TIMEOUT")) {
|
if (msg.message.equals("JOIN_TIMEOUT")) {
|
||||||
loading.dispose();
|
loading.dispose();
|
||||||
|
App.gameService.isWaiting = false;
|
||||||
joinTimeout = true;
|
joinTimeout = true;
|
||||||
|
|
||||||
new TTDialog("alert", "TIMEOUT!",
|
new TTDialog("alert", "TIMEOUT!",
|
||||||
|
|
@ -58,6 +60,7 @@ public class WaitForPlayers extends SwingWorker<Void,Void> {
|
||||||
if (msg.message.equals("MATCH_NOT_AVAILABLE")) {
|
if (msg.message.equals("MATCH_NOT_AVAILABLE")) {
|
||||||
loading.dispose();
|
loading.dispose();
|
||||||
joinTimeout = true;
|
joinTimeout = true;
|
||||||
|
App.gameService.isWaiting = false;
|
||||||
|
|
||||||
new TTDialog("alert", "THE GAME IS NOT MORE AVAILABLE!",
|
new TTDialog("alert", "THE GAME IS NOT MORE AVAILABLE!",
|
||||||
new Callable() {
|
new Callable() {
|
||||||
|
|
@ -72,6 +75,7 @@ public class WaitForPlayers extends SwingWorker<Void,Void> {
|
||||||
|
|
||||||
if (msg.message.equals("GAME_STARTED")) {
|
if (msg.message.equals("GAME_STARTED")) {
|
||||||
loading.dispose();
|
loading.dispose();
|
||||||
|
App.gameService.isWaiting = false;
|
||||||
|
|
||||||
if(msg.data !=null ) {
|
if(msg.data !=null ) {
|
||||||
DefaultListModel<String> data = msg.data;
|
DefaultListModel<String> data = msg.data;
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ public class Config {
|
||||||
|
|
||||||
public static String RedisServerURI = "localhost";
|
public static String RedisServerURI = "localhost";
|
||||||
|
|
||||||
public static int gameTimeout = 10; //2 minuti in sec
|
public static int gameTimeout = 120; //2 minuti in sec
|
||||||
public static int joinMatchTimeout = 5000; //7 minuti in millisec
|
public static int joinMatchTimeout = 7*1000*60; //7 minuti in millisec
|
||||||
public static int sendWordsTimeout = 3000; //5 minuti in millisec
|
public static int sendWordsTimeout = 5*1000*60; //5 minuti in millisec
|
||||||
|
|
||||||
public static String getAuthServerURI(){
|
public static String getAuthServerURI(){
|
||||||
return "rmi://".concat(AuthServerURI).concat(":").concat(AuthServerPort.toString());
|
return "rmi://".concat(AuthServerURI).concat(":").concat(AuthServerPort.toString());
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ public class Server {
|
||||||
private void startAuthService(){
|
private void startAuthService(){
|
||||||
//Starting Auth service based on RMI
|
//Starting Auth service based on RMI
|
||||||
try {
|
try {
|
||||||
auth = new AuthService(Config.AuthServerPort);
|
auth = new AuthService();
|
||||||
Registry authRegistry = LocateRegistry.createRegistry(auth.serverPort);
|
Registry authRegistry = LocateRegistry.createRegistry(Config.AuthServerPort);
|
||||||
authRegistry.bind("auth", auth);
|
authRegistry.bind("auth", auth);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Server.logger.write("SERVER: RMI authentication service error (Remote exception)");
|
Server.logger.write("SERVER: RMI authentication service error (Remote exception)");
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import java.util.concurrent.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 18/06/2017.
|
* Author: Lorenzo Iovino on 18/06/2017.
|
||||||
* Description: Proxy Dispatcher
|
* Description: Message Dispatcher
|
||||||
* */
|
* */
|
||||||
public class MessageDispatcher implements Callable<Boolean> {
|
public class MessageDispatcher implements Callable<Boolean> {
|
||||||
private final ExecutorService threadPool = Executors.newCachedThreadPool();
|
private final ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.texttwist.server.services;
|
package com.texttwist.server.services;
|
||||||
|
|
||||||
import com.texttwist.server.Server;
|
import com.texttwist.server.Server;
|
||||||
|
import constants.Config;
|
||||||
import interfaces.IAuth;
|
import interfaces.IAuth;
|
||||||
import interfaces.INotificationClient;
|
import interfaces.INotificationClient;
|
||||||
import models.Response;
|
import models.Response;
|
||||||
|
|
@ -19,12 +20,9 @@ import static com.texttwist.server.Server.notificationServer;
|
||||||
public class AuthService extends UnicastRemoteObject implements IAuth {
|
public class AuthService extends UnicastRemoteObject implements IAuth {
|
||||||
|
|
||||||
private SecureRandom random = new SecureRandom();
|
private SecureRandom random = new SecureRandom();
|
||||||
public int serverPort = 9999;
|
|
||||||
|
|
||||||
|
public AuthService() throws RemoteException{
|
||||||
public AuthService(int serverPort) throws RemoteException{
|
Server.logger.write("AuthService Service running at "+ Config.AuthServerPort+" port...");
|
||||||
this.serverPort=serverPort;
|
|
||||||
Server.logger.write("AuthService Service running at "+serverPort+" port...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.texttwist.server.services;
|
package com.texttwist.server.services;
|
||||||
|
|
||||||
|
import com.texttwist.server.Server;
|
||||||
import models.User;
|
import models.User;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
|
|
||||||
|
|
@ -16,6 +17,11 @@ import static com.texttwist.server.Server.jedisPool;
|
||||||
*/
|
*/
|
||||||
public class JedisService {
|
public class JedisService {
|
||||||
|
|
||||||
|
|
||||||
|
JedisService(){
|
||||||
|
Server.logger.write("Jedis Service running on localhost...");
|
||||||
|
}
|
||||||
|
|
||||||
/** Read the object from Base64 string. */
|
/** Read the object from Base64 string. */
|
||||||
public static Object fromString(String s) throws IOException, ClassNotFoundException {
|
public static Object fromString(String s) throws IOException, ClassNotFoundException {
|
||||||
byte [] data = Base64.getDecoder().decode(s);
|
byte [] data = Base64.getDecoder().decode(s);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.texttwist.server.services;
|
package com.texttwist.server.services;
|
||||||
|
|
||||||
|
import com.texttwist.server.Server;
|
||||||
|
import constants.Config;
|
||||||
import interfaces.INotificationClient;
|
import interfaces.INotificationClient;
|
||||||
import interfaces.INotificationServer;
|
import interfaces.INotificationServer;
|
||||||
|
|
||||||
|
|
@ -12,13 +14,14 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 19/06/2017.
|
* Author: Lorenzo Iovino on 19/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Notification Service
|
||||||
*/
|
*/
|
||||||
public class NotificationService implements INotificationServer {
|
public class NotificationService implements INotificationServer {
|
||||||
|
|
||||||
private List<INotificationClient> clients;
|
private List<INotificationClient> clients;
|
||||||
public NotificationService() throws RemoteException {
|
public NotificationService() throws RemoteException {
|
||||||
super();
|
super();
|
||||||
|
Server.logger.write("Notification Service running at "+ Config.NotificationServerPort+" port...");
|
||||||
clients = new ArrayList<>();
|
clients = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,29 @@
|
||||||
package com.texttwist.server.services;
|
package com.texttwist.server.services;
|
||||||
|
|
||||||
|
import com.texttwist.server.Server;
|
||||||
import com.texttwist.server.models.Match;
|
import com.texttwist.server.models.Match;
|
||||||
import com.texttwist.server.tasks.ComputeScore;
|
import com.texttwist.server.tasks.ComputeScore;
|
||||||
import com.texttwist.server.tasks.TokenInvalid;
|
|
||||||
import constants.Config;
|
import constants.Config;
|
||||||
import models.Message;
|
import models.Message;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.channels.DatagramChannel;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 27/06/2017.
|
* Author: Lorenzo Iovino on 27/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Receive Words Service
|
||||||
*/
|
*/
|
||||||
public class ReceiveWordsService implements Runnable {
|
public class ReceiveWordsService implements Runnable {
|
||||||
|
|
||||||
private ExecutorService threadPool = Executors.newCachedThreadPool();
|
private ExecutorService threadPool = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
public ReceiveWordsService() {
|
public ReceiveWordsService() {
|
||||||
|
Server.logger.write("ReceiveWords Service running at "+Config.WordsReceiverServerPort+" port...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(){
|
public void run(){
|
||||||
|
|
||||||
|
|
||||||
Message msg;
|
Message msg;
|
||||||
DatagramSocket s = null;
|
DatagramSocket s = null;
|
||||||
|
|
||||||
|
|
@ -40,7 +35,6 @@ public class ReceiveWordsService implements Runnable {
|
||||||
DatagramPacket packet;
|
DatagramPacket packet;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
|
|
||||||
packet = new DatagramPacket(buf, buf.length);
|
packet = new DatagramPacket(buf, buf.length);
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,6 @@ public class SessionsService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SessionsService(){}
|
|
||||||
|
|
||||||
public boolean add(String userName, String token) {
|
public boolean add(String userName, String token) {
|
||||||
remove(userName);
|
remove(userName);
|
||||||
return sessions.add(new Session(new User(userName,"",0), token));
|
return sessions.add(new Session(new User(userName,"",0), token));
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
package com.texttwist.server.tasks;
|
package com.texttwist.server.tasks;
|
||||||
|
|
||||||
import com.texttwist.server.services.SessionsService;
|
import com.texttwist.server.services.SessionsService;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 19/06/2017.
|
* Author: Lorenzo Iovino on 19/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Task: Check Online Users
|
||||||
*/
|
*/
|
||||||
public class CheckOnlineUsers implements Callable<Boolean> {
|
public class CheckOnlineUsers implements Callable<Boolean> {
|
||||||
private final DefaultListModel<String> users;
|
private final DefaultListModel<String> users;
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,10 @@ import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 28/06/2017.
|
* Author: Lorenzo Iovino on 28/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Task: Compute Highscores
|
||||||
*/
|
*/
|
||||||
public class ComputeHighscores implements Callable<DefaultListModel<String>> {
|
public class ComputeHighscores implements Callable<DefaultListModel<String>> {
|
||||||
|
|
||||||
public ComputeHighscores(){}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DefaultListModel<String> call() throws Exception {
|
public DefaultListModel<String> call() throws Exception {
|
||||||
DefaultListModel<String> l = new DefaultListModel<>();
|
DefaultListModel<String> l = new DefaultListModel<>();
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,22 @@
|
||||||
package com.texttwist.server.tasks;
|
package com.texttwist.server.tasks;
|
||||||
|
|
||||||
import com.texttwist.server.services.AccountsService;
|
import com.texttwist.server.services.AccountsService;
|
||||||
import com.texttwist.server.models.Dictionary;
|
import com.texttwist.server.models.Dictionary;
|
||||||
import com.texttwist.server.models.Match;
|
import com.texttwist.server.models.Match;
|
||||||
import javafx.util.Pair;
|
|
||||||
import models.User;
|
import models.User;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 27/06/2017.
|
* Author: Lorenzo Iovino on 27/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Task: Ccmpute Score
|
||||||
*/
|
*/
|
||||||
public class ComputeScore implements Callable<Integer> {
|
public class ComputeScore implements Callable<Integer> {
|
||||||
|
|
||||||
private DefaultListModel<String> words;
|
private DefaultListModel<String> words;
|
||||||
private final String sender;
|
private final String sender;
|
||||||
public Match match;
|
public Match match;
|
||||||
private DefaultListModel<String> wordsValid;
|
private DefaultListModel<String> wordsValid = new DefaultListModel<>();
|
||||||
|
|
||||||
public ComputeScore(String sender, DefaultListModel<String> words, Match match){
|
public ComputeScore(String sender, DefaultListModel<String> words, Match match){
|
||||||
this.words = words;
|
this.words = words;
|
||||||
|
|
@ -27,9 +26,7 @@ public class ComputeScore implements Callable<Integer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer call() throws Exception {
|
public Integer call() throws Exception {
|
||||||
wordsValid = new DefaultListModel<>();
|
|
||||||
Integer score = 0;
|
Integer score = 0;
|
||||||
|
|
||||||
for (int i = 0; i < words.size(); i++) {
|
for (int i = 0; i < words.size(); i++) {
|
||||||
if (isValid(words.get(i), match.letters)) {
|
if (isValid(words.get(i), match.letters)) {
|
||||||
score += words.get(i).length();
|
score += words.get(i).length();
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,18 @@
|
||||||
package com.texttwist.server.tasks;
|
package com.texttwist.server.tasks;
|
||||||
|
|
||||||
import com.texttwist.server.services.MessageService;
|
import com.texttwist.server.services.MessageService;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 25/06/2017.
|
* Author: Lorenzo Iovino on 25/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Task: Generate Letters
|
||||||
*/
|
*/
|
||||||
public class GenerateLetters implements Callable<DefaultListModel<String>> {
|
public class GenerateLetters implements Callable<DefaultListModel<String>> {
|
||||||
|
|
||||||
|
|
||||||
public GenerateLetters(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DefaultListModel<String> call() throws Exception {
|
public DefaultListModel<String> call() throws Exception {
|
||||||
DefaultListModel<String> l = new DefaultListModel<String>();
|
DefaultListModel<String> l = new DefaultListModel<>();
|
||||||
|
|
||||||
String word = MessageService.dict.getRandomWord(6, 7);
|
String word = MessageService.dict.getRandomWord(6, 7);
|
||||||
for (int i = 0;i < word.length(); i++){
|
for (int i = 0;i < word.length(); i++){
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@ import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 23/06/2017.
|
* Author: Lorenzo Iovino on 23/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Task: Join Match
|
||||||
*/
|
*/
|
||||||
public class JoinMatch implements Callable<Boolean> {
|
public class JoinMatch implements Callable<Boolean> {
|
||||||
public final String matchName;
|
private final String matchName;
|
||||||
public final String playerName;
|
private final String playerName;
|
||||||
public final SocketChannel socketChannel;
|
private final SocketChannel socketChannel;
|
||||||
|
|
||||||
public JoinMatch(String playerName, DefaultListModel<String> matchName, SocketChannel socketChannel) {
|
public JoinMatch(String playerName, DefaultListModel<String> matchName, SocketChannel socketChannel) {
|
||||||
this.playerName = playerName;
|
this.playerName = playerName;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
package com.texttwist.server.tasks;
|
package com.texttwist.server.tasks;
|
||||||
import com.texttwist.server.models.Match;
|
import com.texttwist.server.models.Match;
|
||||||
|
import constants.Config;
|
||||||
|
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by loke on 23/06/2017.
|
* Author: Lorenzo Iovino on 23/06/2017.
|
||||||
|
* Description: Task: Join Timeout
|
||||||
*/
|
*/
|
||||||
public class JoinTimeout implements Callable<Boolean> {
|
public class JoinTimeout implements Callable<Boolean> {
|
||||||
|
|
||||||
|
|
@ -11,14 +14,13 @@ public class JoinTimeout implements Callable<Boolean> {
|
||||||
|
|
||||||
public JoinTimeout(Match match) {
|
public JoinTimeout(Match match) {
|
||||||
this.match = match;
|
this.match = match;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean call() throws Exception {
|
public Boolean call() throws Exception {
|
||||||
try {
|
try {
|
||||||
match.joinTimeout = true;
|
match.joinTimeout = true;
|
||||||
Thread.currentThread().sleep(5000);
|
Thread.currentThread().sleep(Config.joinMatchTimeout);
|
||||||
|
|
||||||
if(match.joinTimeout) {
|
if(match.joinTimeout) {
|
||||||
match.joinTimeout = false;
|
match.joinTimeout = false;
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,11 @@ package com.texttwist.server.tasks;
|
||||||
|
|
||||||
import com.texttwist.server.models.Match;
|
import com.texttwist.server.models.Match;
|
||||||
import constants.Config;
|
import constants.Config;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 27/06/2017.
|
* Author: Lorenzo Iovino on 27/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Task: Match Timeout
|
||||||
*/
|
*/
|
||||||
public class MatchTimeout implements Callable<Boolean> {
|
public class MatchTimeout implements Callable<Boolean> {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
package com.texttwist.server.tasks;
|
package com.texttwist.server.tasks;
|
||||||
|
|
||||||
import com.texttwist.server.Server;
|
import com.texttwist.server.Server;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 19/06/2017.
|
* Author: Lorenzo Iovino on 19/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Task: Send Invitations
|
||||||
*/
|
*/
|
||||||
public class SendInvitations implements Callable<Boolean> {
|
public class SendInvitations implements Callable<Boolean> {
|
||||||
private DefaultListModel<String> users;
|
private DefaultListModel<String> users;
|
||||||
|
|
@ -22,11 +21,9 @@ public class SendInvitations implements Callable<Boolean> {
|
||||||
public Boolean call() throws Exception {
|
public Boolean call() throws Exception {
|
||||||
try {
|
try {
|
||||||
Server.notificationServer.sendInvitations(sender, users);
|
Server.notificationServer.sendInvitations(sender, users);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,21 @@ package com.texttwist.server.tasks;
|
||||||
|
|
||||||
import com.texttwist.server.models.Match;
|
import com.texttwist.server.models.Match;
|
||||||
import models.Message;
|
import models.Message;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.channels.SocketChannel;
|
import java.nio.channels.SocketChannel;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 27/06/2017.
|
* Author: Lorenzo Iovino on 27/06/2017.
|
||||||
* Description: Jedis Service
|
* Description: Task: Send Message To All Players
|
||||||
*/
|
*/
|
||||||
public class SendMessageToAllPlayers implements Callable<Boolean> {
|
public class SendMessageToAllPlayers implements Callable<Boolean> {
|
||||||
|
|
||||||
|
|
||||||
public final Match match;
|
public final Match match;
|
||||||
public final Message message;
|
private final Message message;
|
||||||
public SocketChannel socketChannel;
|
private SocketChannel socketChannel;
|
||||||
|
|
||||||
public SendMessageToAllPlayers(Match match, Message message, SocketChannel socketChannel){
|
public SendMessageToAllPlayers(Match match, Message message, SocketChannel socketChannel){
|
||||||
this.match = match;
|
this.match = match;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
|
@ -37,10 +36,8 @@ public class SendMessageToAllPlayers implements Callable<Boolean> {
|
||||||
buffer = ByteBuffer.wrap(byteMessage);
|
buffer = ByteBuffer.wrap(byteMessage);
|
||||||
socketChannel.write(buffer);
|
socketChannel.write(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ import java.net.MulticastSocket;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by loke on 13/07/2017.
|
* Author: Lorenzo Iovino on 13/07/2017.
|
||||||
|
* Description: Task: Send Scores
|
||||||
*/
|
*/
|
||||||
public class SendScores implements Callable<Void> {
|
public class SendScores implements Callable<Void> {
|
||||||
|
|
||||||
|
|
@ -24,7 +25,6 @@ public class SendScores implements Callable<Void> {
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
|
|
||||||
while (true) {
|
|
||||||
Message msg = new Message("FINALSCORE", "SERVER", "", match.getMatchPlayersScoreAsStringList());
|
Message msg = new Message("FINALSCORE", "SERVER", "", match.getMatchPlayersScoreAsStringList());
|
||||||
MulticastSocket multicastSocket = null;
|
MulticastSocket multicastSocket = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -39,4 +39,3 @@ public class SendScores implements Callable<Void> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: Lorenzo Iovino on 11/07/2017.
|
* Author: Lorenzo Iovino on 11/07/2017.
|
||||||
* Description: Task: Token Invalid Service
|
* Description: Task: Token Invalid
|
||||||
*/
|
*/
|
||||||
public class TokenInvalid implements Callable<Boolean> {
|
public class TokenInvalid implements Callable<Boolean> {
|
||||||
private String sender;
|
private String sender;
|
||||||
|
|
|
||||||
|
|
@ -1884,3 +1884,105 @@ LOGGER (Server): Fri Jul 14 00:05:27 CEST 2017 - Invoked login with username=c A
|
||||||
LOGGER (Server): Fri Jul 14 00:05:27 CEST 2017 - Login successfull
|
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 - Invoked login with username=d AND password=d
|
||||||
LOGGER (Server): Fri Jul 14 00:05:31 CEST 2017 - Login successfull
|
LOGGER (Server): Fri Jul 14 00:05:31 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:07:15 CEST 2017 - Services starting ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:07:15 CEST 2017 - AuthService Service running at 9999 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:07:15 CEST 2017 - GameService Service is running at 10000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:07:15 CEST 2017 - Services started correctly ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:10:48 CEST 2017 - Services starting ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:10:48 CEST 2017 - AuthService Service running at 9999 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:10:48 CEST 2017 - GameService Service is running at 10000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:10:48 CEST 2017 - ReceiveWords Service running at 10001 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:10:48 CEST 2017 - Notification Service running at 20000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:10:48 CEST 2017 - Services started correctly ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:10:59 CEST 2017 - Invoked login with username=a AND password=a
|
||||||
|
LOGGER (Server): Fri Jul 14 00:10:59 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:11:02 CEST 2017 - Invoked login with username=b AND password=b
|
||||||
|
LOGGER (Server): Fri Jul 14 00:11:02 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:11:25 CEST 2017 - Invoked login with username=c AND password=c
|
||||||
|
LOGGER (Server): Fri Jul 14 00:11:25 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:11:28 CEST 2017 - Invoked login with username=d AND password=d
|
||||||
|
LOGGER (Server): Fri Jul 14 00:11:28 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:37 CEST 2017 - Services starting ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:37 CEST 2017 - AuthService Service running at 9999 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:38 CEST 2017 - GameService Service is running at 10000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:38 CEST 2017 - ReceiveWords Service running at 10001 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:38 CEST 2017 - Notification Service running at 20000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:38 CEST 2017 - Services started correctly ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:42 CEST 2017 - Invoked login with username=a AND password=a
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:42 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:48 CEST 2017 - Invoked login with username=b AND password=b
|
||||||
|
LOGGER (Server): Fri Jul 14 00:13:48 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:14:10 CEST 2017 - Invoked login with username=c AND password=c
|
||||||
|
LOGGER (Server): Fri Jul 14 00:14:10 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:14:14 CEST 2017 - Invoked login with username=d AND password=d
|
||||||
|
LOGGER (Server): Fri Jul 14 00:14:14 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:35 CEST 2017 - Services starting ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:35 CEST 2017 - AuthService Service running at 9999 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:35 CEST 2017 - GameService Service is running at 10000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:35 CEST 2017 - ReceiveWords Service running at 10001 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:35 CEST 2017 - Notification Service running at 20000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:35 CEST 2017 - Services started correctly ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:47 CEST 2017 - Invoked login with username=a AND password=a
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:47 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:56 CEST 2017 - Invoked login with username=b AND password=b
|
||||||
|
LOGGER (Server): Fri Jul 14 00:21:56 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:22:00 CEST 2017 - Invoked login with username=c AND password=c
|
||||||
|
LOGGER (Server): Fri Jul 14 00:22:00 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:22:03 CEST 2017 - Invoked login with username=d AND password=d
|
||||||
|
LOGGER (Server): Fri Jul 14 00:22:03 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:23:15 CEST 2017 - Invoked login with username=e AND password=e
|
||||||
|
LOGGER (Server): Fri Jul 14 00:23:15 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:23:19 CEST 2017 - Invoked login with username=f AND password=f
|
||||||
|
LOGGER (Server): Fri Jul 14 00:23:19 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:05 CEST 2017 - Services starting ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:05 CEST 2017 - AuthService Service running at 9999 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:05 CEST 2017 - GameService Service is running at 10000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:05 CEST 2017 - ReceiveWords Service running at 10001 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:05 CEST 2017 - Notification Service running at 20000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:05 CEST 2017 - Services started correctly ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:11 CEST 2017 - Invoked login with username=a AND password=a
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:11 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:14 CEST 2017 - Invoked login with username=b AND password=b
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:14 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:24 CEST 2017 - Invoked login with username=c AND password=c
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:24 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:31 CEST 2017 - Invoked login with username=d AND password=d
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:31 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:59 CEST 2017 - Services starting ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:59 CEST 2017 - AuthService Service running at 9999 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:59 CEST 2017 - GameService Service is running at 10000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:59 CEST 2017 - ReceiveWords Service running at 10001 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:59 CEST 2017 - Notification Service running at 20000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:25:59 CEST 2017 - Services started correctly ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:26:03 CEST 2017 - Invoked login with username=a AND password=a
|
||||||
|
LOGGER (Server): Fri Jul 14 00:26:03 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:26:06 CEST 2017 - Invoked login with username=b AND password=b
|
||||||
|
LOGGER (Server): Fri Jul 14 00:26:06 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:26:15 CEST 2017 - Invoked login with username=c AND password=c
|
||||||
|
LOGGER (Server): Fri Jul 14 00:26:15 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:01 CEST 2017 - Services starting ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:01 CEST 2017 - AuthService Service running at 9999 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:01 CEST 2017 - GameService Service is running at 10000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:01 CEST 2017 - ReceiveWords Service running at 10001 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:01 CEST 2017 - Notification Service running at 20000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:01 CEST 2017 - Services started correctly ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:05 CEST 2017 - Invoked login with username=a AND password=a
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:05 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:08 CEST 2017 - Invoked login with username=b AND password=b
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:08 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:12 CEST 2017 - Invoked login with username=c AND password=c
|
||||||
|
LOGGER (Server): Fri Jul 14 00:29:12 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:04 CEST 2017 - Services starting ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:04 CEST 2017 - AuthService Service running at 9999 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:04 CEST 2017 - GameService Service is running at 10000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:04 CEST 2017 - ReceiveWords Service running at 10001 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:04 CEST 2017 - Notification Service running at 20000 port...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:04 CEST 2017 - Services started correctly ...
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:11 CEST 2017 - Invoked login with username=a AND password=a
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:11 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:14 CEST 2017 - Invoked login with username=b AND password=b
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:14 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:17 CEST 2017 - Invoked login with username=c AND password=c
|
||||||
|
LOGGER (Server): Fri Jul 14 00:34:17 CEST 2017 - Login successfull
|
||||||
|
LOGGER (Server): Fri Jul 14 00:39:01 CEST 2017 - Invoked login with username=d AND password=d
|
||||||
|
LOGGER (Server): Fri Jul 14 00:39:01 CEST 2017 - Login successfull
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue