PFA tests that I had used to test jibx threading with. Jibx seems to 
work fine even when a marshalling/unmarshalling context is shared among 
multiple threads. I have made a eclipse project out of it.

The BindingThreadTest class has a main, in which you can specify the 
class to marshall/unmarshall and the number of threads.

On my dual core 2 GHz,  2GB ram laptop for a simple class A, using JDK5 
running in eclipse 3.2 (1024 MB heap)

public class A {
   private String type;

   private String description;

  /* .... getters /setters ....*/
}

and using the mapping

<mapping name="a" class="jibx.model.A" value-style="attribute">
       <value name="type" get-method="getType" set-method="setType" 
style="attribute" usage="optional"/>          <value name="description" 
get-method="getDescription" set-method="setDescription" style="element" 
usage="optional"/>       </mapping>

for 3 threads gave the result

Doing test with single binding factory (shared marshall/unmarhall context)
Sleeping for 5 secs
Binding Thread 0 thread counter 179711
Binding Thread 1 thread counter 191826
Binding Thread 2 thread counter 181605
total 553142
Test with single binding factory complete

Doing test with single binding factory (a marshall/unmarhall context per 
thread)
Sleeping for 5 secs
Binding Thread 0 thread counter 157672
Binding Thread 1 thread counter 213443
Binding Thread 2 thread counter 159835
total 530950
Test with single binding factory complete

Doing test with multiple binding factories
Sleeping for 5 secs
Binding Thread 0 thread counter 173586
Binding Thread 1 thread counter 189972
Binding Thread 2 thread counter 166449
total 530007
Test with multiple binding factories complete

Please note that the numbers indicate the number of times the operation 
- object to xml, xml to object, object comparison - was done.

In the attachment zip, I have not included the jibx libs
bcel.jar
jibx-bind.jar
jibx-run.jar
xpp3.jar
, which will have to be put under the lib folder, of which the run and 
xpp jars have to be part of the runtime class path.

cheers
Varghese C V

Dennis Sosnoski wrote:
> JiBX is designed to be usable by multiple threads, so long as the 
> separate threads use different marshalling/unmarshalling contexts. 
> There's always the possibility of some bug creeping in with this, but 
> I don't know of any problems in this area. Are there any get/set 
> methods being used by the binding that aren't threadsafe, or extension 
> code being called?
>
>   - Dennis
>
> Dennis M. Sosnoski
> SOA and Web Services in Java
> Training and Consulting
> http://www.sosnoski.com - http://www.sosnoski.co.nz
> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>
>
>
> X Y wrote:
>  
>> Hi all,
>>  
>> I've got question about concurrent access to JiBX. Does JiBX is 
>> secure for such access? I've encountered a problem. I've got binding 
>> for one schema and use it from multiple threads. Each thread gets 
>> BindingDirectory for a class which corresponds to root of the xml and 
>> creates marshaling/unmarshaling context. But this causes the bound 
>> classes receive some weird data. On the other hand, everything is ok 
>> if I synchronize access to JiBX.
>>  
>> So can I use JiBX from multiple threads?
>>  
>> Thanks,
>> Jrx
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------- 
>>
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to 
>> share your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> jibx-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>       
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to 
> share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to