User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 391,558 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,752 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 626 | Replies: 3
Reply
Join Date: Aug 2007
Posts: 8
Reputation: vivek_green is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
vivek_green vivek_green is offline Offline
Newbie Poster

Thread accessing from two different JVM's

  #1  
Aug 27th, 2007
hi,
I have a probelm,two thread from two different JVM's accessing the same file causing improper data for the 2 JVM's resulting in improper data.
If it same JVM i can go for synchronized block ,wil not happen with independent JVM.soluion pls?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,599
Reputation: Ezzaral is just really nice Ezzaral is just really nice Ezzaral is just really nice Ezzaral is just really nice Ezzaral is just really nice 
Rep Power: 11
Solved Threads: 257
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Maven

Re: Thread accessing from two different JVM's

  #2  
Aug 27th, 2007
You will need to use file locking. There are methods for controlling this in FileChannel.
Reply With Quote  
Join Date: Aug 2007
Posts: 8
Reputation: vivek_green is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
vivek_green vivek_green is offline Offline
Newbie Poster

Re: Thread accessing from two different JVM's

  #3  
Aug 29th, 2007
hi thanks for the reply can someone explain me more about the API for file locking
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,599
Reputation: Ezzaral is just really nice Ezzaral is just really nice Ezzaral is just really nice Ezzaral is just really nice Ezzaral is just really nice 
Rep Power: 11
Solved Threads: 257
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Maven

Re: Thread accessing from two different JVM's

  #4  
Aug 29th, 2007
Originally Posted by vivek_green View Post
hi thanks for the reply can someone explain me more about the API for file locking

From FileChannel javadoc:
a file channel can be obtained from an existing FileInputStream, FileOutputStream, or RandomAccessFile object by invoking that object's getChannel method, which returns a file channel that is connected to the same underlying file.
The FileChannel has methods to obtain a FileLock object on all or part of a file channel. When no longer needed, FileLock.release() will release the lock.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Java Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 9:54 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC