users@jersey.java.net

Re: [Jersey] synchronized

From: Gregory Gerard <ggerard_at_mac.com>
Date: Tue, 19 May 2009 12:56:56 -0700

If nothing else, synchronized won't solve your problem if you're
running in more than one JVM.

greg

On May 19, 2009, at 12:53 PM, Craig McClanahan wrote:

> Felipe Gaścho wrote:
>> Jersey is not synchronized, right ?
>>
>>
> The right way to think about it is that your server application must
> be prepared to process requests on multiple threads at once. Jersey
> is internally synchronized to the extent needed to protect its *own*
> data structures from corruption, but anything in the application
> that requires synchronization is your responsibility.
>
> This is not really any different than any Java servlet based web
> application, where exactly the same considerations apply.
>> It means I need to synchronize all my methods with concurrent calls?
>>
>> Does it create a lot of bottlenecks in the system ?
>>
>> * I am interested in the calls to the persistence layer, because I
>> got
>> this issue:
>>
>>
>> Internal Exception:
>> com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException:
>> Duplicate entry '455' for key 1
>> Error Code: 1062
>> Call: INSERT INTO FPCERTIFICATE (ID, PATH, VERSION, USER_ID) VALUES
>> (?, ?, ?, ?) bind => [455, /docs/453/8/cert, 1, 453]
>>
>>
> Whether you need synchronization in the persistence tier depends
> totally on what framework you are using, and whether that framework
> provides any sort of protection of its own. In a database
> environment, you also need to pay attention to transaction
> boundaries, and which transaction modes are in use. But, again,
> none of this is at all specific to using Jersey.
>
> Craig
>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>