RE: Event Processing at servlet startup..

"Christian Cryder" <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi Kirk,

Ok, so I'm just now getting around to responding to this...sorry its taken
me so long!

> Is there a mechanism to fire 'events' during my initializeLocal method
> withing my ApplicationGateway...

Right now, there's not, but we could probably create something if need be.
First, however, I want to better understand exactly what you're trying to
accomplish.

> Here's what I'd like to do.
>
> E.g.
>
> public void initializeLocal() {
>   super.initializeLocal();
>
>   //Startup configuration...
>   .
>   .
>   .
>   //Done Setting up the Servlet
>
>   //Now I'd like to notify all interested event listeners
>   //that the servlet has done starting up.
>
>   //If so.. then go and do their own mini initializations..
>   // database stuff and what not..
>
>   //Pseudo Code Follows here...
>   Have 2 Events and Listeners...specified in my ApplicationAssembler XML
>
>   ServeletStartupComplete.Event and After_StartupComplete.Event which
> extends ServeletStartupComplete.Event
>
>   Get the EventQueue...
>   Add After_StartupComplete.Event to the queue
>   Let Barracuda process the queue and all interested listeners
>   //End Pseudo Code
>
> The idea is that I'd like all interested listeners to listen for
> ServeletStartupComplete.Event.
>
> This way.. when I add the After_StartupComplete.Event..the queue should
> process all the waiting listeners..

So here's a couple of questions. First of all, most events are designed to
generate a response back to the client...you wouldn't be doing that here
(presumably). Now Barracuda is capabale of handling this (ie. dispatching to
events that don't generate a response), but you wouldn't exactly be able to
reuse the event handlers either. In other words, you're not going to want to
try using these handlers to do setup stuff AND actually generate
responses...it'd just be one or the other.

Now, the next question that I have relates to the wisdom of actually doing
this type of thing in event handlers. Typically, event handlers are short
lived, that is, instances are created when they are needed and then
discarded for gc once they're done...you don't typically have event handlers
living beyond the scope of a single req-resp cycle.

So the question arises, why would you actually need to notify them that the
servlet is up and running? I guess this relates to the thing I'm still most
unclear on here...what types of specific things do you actually want to see
configured here?

My gut feeling is that it'd be much easier to be using the
ObjectRepositoryAssembler for this task, but I don't want to jump to
conclusions either. So if you could provide some more specific details here,
I will try to follow up with a more complete response (and I promise to
address it today rather than wait another couple of weeks ;-)

Christian
----------------------------------------------
Christian Cryder
Internet Architect, ATMReports.com
Project Chair, BarracudaMVC - http://barracudamvc.org
----------------------------------------------
"Coffee? I could quit anytime, just not today"


-----Original Message-----
From: Kirk Daries [mailto:[email protected]]
Sent: Tuesday, June 10, 2003 2:29 AM
To: Christian Cryder
Subject: Event Processing at servlet startup..


Hi Christian...

Sorry to bother you..
I know your're extremly busy with your studies and work..

A while back you said you had an idea how I could solve this problem...
Could you point me in the right direction??

Thanx
KD

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Hi Guys,

Quick question.
Is there a mechanism to fire 'events' during my initializeLocal method
withing my ApplicationGateway...

I'm not sure if there is a mechanism already.. or a better way...

Here's what I'd like to do.

E.g.

public void initializeLocal() {
  super.initializeLocal();

  //Startup configuration...
  .
  .
  .
  //Done Setting up the Servlet

  //Now I'd like to notify all interested event listeners
  //that the servlet has done starting up.

  //If so.. then go and do their own mini initializations..
  // database stuff and what not..

  //Pseudo Code Follows here...
  Have 2 Events and Listeners...specified in my ApplicationAssembler XML

  ServeletStartupComplete.Event and After_StartupComplete.Event which
extends ServeletStartupComplete.Event

  Get the EventQueue...
  Add After_StartupComplete.Event to the queue
  Let Barracuda process the queue and all interested listeners
  //End Pseudo Code

The idea is that I'd like all interested listeners to listen for
ServeletStartupComplete.Event.

This way.. when I add the After_StartupComplete.Event..the queue should
process all the waiting listeners..

Regards
KD
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.