jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Problem with Thread Synchronization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem with Thread Synchronization" Watch "Problem with Thread Synchronization" New topic

Problem with Thread Synchronization

saikat ray

Joined: Dec 27, 2011
Posts: 4

Following is the pseudo logic of a method inside a web service BLO which in turn calls another web service.

Public void xxx() {

int numberOfFailure=getFromApplicationContext();

//call a web service

if(the call is successfull){

//business logic





//some other business logic








This is the pseudo code of the method. The method calls a web service.On 3 consecutive failures it sends a mail .

Can you tell me is there a way to solve the synchronization problem without making the method synchronized? I did not find block synchronization option to be available here as the service call then gets included in the block as well (or may be i am wrong).
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

Hi, and welcome to the Ranch!

1. When posting code (even pseudocode), please UseCodeTags so it will be readable.

2. What, exactly, is "the synchronization problem" you're trying to solve?

3. Whether the service call gets included in the sync block depends entirely on whether or not you put it there.
I agree. Here's the link: http://aspose.com/file-tools
subject: Problem with Thread Synchronization
jQuery in Action, 3rd edition