Jim Douglas <email@hidden> wrote:
(Re-sent without a file attachment...are messages with attachments
blocked from the list?)
No, but the attachments are stripped.
Any suggestions would be very much appreciated...I'm lost.
Is your sample code supposed to be just a demonstration of the
problem,
or an example of what you're trying to accomplish with locks?
I ask because your code falls back to opening a file read-only when
it can't
open it R/W. But a file opened read-only doesn't need a lock, so
if you're
going to fall back to R/O access, then you should also fall back to
omitting the lock. Or maybe I'm misunderstanding what the point is.
Your comment in the code:
// My understanding is that this should be true on most
platforms, however, I
// cannot figure out how to upgrade a shared lock to exclusive,
which would be
// needed on file lock is this was false.
See the API docs for FileLock.
<http://java.sun.com/j2se/1.4.2/docs/api/java/nio/channels/
FileLock.html>
They clearly explain that locks are platform-dependent. Locks are
a thin
layer on whatever a platform offers natively, and you have to take
what is
available on each platform. There is no universal portable
semantics for
locks, and you should therefore write your lock-using programs to be
adaptable, rather than assuming that lock behavior is universal.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden