• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

isThreadSafe

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm thinking about ways to architect a XML BBS with JSP.
In the BBS there is an XML file, userPosts.xml, that contains lots of user information - username, number of posts, last login, etc - and is accessed by all the XML thread files - one XML file for each topic. Whenever a person adds a message, it first updates/creates the thread XML file and then updates userPost.xml with that user's info.
I'm new to JSP - this system is actually in ASP - and I'm wondering what would be the best way to ensure that the userPosts.xml file was only getting opened and re-written by one user at a time?
I see that there is the isThreadSafe page directive - can I just have a page that works with userPosts.xml and set isThreadSafe = false? Will that ensure correct marshalling of the processes lined up for the rewriting of this file? Or is there a better, faster way?
thanks for any ideas,
Scottie Zman
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, clever as my designs may be, I must admit that the FIRST thing I'd do when changing platforms would be to see if someone hadn't already written one of those that I could steal or adapt (I'd suggest the JavaRanch one, but it's not in Java!).
Second suggestion would be to consider forgoing XML and using a DBMS. XML is essentially a sequential medium, not a random-access or skip-sequential one. and I wouldn't recommend it for high-volume use. J2EE has most of its concurrency services written for DBMS'type stuff (there ARE XML-specific DBMS's though).
You can use isThreadSafe(), but it constricts the entire process. Much depends on the load.
 
scottie zman
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>> You can use isThreadSafe(), but it constricts the entire process
The entire process being.... just that page and all the visitors who are accessing it, or the entire server?? Does it just line up the requests in a jfirst come first serve manner, or do requests ever get dropped?
If it's just the page, then I can probably live with that.
Scottie Zman
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just that page.
 
Water proof donuts! Eat them while reading this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic