Hi James, I created a class and had it implement org.apache.hivemind.events.RegistryShutdownListener interface and also implemented the method public void registryDidShutdown(); For the method, I just had it print a debug statement my standard out log.
However, when I redeploy my app, I don't see any messages being printed indicating that the shutdown method is being called. I do though see that my startup code is being executed. Do I need to update the hivemind.xml or another config file? Thanks for your help, Josh James Carman wrote: > Have your implementation class implement > org.apache.hivemind.events.RegistryShutdownListener interface and it > will automatically be registered for the events by HiveMind (as long > as you're not using the threaded service model). > > > > On 12/26/06, Josh Joy <[EMAIL PROTECTED]> wrote: >> Hi All, >> >> I was able to implement the below for >> hivemind.startup...however is >> there such a thing as hivemind.shutdown? I'm looking >> for the equivalent >> of contextDestroyed? >> >> Thanks, >> Josh >> >> James Carman wrote: >> > You let HiveMind inject stuff into your service that >> runs at startup: >> > >> > public class MyStartupClass implements Runnable >> > { >> > private MyService myService; >> > >> > public void setMyService( MyService myService ) >> > { >> > this.myService = myService; >> > } >> > >> > public void run() >> > { >> > myService.doSomethingThatMyServiceDoes(); >> > } >> > } >> > >> > HiveMind will "autowire" the MyService object into >> your MyStartupClass >> > object (unless there is more than one service point >> within your HiveMind >> > registry which implements the MyService interface). >> Then, declare your >> > service point in the HiveMind module: >> > >> > <service-point id="SomeIdYouChoose" >> interface="java.lang.Runnable"> >> > <invoke-factory> >> > <construct >> class="com.myco.somepackage.MyStartupClass" /> >> > </invoke-factory> >> > </service-point> >> > >> > Then, register your service with the startup >> configuration point: >> > >> > <contribution configuration-id="hivemind.Startup"> >> > <startup object="service:SomeIdYouChoose" /> >> > </contribution> >> > >> > That's it! Your Runnable class will now run upon >> registry startup >> > (creation), which happens in a Tapestry application >> when the application >> > servlet starts up. >> > >> > On 10/28/06, KEGan <[EMAIL PROTECTED]> wrote: >> >> >> >> Hi, >> >> >> >> I have tried both approches. However, inside my >> code, I am trying to >> >> access >> >> Hivemind services, and it didnt work. >> >> >> >> Example, in my custom "ApplicationInitializer", I >> use: >> >> >> >> Registry registry = >> RegistryBuilder.constructDefaultRegistry(); >> >> MyService myservice = >> (MyService)registry.getService(" >> >> com.project.myService", >> >> MyService.class); >> >> >> >> And all I get is a null. >> >> >> >> I suspect using the >> "RegistryBuilder.constructDefaultRegistry()" is not >> >> the >> >> correct way to get access into Hivemind registry, >> when Tapestry is >> >> starting >> >> up. >> >> >> >> So, how do I get access to Hivemind registry ... >> whether it is from >> >> inside >> >> " >> >> hivemind.Startup" or >> "tapestry.init.ApplicationInitializers". >> >> >> >> >> >> >> >> On 10/24/06, James Carman >> <[EMAIL PROTECTED]> wrote: >> >> > >> >> > There is a configuration point called >> "hivemind.Startup" where you can >> >> > register Runnable objects to be run at HM >> registry startup time (which >> >> is >> >> > the same as Tapestry startup time). >> >> > >> >> > On 10/22/06, KEGan <[EMAIL PROTECTED]> >> wrote: >> >> > > >> >> > > Hi, >> >> > > >> >> > > I need to do some tasks when my Servlet web >> application is >> >> initialized. >> >> > In >> >> > > this, I can use ServletContextListener. >> >> > > >> >> > > Now, I am using Tapestry ... and I want to >> achieve the same >> >> thing. Of >> >> > > course, I can still use ServletContextListener, >> but with this, I >> >> cannot >> >> > > use >> >> > > all the TapestryAnnotation Hivemind goodness >> (autowiring, etc) that >> >> > comes >> >> > > with Tapestry. So is there a >> ServletContextListener equivalent in >> >> > > Tapestry? >> >> > > The idea is that I can run some tasks (only >> once) when Tapestry is >> >> first >> >> > > initialized, and I want to do this with all the >> Tapestry Annontation >> >> and >> >> > > Hivemind goodness. >> >> > > >> >> > > Thanks. >> >> > > >> >> > > ~KEGan >> >> > > >> >> > > >> >> > >> >> > >> >> >> >> >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]