Console.println("Sending message to client #" + i + "...", Console.MSG_DEBUG);
Console.println("Sending message", Console.MSG_NORMAL); try { Console.println("User " + ((QuizClientServices) this.servant.getConnectedClients().elementAt(i)).getNickname(), Console.MSG_DEBUG); } catch (RemoteException e1) { e1.printStackTrace(); } Console.println("Message: "+newMsg.getBody(), Console.MSG_DEBUG);
	public void run()	{		while(!quit)		{			// Sending the state checker thread to sleep for 500ms			try {				Thread.sleep(100);			} catch (InterruptedException e)			{				System.err.println(e.getMessage());				e.printStackTrace();			}									// Checking if we have to start a new quiz			if(this.servant.getNumQuizClients() > 0 && !this.servant.isActiveQuiz())			{				Console.println("StateChecker: Starting a new quiz", Console.MSG_DEBUG);				this.servant.setActiveQuiz(true);				game = new Quiz(this.servant.getQuestionCycle());				game.setServant(this.servant);				game.setClients(this.servant.getQuizClients());				game.setQuestions(this.servant.getQuestions());				game.start();			}						// Checking if we have to stop a running quiz			else if(this.servant.getNumQuizClients() == 0 && this.servant.isActiveQuiz())			{				game.setQuit(true);				this.servant.stopGame();			}						// Checking if there are messages to send			if(this.servant.getMessages().size()>0)			{				for(int j=0; j<this.servant.getMessages().size(); j++)				{					ChatMessage newMsg = (ChatMessage) this.servant.getMessages().elementAt(j);										// DEBUG: Constructing a new message without sender, to see if that's the problem...					//ChatMessage msg =  new ChatMessage(newMsg.getBody());										for(int i=0; i<this.servant.getConnectedClients().size(); i++)					{						Console.println("Sending message to client #" + i + "...", Console.MSG_DEBUG);						QuizClientServices client = (QuizClientServices) this.servant.getConnectedClients().elementAt(i);						try{							client.display(newMsg);						} catch(RemoteException e)						{							e.printStackTrace();						}					}				}								this.servant.resetMessages();			}		}				Console.println("Servant StateChecker quitting", Console.MSG_DEBUG);		return;	}