Re: Non-web apps
Re: Non-web apps
- Subject: Re: Non-web apps
- From: Stefan Klein <email@hidden>
- Date: Thu, 02 Jul 2009 16:46:38 +0200
Hi,
i do this starting a new Thread in the Application class.
public Application()
{
super();
...
FOTimedMailer.startMailTimer(FOTimedMailer.NEXT);
}
public class FOTimedMailer extends TimerTask
{
...
public static void startMailTimer(int modus)
{
long nextStartAt = 0;
FOTimedMailer mailer = new FOTimedMailer();
Timer aTimer = new Timer();
aTimer.schedule(mailer, nextStartAt);
}
@Override
public void run()
{
// do my stuff
...
if (hasMoreMail)
{
// Start in short period
FOTimedMailer.startMailTimer(FOTimedMailer.NEXT);
}
else
{
// Sleep a while
FOTimedMailer.startMailTimer(FOTimedMailer.SLEEP);
}
}
}
Stefan
Ricardo J. Parada schrieb:
Moving this thread to webobjects-dev as I think it has
broader scope than just Wonder.
I want to create a program that is packaged as a webobjects
application , i.e. MyAgent.woa but currently it doesn't process http
requests. It's main thread just checks for work to do in the database
and then does it. I'm currently not subclassing WOApplication. I have
my own MPVAgent class which subclasses Object. But I can already see
how I could benefit if have it subclass WOApplication (or
ERXApplication) instead of my MPVAgent class.
However, in order to do so, I need to know what method to
subclass to setup my thread that does the main work I described.
Has anybody done something like this? Any advise?
I have lots of these so called agents.
On Jul 2, 2009, at 9:00 AM, Ricardo J. Parada wrote:
Just unfamiliarity with how to subclass it correctly
to make it do exactly what I want it to do.
On Jul 2, 2009, at 5:57 AM, David Avendasora wrote:
I'm unclear as to why your would not extend
ERXApplication in your back end apps, even if they aren't web apps.
What are you trying to avoid? Having them respond to outside requests?
Dave
On Jul 1, 2009, at 11:01 PM, Ricardo J. Parada wrote:
I have back end processes that are not web apps. I call
them agents. They are packaged like a web app, i.e. MyAgent.woa but
the main class does not extend ERXApplication or WOApplication. In
fact it extends a class called Agent that has Object as its super class.
It has a static method and I currently call
ERXApplication.setup(argv). That goes through the same intialization
as a Wonder app which is something I desire. :-)
But then I noticed that ERXProperties does not load the
Properties files from my frameworks. Then inspecting ERXProperties
source I noticed that the pathsForUserAndBundleProperties() method
returns an empty array because it does not see a WOApplication :
public static
NSArray pathsForUserAndBundleProperties(boolean reportLoggingEnabled) {
NSMutableArray propertiesPaths = new NSMutableArray();
NSMutableArray projectsInfo = new NSMutableArray();
String
projectPath, aPropertiesPath;
WOApplication application = WOApplication.application();
if
(application == null) {
log.warn("The application is not yet initialized.
Returning an empty array.");
return NSArray.EmptyArray;
}
...
}
Am I out of
luck? Should I have MyAgent subclass ERXApplication and just override
the run method?
Any ideas? Am I the only one who has back end apps that
are not web apps? :-)
Thanks
Ricardo
------------------------------------------------------------------------------
_______________________________________________
Wonder-disc mailing list
email@hidden
https://lists.sourceforge.net/lists/listinfo/wonder-disc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden