Thanks Sebb worked a dream.
On 1 Feb 2011, at 12:18, sebb wrote: > On 1 February 2011 11:17, Ben Cuthbert <[email protected]> wrote: >> All I have a static factory that I am using to maintain a socket connection. >> Each sample does the following when it starts >> >> >> public final SampleResult sample() { >> >> initSession(); >> } >> >> in the initSession we just have >> >> if(!sessionFactory.isConnected()) { >> //connect >> } >> >> Now that works fine the sampler starts up, connects to the remote host and >> send the data. >> When the samplers ends >> >> @Override >> public void testEnded() { >> this.sessionFactory.shutDown(); >> } >> >> in the session factory we try and close the socket. But it does not close. >> And no error is thrown. >> When I try and debug via eclipse I see a null pointer buy no errors just >> stepping through >> jmeter code. >> >> Is this the correct way of doing this. >> > > No, because the testEnded() method is called from a different thread > and a different instance. > > Try using ThreadListener#threadFinished() instead. > >> > > --------------------------------------------------------------------- > 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]

