App in the background

M

mark13.pl

Hello,

I would like to write stand-alone application which would download some
files from network every x hrs (specified by the user). I think I would
do it that, that user would just specify the time and minimalize it (it
will be minimalized or I will decide to put it to systray) and then app
every x hrs will wake up and do its job.

How can I do it without slowing a lot OS (processor/memory)? I was
thinking about threads and wait/sleep function but not know if it is
effective method. What do you think?!?

Regards, mark
 
M

Martin Gregorie

I would like to write stand-alone application which would download some
files from network every x hrs (specified by the user). I think I would
do it that, that user would just specify the time and minimalize it (it
will be minimalized or I will decide to put it to systray) and then app
every x hrs will wake up and do its job.

How can I do it without slowing a lot OS (processor/memory)? I was
thinking about threads and wait/sleep function but not know if it is
effective method. What do you think?!?
You don't say what your target OS is or if you want to write a OS you're
running on or if you want to write something that's OS-agnostic so its
difficult to give specific advice.

Personally, I'd do it with cron because then there are no overheads at
all. However, I do run Linux....
 
M

mark13.pl

Hello,
You don't say what your target OS is or if you want to write a OS you're
running on or if you want to write something that's OS-agnostic so its
difficult to give specific advice.

It is going to be MS Windows.

Regards, mark
 
M

Martin Gregorie

Hello,


It is going to be MS Windows.
Have you considered writing the application so it does the transfers you
need and then quits and running it under the control of the Windows
Scheduler?

Tis way you get a simple application and there's already a GUI (supplied
by MS) that can control when it gets run.
 
M

Mark Space

Hello,


It is going to be MS Windows.

Regards, mark

Yes, ditto to what Martin said. Much better to use the OS features than
to try to do everything yourself.

On Windows 2000 (mine), there's a control panel for this:

Start->Programs->Accessories->System Tools->Scheduled Tasks

Encourage the user to place your app here. This provides effectively 0%
overhead, just like cron. I don't think there's any way you can provide
that. Just having the JVM up at all is a pretty large overhead, if it's
going to be doing nothing except expiring a counter every 24 hours.

Also, think about other paradigms. If you are updating another app,
consider having it check for updates whenever its run.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top