Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Setting time out for registry

Posted on 2006-07-02
5
Medium Priority
?
293 Views
Last Modified: 2010-04-17
I have created a registry item in my java application. I want it to be removed after a specified time interval. It should be removed when if the program is not running also. Also it should be removed when the application is open and system got restarted.

How can I set the timeout??
0
Comment
Question by:sree032397
  • 2
3 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 1000 total points
ID: 17030269
There is no capability in either the registry or in Windows to do housekeeping for registry items.  That means that you will need to perform any housekeeping yourself in your Java application.  While that is simple to do when your application is running, it's not possible to do when it's not.

The only solution to this that I can think of is to scehdule a periodic task to run your application (or a application that only checks on this situation) at certain intervals of your choosing.  Alternatively, you could write a SERVICE that runs all the time and simply checks the registry entries you are interested in and does the right thing.
0
 
LVL 3

Assisted Solution

by:Andre_Tertling
Andre_Tertling earned 1000 total points
ID: 17035719
Creating a service for this task seems a bit oversized (just my two cents). It certainly is a solution but it costs some effort to design a nicely (and properly) working service (and it can't be done in Java, I guess). It's probably easier to make up some small maintainer application that gets added to the system scheduler (like suggested by jhance). That consumes less system resources (I still vote for sensible programming and resource usage in this era of more and more bloatware) and it is easier to maintain for the user.
0
 
LVL 3

Expert Comment

by:Andre_Tertling
ID: 17035735
Doh, clicked on submit too early.
Of course you can use the maintainer application to remove the registry entries after some timeout as well. Just launch the maintainer application with an appropriate command line parameter when you main program quits. The maintainer app will just sleep for the time span specified, clean up the registry and exit. Naturally, this requires that the user doesn't shut down the system or kill the helper application in the meantime. You could avoid such by hiding the helper process and storing re-run information in the autorun registry keys but once again, too much effort for a simple program, too dubious for the user and I'm sure one or another virus scanner will falsely report a virus in your helper application :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Six Sigma Control Plans
Screencast - Getting to Know the Pipeline

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question