• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Synchronization issue?

Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have very weird issue that I cannot explain. However, I hope that someone can give some tips on it.
We have a web site that display documents and information related to those documents. Some users complain that when they open a page the date when documents were submitted is wrong (really old date is shown). And after page is refreshed the date is corrected. The problem is that this issue cannot be repeated easily. It happens in some specific situation. The application is running on WebSphere v 5 and it uses Struts framework. The date when documents were submitted is stored in the database (DB2) and dynamically retrieved from there when list of documents is requested.

I really appreciate any ideas.
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ludmila, our display name policy askes for something that looks like a real last name, no abbreviation or unorthodox punctuation. "S-va" looks to abbreviated to possibly be a real name; please edit your profile to spell out a complete last name. Thank you.

As for your question - yes, it does sound very much like this could be a problem due to threading issues, and proper synchronization is one possible solution. I suggest you look at where the date data is being stored - not just in the database, but the variable(s) that are used in your code when processing the data. Local variables are always safe from threading issues, but for instance variables, is there some way that two threads can gain access to the same instance? If so, you may need to use synchronization to prevent the instance data from being accessed concurrently. Or rewrite the other code so that instances are not accessible to multiple threads. Or change the instance variable to a local variable, if that's possible.

Many other solutions may be possible, but it's hard to be more specific without knowing a lot more about the details of your code. It's also possible that the bug has nothing to do with threads and synchronization, so don't get too committed to this idea, yet. But for the symptoms you describe, it's very possible that threads are the problem.
Ruth Stout was famous for gardening naked. Just like this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic