I don't know if what I do is the cleanest way (it might be actually a dirty way), but it is straightforward:
- the connect sampler fills a static hashtable object with its current thread as key and your custom server reference object as value;
- the disconnect sampler retrieves the reference from the hashtable, using its current thread as key.

I even do some synchronization on this thread object (wait()/notify()) and I get deadlocks in a couple of threads from time to time, without knowing if it is caused by a bug in my code, or if it results from a conflict between by code and internal synchronization of Jmeter's thread management (should have a look at the code...)

From my point of view, I don't feel it convenient to proceed this way. I would feel it more convenient to have a single sampler object with its own state, performing a variety of operations during the test plan.

If a Jmeter developper reads this, probably s/he can comment on my workaround ?

Regards,
-- Bruno.

Vjeran Marcinko wrote:
> Hi all. I'm developing samplers for my custom java server, and basically I have 2 samplers - Connect and Disconnect request ... Thing is that Connect sampler instantiates socket connection, and needs to pass that Socket object to Disconnect sampler so I could send my custom disconnect object through that Socket instance. But I dunno still how to share objects between samplers ? I see few components in JMeter that seem to be able to do this (Configuration, Modifier...), but I ask this way if someone can suggest me the cleanest and simpliest way ....


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to