How to catch the event license expired in Jira server?

Hi,

I want to catch the event when license expired but somehow it couldn’t
I use class PluginLicenseExpiredEvent.

@EventListener
  public void onPluginLicenseExpiredEvent(PluginLicenseExpiredEvent event) {
    handleInvalidLicense();
  }

But the event only fired when I add a license expired in the license box.

I want to catch an event license expired during the working.
Do you have any suggestion?

Thank you.,