This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

TimerTask Execution  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have one timer task execution method. I am getting last scheduled Execution Time using this scheduledExecutionTime(). If my application crashes by any chance, Can i able to get this last scheduled Execution Time? Please give me some idea regarding this.
private FetchTask() {
Timer timer = new Timer();
TimerTask task = new TimerTask() {
public void run() {
time = scheduledExecutionTime();
getData();
}
};

timer.scheduleAtFixedRate(task, 0, 3000);
}

I am calling this getData method for each timer task.
If the application gone down, i need to get the last scheduled time and get the data.
Please help me regarding this.

Thanks,
Palmari
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the application crashes, anything that you didn't write to an external store, like a database or a file, is gone. So I'm guessing the short answer to your question is "no".

Let's dig a little deeper into what you're doing. If the application crashes, what would you like to have happen when you restart it?
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!