Class GarbageCollector

java.lang.Object
java.lang.Thread
net.bjmsw.hda.vs.helper.GarbageCollector
All Implemented Interfaces:
Runnable

public class GarbageCollector extends Thread
The GarbageCollector class provides a garbage collection mechanism for the server.
  • Field Details

    • TICK_RATE

      private static final int TICK_RATE
      The TICK_RATE variable represents the rate at which the garbage collector runs. It is set to 5000 milliseconds, which is equivalent to 5 seconds.

      This variable is used in the GarbageCollector class to control the frequency of garbage collection ticks.

      See Also:
    • USER_TIMEOUT

      private static final int USER_TIMEOUT
      The USER_TIMEOUT variable represents the amount of time, in seconds, after which a user session will be considered inactive and removed. By default, it is set to 120 seconds, which is equivalent to 2 minutes.

      This variable is used in the GarbageCollector class to determine if a user has exceeded the allowed timeout period and needs to be removed from the system.

      See Also:
  • Constructor Details

    • GarbageCollector

      public GarbageCollector()
  • Method Details

    • checkUserTimeout

      private void checkUserTimeout()
      The checkUserTimeout method checks for inactive user sessions and removes them from the system.
    • run

      public void run()
      Runs the garbage collector thread. This method runs in an infinite loop and performs garbage collection ticks at a regular rate. It checks for inactive user sessions and removes them from the system.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread