Interface TimerListener


public interface TimerListener
Interface for receiving timer expiration notifications.

TimerListener defines a callback interface for objects that need to be notified when a SimpleTimer expires. Implementations of this interface can be registered with a SimpleTimer to receive notifications with the timer's identifier.

Usage:


 SimpleTimer timer = new SimpleTimer("refresh", 5000);
 timer.addListener(id -> {
     System.out.println("Timer expired: " + id);
     // Perform refresh logic
 });
 timer.start();
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when the associated timer expires.
  • Method Details

    • onTimerExpire

      void onTimerExpire(String id)
      Called when the associated timer expires.
      Parameters:
      id - The identifier of the timer that expired, or null if no ID was set.