Theoretically, it is possible to have more than one instance of your handler. If you are using embedded mode of HSQLDB, you cannot make more than one connection. If you really want to link the DB connection creation to your handler, it is better to implement an instance of org.apache.axis2.modules.Module, and in the init method of that Module, you can create your DB connection. I presume you are including your handler within an Axis2 module.
Azeez On Mon, Aug 16, 2010 at 7:48 PM, Meeusen, Christopher W. < [email protected]> wrote: > Thank you for the response. Please excuse my ignorance on the subject, but > what benefit is there to instantiating this in a servlet vs the constructor > of my first handler in my inflow chain? The database is needed for logic in > the inhandler, it is tightly coupled to the logic in my inhandler so I > thought it appropriate to create it in the constructor. > > > > Thanks, > > Chris > > > > *From:* java-user-return-83344-Meeusen.Christopher=mayo.edu@ > axis.apache.org [mailto:java-user-return-83344-Meeusen.Christopher= > [email protected]] *On Behalf Of *Afkham Azeez > *Sent:* Saturday, August 14, 2010 2:34 AM > *To:* [email protected] > *Cc:* [email protected] > *Subject:* Re: customize wsaxis2 startup? > > > > Write a servlet which get initialized on startup, and in that servlet's > init method, do whatever you need to initialize HSQLDB. Add that servlet to > the web.xml file included in the axis2.war. > > > > The handler is not the correct place to do this. > > > > Azeez > > On Fri, Aug 13, 2010 at 11:05 PM, Meeusen, Christopher W. < > [email protected]> wrote: > > After doing a little more research, I modified the constructor of my custom > inhandler class (that extends org.apache.axis2.handlers.AbstractHandler) and > see that it is instantiated only once on startup. I think that the > constructor may be a perfect place for me to do my one time setup, prior to > processing requests. Does anyone out there do similar setup in the > constructor of one of thier AbstractHandler implementations? > > > Chris > > > > *From:* java-user-return-83340-Meeusen.Christopher=mayo.edu@ > axis.apache.org [mailto:java-user-return-83340-Meeusen.Christopher= > [email protected]] *On Behalf Of *Meeusen, Christopher W. > *Sent:* Friday, August 13, 2010 11:14 AM > *To:* [email protected] > *Subject:* customize wsaxis2 startup? > > > > Hi, > > > > I’m trying to find the proper way to customize the axis2 startup, to > instantiate a HSQLDB and insert some records from the .script file. I don’t > think an inflow handler would be the proper place because I don’t want to do > this on every request just once when the webapp launches. We are running > axis2-1.3. Is there a facility in axis2 to run some one time house cleaning > on startup? > > > > Thanks > > > > Chris > > > > > -- > Afkham Azeez > Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com > Member; Apache Software Foundation; http://www.apache.org/ > email: [email protected] cell: +94 77 3320919 > blog: http://blog.afkham.org > twitter: http://twitter.com/afkham_azeez > linked-in: http://lk.linkedin.com/in/afkhamazeez > > Lean . Enterprise . Middleware > -- Afkham Azeez Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com Member; Apache Software Foundation; http://www.apache.org/ email: [email protected] cell: +94 77 3320919 blog: http://blog.afkham.org twitter: http://twitter.com/afkham_azeez linked-in: http://lk.linkedin.com/in/afkhamazeez Lean . Enterprise . Middleware
