You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Guy Pardon <gu...@atomikos.com> on 2007/09/13 10:40:30 UTC

SOAPFactory thread safe?

Hi,

Is the following code thread safe? In other words, can we reuse the  
same soapFactory for different threads (concurrently) and within  
different MEPs?

Thanks,
Guy


private static SOAPFactory soapFactory = null;

     static {
     		try {
     			soapFactory = SOAPFactory.newInstance();
     		}
     		catch ( Exception e ) {
     			Configuration.logWarning ( "Failed to create SOAPFactory" , e );
     		}
     }

Re: SOAPFactory thread safe?

Posted by Guy Pardon <gu...@atomikos.com>.
Thanks,

Actually, my worry is more about the implementation of the factory  
class. Is it designed for concurrency?

Tnx
Guy

On 13-sep-07, at 10:46, Sergey Beryozkin wrote:

> Seems to be perfectly thread-safe, VM guarantees that the static  
> initializer is executed in a thread-safe manne,
> unless SOAPFactory.newInstance() has some global sideeffects.
> Do you see transient failures ?
>
> Cheers, Sergey
>
> ----- Original Message -----
> From: "Guy Pardon" <gu...@atomikos.com>
> To: <cx...@incubator.apache.org>
> Sent: Thursday, September 13, 2007 9:40 AM
> Subject: SOAPFactory thread safe?
>
>
>> Hi,
>>
>> Is the following code thread safe? In other words, can we reuse the
>> same soapFactory for different threads (concurrently) and within
>> different MEPs?
>>
>> Thanks,
>> Guy
>>
>>
>> private static SOAPFactory soapFactory = null;
>>
>>     static {
>>     try {
>>     soapFactory = SOAPFactory.newInstance();
>>     }
>>     catch ( Exception e ) {
>>     Configuration.logWarning ( "Failed to create SOAPFactory" , e );
>>     }
>>     }
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,  
> Ireland


Re: SOAPFactory thread safe?

Posted by Sergey Beryozkin <se...@iona.com>.
I think I misunderstood your question, you're asking if the static instance shown in your code fragment can be reused afterwords 
concurrently, but I though you were asking if the block itsef was thread-safe, sorry

Cheers, Sergey

> Hi,
>
> Is the following code thread safe? In other words, can we reuse the
> same soapFactory for different threads (concurrently) and within
> different MEPs?
>
> Thanks,
> Guy
>
>
> private static SOAPFactory soapFactory = null;
>
>     static {
>     try {
>     soapFactory = SOAPFactory.newInstance();
>     }
>     catch ( Exception e ) {
>     Configuration.logWarning ( "Failed to create SOAPFactory" , e );
>     }
>     }

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: SOAPFactory thread safe?

Posted by Sergey Beryozkin <se...@iona.com>.
Seems to be perfectly thread-safe, VM guarantees that the static initializer is executed in a thread-safe manne,
unless SOAPFactory.newInstance() has some global sideeffects. 
Do you see transient failures ?

Cheers, Sergey

----- Original Message ----- 
From: "Guy Pardon" <gu...@atomikos.com>
To: <cx...@incubator.apache.org>
Sent: Thursday, September 13, 2007 9:40 AM
Subject: SOAPFactory thread safe?


> Hi,
> 
> Is the following code thread safe? In other words, can we reuse the  
> same soapFactory for different threads (concurrently) and within  
> different MEPs?
> 
> Thanks,
> Guy
> 
> 
> private static SOAPFactory soapFactory = null;
> 
>     static {
>     try {
>     soapFactory = SOAPFactory.newInstance();
>     }
>     catch ( Exception e ) {
>     Configuration.logWarning ( "Failed to create SOAPFactory" , e );
>     }
>     }

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland