G'day I wasn't suggesting static for the connection - just to control initialization. Don't let any thread exit from initialization until all have completed initialization. You will need a static variable to keep count of threads that have initialized and a static synchronized method to update it in a thread safe manner. You will also need to tell the sampler the number of threads in the run. You may be able to get this from the environment with a method call or you may have to pass it in.
There are probably other ways to do this if getting the number of threads in the run proves awkward. Ian Blavins Software performance specialist . TEMENOS The Banking Software Company . PeopleBuilding 2, Maylands Av Hemel Hempstead UK HP2 4NW . T: +44 (0) 1442 431 106 E: [email protected] . www.temenos.com . -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Paul Robinson Sent: Monday, 23 March 2009 4:09 PM To: JMeter Users List Subject: Re: Custom Sampler: Force all setupTest methods to be invoked before runTest methods Hi, Thanks for the quick reply. Static variables would be a good idea, however, I require that each thread has it's own connection, in order to simulate multiple separate users. Sharing a connection through a static variable would break my test unfortunately. For some reason, the system I am testing requires that all connections are established before any of them are used. Therefore I really need to ensure all the setupTest methods are invoked before any of the runTest methods are invoked. Thanks for the help, Paul. 2009/3/23 Ian Blavins <[email protected]> > G'day > > Because they all run under one JVM all instances of the sampler within a > JMeter server can share memory through static variables. > > If you are familiar with static variables that should be enough to get you > going. > > > Ian Blavins > Software performance specialist > . > TEMENOS > The Banking Software Company > . > PeopleBuilding 2, Maylands Av > Hemel Hempstead UK HP2 4NW > . > T: +44 (0) 1442 431 106 > E: [email protected] > . > www.temenos.com > . > > -----Original Message----- > From: [email protected] [mailto: > [email protected]] On Behalf Of Paul Robinson > Sent: Monday, 23 March 2009 2:59 PM > To: [email protected] > Subject: Custom Sampler: Force all setupTest methods to be invoked before > runTest methods > > Hello, > > I have written a Custom Sampler by extending "AbstractJavaSamplerClient". > My > sampler is very simple, it just logs the method being invoked. > > If i run the sampler for 2 threads with "loop count" of 1, I see the > following output: > > INFO 03/23, 02:49:18 hat.test.jms.test.DummySampler Constructor > INFO 03/23, 02:49:18 hat.test.jms.test.DummySampler setupTest > INFO 03/23, 02:49:18 hat.test.jms.test.DummySampler runTest > INFO 03/23, 02:49:18 hat.test.jms.test.DummySampler Constructor > INFO 03/23, 02:49:18 hat.test.jms.test.DummySampler setupTest > INFO 03/23, 02:49:18 hat.test.jms.test.DummySampler runTest > INFO 03/23, 02:49:18 hat.test.jms.test.DummySampler teardownTest > INFO 03/23, 02:49:18 hat.test.jms.test.DummySampler teardownTest > > Here you will observe that the "runTest" method of the first thread is > invoked before the "setupTest" of the 2nd thread. For my test I need to > ensure that all threads have their setupTest method invoked before any of > them have their "runTest" method ivoked. > > Does anyone know how I can do this? > > Thanks, > > Paul. > Disclaimer: > If you have received this e-mail in error please notify the sender. > Please note that any views or opinions presented in this e-mail are solely > those of the author and do not necessarily represent those of TEMENOS. > We recommend that you check this e-mail and any attachments against > viruses. > TEMENOS accepts no liability for any damage caused by any malicious code > or virus transmitted by this e-mail. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Dr Paul Robinson Senior Consultant Engineer Arjuna Technologies Ltd Tel: +44 191 243 0676 Mob: +44 772 920 7346 Fax: +44 191 243 0677 Web: www.arjuna.com Registered Office: Floor A, Milburn House, Dean Street, Newcastle upon Tyne, NE1 1LE VAT Registration No: 764173128. Company registered in England Registration No: 4497081 Disclaimer: If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of TEMENOS. We recommend that you check this e-mail and any attachments against viruses. TEMENOS accepts no liability for any damage caused by any malicious code or virus transmitted by this e-mail. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

