• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Problem with Thread Synchronization

Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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).
Posts: 6109
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
There’s no place like But I'll always remember this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic