Solved

Setting time out for registry

Posted on 2006-07-02
5
281 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tidtcpserver connection lost handle 2 103
in SAS how to create a record for each combination of the two duplicates? 16 104
ejb entity bean example 2 17
asp Google Map 2 33
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…

820 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