Solved

Setting time out for registry

Posted on 2006-07-02
5
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
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…

631 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