Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Singleton in SWING

 
Gavin Bong
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a singleton that generates monotonically increasing ids for
my SWING app. Although the singleton will be unloaded when the SWING app terminates; I suspect that the app will be running for like 8 hours a day. Is there a way to replace the singleton ?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Replace it why?
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your singleton will of course be unloaded once your application is terminated and exit JVM. Are you saying you want the id to keep increment even after close and restart of your application?
In that case, I guess you can serialized your counter class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic