Listening for resource shutdown?

View: New views
9 Messages — Rating Filter:   Alert me  

Listening for resource shutdown?

by Jan Torben Heuer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have two resources (BrokeredNotification) A and B.

A creates new resources of type B.

B can by destroyed manually or through its ScheduledTermination Capability
(using muse's SimpleScheduledTermination).

How can A be informed that an instance of B has been destroyed?

Thanks,

Jan
--
                                Institute for Geoinformatics
jan.heuer@... Robert-Koch-Strasse 26-28
+49 251 83-31960 48151 Münster, Germany


signature.asc (196 bytes) Download Attachment

RE: Listening for resource shutdown?

by Chris.Twiner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jan,

ResourceManagerListener and the ResourceManager can help here.  All resources removals will trigger the callback functions so you have to filter yourself.

cheers,
Chris

-----Original Message-----
From: Jan Torben Heuer [mailto:jan.heuer@...]
Sent: Thursday, August 07, 2008 2:34 PM
To: muse-user@...
Subject: Listening for resource shutdown?

Hi,

I have two resources (BrokeredNotification) A and B.

A creates new resources of type B.

B can by destroyed manually or through its ScheduledTermination Capability (using muse's SimpleScheduledTermination).

How can A be informed that an instance of B has been destroyed?

Thanks,

Jan
--
                                Institute for Geoinformatics
jan.heuer@...       Robert-Koch-Strasse 26-28
+49 251 83-31960                48151 Münster, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@...
For additional commands, e-mail: muse-user-help@...


SV: Listening for resource shutdown?

by Lenni Madsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How about sending a notification in the prepareShutdown() from resource B
while resource A is subscribed to resource B ?

That function is called before the actual resource is terminated (before the
function shutdown).

Of course this is the simplified and perhaps not proper way of doing things.

/Lenni

"Cake is not a dual-use food stuff"
-----Oprindelig meddelelse-----
Fra: Jan Torben Heuer [mailto:jan.heuer@...]
Sendt: 7. august 2008 14:34
Til: muse-user@...
Emne: Listening for resource shutdown?

Hi,

I have two resources (BrokeredNotification) A and B.

A creates new resources of type B.

B can by destroyed manually or through its ScheduledTermination Capability
(using muse's SimpleScheduledTermination).

How can A be informed that an instance of B has been destroyed?

Thanks,

Jan
--
                                Institute for Geoinformatics
jan.heuer@... Robert-Koch-Strasse 26-28
+49 251 83-31960 48151 Münster, Germany


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@...
For additional commands, e-mail: muse-user-help@...


Re: Listening for resource shutdown?

by Jan Torben Heuer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 07 August 2008 14:37:37 Chris.Twiner@... wrote:

Hallo,

> ResourceManagerListener and the ResourceManager can help here.  All
> resources removals will trigger the callback functions so you have to
> filter yourself.

Because I got notification for all but my self-instantiated resources I took a
look at the SimpleResource. I found this code in the shutdown method:

        //
        // remove resource visibility
        //
        // sanity check: make sure the resource was put in manager. this may
        // not be the case for internal resources
        //
        if (manager.getResource(_epr) != null)
            manager.removeResource(_epr);

the if-clause didn't match in my case so, what do I have to do to put my
self-instantiated resource into the manager? I do:

/* create new resource */
newPublicationEndpoint =
manager.createResource(publisherRegistrationManagerEndpoint);


Jan
--
                                Institute for Geoinformatics
jan.heuer@... Robert-Koch-Strasse 26-28
+49 251 83-31960 48151 Münster, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@...
For additional commands, e-mail: muse-user-help@...


RE: Listening for resource shutdown?

by Chris.Twiner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jan,

Sorry, I misunderstood, that code is part of the problem.

To solve it for my needs I do a bunch of unpleasent inheritance and reflection (as each field is private for shutting down - my only huge issue with Muse's design) to allow subscriptions and resources to be persisted.  I have at least 6 of the core files replaced to allow shutting down etc which of course implies changes to the muse.xml for configuring them.

I would have to check with my Boss about sharing that code, but I don't see a problem, although it would definitely be given "as is".  Also the default framework does not have a notion of shutting down and then restarting, which may also affect your tests.

cheers,
Chris

-----Original Message-----
From: Jan Torben Heuer [mailto:jan.heuer@...]
Sent: Tuesday, August 19, 2008 1:46 PM
To: muse-user@...
Subject: Re: Listening for resource shutdown?

On Thursday 07 August 2008 14:37:37 Chris.Twiner@... wrote:

Hallo,

> ResourceManagerListener and the ResourceManager can help here.  All
> resources removals will trigger the callback functions so you have to
> filter yourself.

Because I got notification for all but my self-instantiated resources I took a look at the SimpleResource. I found this code in the shutdown method:

        //
        // remove resource visibility
        //
        // sanity check: make sure the resource was put in manager. this may
        // not be the case for internal resources
        //
        if (manager.getResource(_epr) != null)
            manager.removeResource(_epr);

the if-clause didn't match in my case so, what do I have to do to put my self-instantiated resource into the manager? I do:

/* create new resource */
newPublicationEndpoint =
manager.createResource(publisherRegistrationManagerEndpoint);


Jan
--
                                Institute for Geoinformatics
jan.heuer@...       Robert-Koch-Strasse 26-28
+49 251 83-31960                48151 Münster, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@...
For additional commands, e-mail: muse-user-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@...
For additional commands, e-mail: muse-user-help@...


Re: Listening for resource shutdown?

by Jan Torben Heuer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 19 August 2008 14:01:04 Chris.Twiner@... wrote:

Hallo,

> To solve it for my needs I do a bunch of unpleasent inheritance and
> reflection (as each field is private for shutting down - my only huge issue
> with Muse's design) to allow subscriptions and resources to be persisted.
>  I have at least 6 of the core files replaced to allow shutting down etc
> which of course implies changes to the muse.xml for configuring them.
>
> I would have to check with my Boss about sharing that code, but I don't see
> a problem, although it would definitely be given "as is".  Also the default
> framework does not have a notion of shutting down and then restarting,
> which may also affect your tests.
Thanks for your effort! If not I think I could also use Lenni's approach -
just calling the listening resource "by hand".

Jan



--
                                Institute for Geoinformatics
jan.heuer@... Robert-Koch-Strasse 26-28
+49 251 83-31960 48151 Münster, Germany


signature.asc (196 bytes) Download Attachment

RE: Listening for resource shutdown?

by Chris.Twiner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If its just for testing I would use Lenni's approach.  It only makes sense in my case as my system is built for persistent subscriptions and the ability to be restarted on the fly.

-----Original Message-----
From: Jan Torben Heuer [mailto:jan.heuer@...]
Sent: Tuesday, August 19, 2008 2:16 PM
To: muse-user@...
Subject: Re: Listening for resource shutdown?

On Tuesday 19 August 2008 14:01:04 Chris.Twiner@... wrote:

Hallo,

> To solve it for my needs I do a bunch of unpleasent inheritance and
> reflection (as each field is private for shutting down - my only huge
> issue with Muse's design) to allow subscriptions and resources to be persisted.
>  I have at least 6 of the core files replaced to allow shutting down
> etc which of course implies changes to the muse.xml for configuring them.
>
> I would have to check with my Boss about sharing that code, but I
> don't see a problem, although it would definitely be given "as is".
> Also the default framework does not have a notion of shutting down and
> then restarting, which may also affect your tests.

Thanks for your effort! If not I think I could also use Lenni's approach - just calling the listening resource "by hand".

Jan



--
                                Institute for Geoinformatics
jan.heuer@...       Robert-Koch-Strasse 26-28
+49 251 83-31960                48151 Münster, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@...
For additional commands, e-mail: muse-user-help@...


Re: Listening for resource shutdown?

by Jan Torben Heuer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 19 August 2008 14:19:29 Chris.Twiner@... wrote:

Hallo,

> If its just for testing I would use Lenni's approach.  It only makes sense
> in my case as my system is built for persistent subscriptions and the
> ability to be restarted on the fly.

My other question today was related to junit testing but this listener stuff
is for productive use, too.

I want to archive the same like the NotificationProducer does: getting
informed about removed SubscriptionManagers. (Though both resources are
others in my case)

Jan
--
                                Institute for Geoinformatics
jan.heuer@... Robert-Koch-Strasse 26-28
+49 251 83-31960 48151 Münster, Germany


signature.asc (196 bytes) Download Attachment

RE: Listening for resource shutdown?

by Chris.Twiner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

unfortunately you may require my code then.  I'll talk to the Boss soon and check if I can share, I'll mail you directly.....

I'll look at whats needed to try and include this approach (and doing the same for proxies etc) within Muse.

-----Original Message-----
From: Jan Torben Heuer [mailto:jan.heuer@...]
Sent: Tuesday, August 19, 2008 3:18 PM
To: muse-user@...
Subject: Re: Listening for resource shutdown?

On Tuesday 19 August 2008 14:19:29 Chris.Twiner@... wrote:

Hallo,

> If its just for testing I would use Lenni's approach.  It only makes
> sense in my case as my system is built for persistent subscriptions
> and the ability to be restarted on the fly.

My other question today was related to junit testing but this listener stuff is for productive use, too.

I want to archive the same like the NotificationProducer does: getting informed about removed SubscriptionManagers. (Though both resources are others in my case)

Jan
--
                                Institute for Geoinformatics
jan.heuer@...       Robert-Koch-Strasse 26-28
+49 251 83-31960                48151 Münster, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@...
For additional commands, e-mail: muse-user-help@...