Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8115528

ScheduledService doesn't stop after calling cancel

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • javafx
    • None

      Calling cancel from within an event handler ends up being completely ignored by the ScheduledService, because after the event handlers do their business, it then schedules up the next request. We need to remember when somebody has cancelled, so that on the next iteration we can just stop.

              GetNetworkInterfacesService networkInterfacesService = new GetNetworkInterfacesService();
              networkInterfacesService.setPeriod(Duration.seconds(1));
              networkInterfacesService.setOnSucceeded(event -> {
                  networkInterfacesService.cancel();
              });
              networkInterfacesService.start();

            rbair Richard Bair (Inactive)
            rbair Richard Bair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: