I have found a solution https://stackoverflow.com/a/2759040/4730051
But it means that the task will be canceled not after the task is started execution and a minute is exceeded, but after canceller.schedule(...)
is called + 1 min. So, how to adapt it for my case?
Where cancelled is
ScheduledExecutorService canceller = Executors.newSingleThreadScheduledExecutor();