For part 1, what kind of protocol do the messages and listener use? You may wind up with blocking IO so waiting for a message is more or less built in.
For part 2, Sounds like you're running this outside the
J2EE container. A scheduler like Quartz might be good to just start up your process every day. How does your J2EE container get started? Maybe you can add one more line to a startup script?
If you want to get this into your J2EE container, the specs forbid you from running your own threads but each J2EE vendor has some proprietary workaround. WAS has
WorkManager which I think lets you spawn custom threads.
If you can use JMS for your protocol, then
Message Driven Beans might be a good solution for both parts 1 and 2.
Any of that match up with your problem?
[ May 07, 2007: Message edited by: Stan James ]