Class FetchThread

java.lang.Object
java.lang.Thread
com.ensea_chatapp_tcp.Client.FetchThread
All Implemented Interfaces:
Runnable

public class FetchThread extends Thread
This is a class to implement a Thread in order to fetch data from the TCP server consistently. This class is a subclass of java.lang.Thread.
  • Constructor Details

    • FetchThread

      public FetchThread(TCPClient tcpClient, DataFetchHandler dataFetchHandler)
      The Constructor of FetchThread class
      Parameters:
      tcpClient - This is the reference to TCPClient class which we want to fetch data from its connection
      dataFetchHandler - This handler function is called when a new data is fetched. It can be used to display the data or other purposes that needs to be done by data
  • Method Details

    • run

      public void run()
      The method run in order to start the FetchThread. This is going to fetch data from server in an infinite loop The dataFetchHandler which is argument of FetchThread will be called when a new data is fetched
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread