Class ClientHandler

java.lang.Object
it.polimi.ingsw.server.ClientHandler
All Implemented Interfaces:
java.lang.Runnable

public class ClientHandler
extends java.lang.Object
implements java.lang.Runnable
Handles all interactions between the server and a client.
  • Constructor Summary

    Constructors 
    Constructor Description
    ClientHandler​(VirtualView client)  
  • Method Summary

    Modifier and Type Method Description
    protected java.util.concurrent.SynchronousQueue<java.lang.Object> getObjectsQueue()  
    protected void kill()  
    void run()
    While the connection is on, it allows to receive and read the Objects coming from the client-side.
    protected void sendMessage​(Message message)
    Sends message through network to client associated to this ClientHandler instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • run

      public void run()
      While the connection is on, it allows to receive and read the Objects coming from the client-side. Can understand if the message was a ping from the client or a different one.
      Specified by:
      run in interface java.lang.Runnable
    • sendMessage

      protected void sendMessage​(Message message)
      Sends message through network to client associated to this ClientHandler instance.
      Parameters:
      message - message to send
    • kill

      protected void kill()
    • getObjectsQueue

      protected java.util.concurrent.SynchronousQueue<java.lang.Object> getObjectsQueue()