Solved

Setting time out for registry

Posted on 2006-07-02
5
278 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
5 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 250 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 250 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This is an explanation of a simple data model to help parse a JSON feed
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now