At an extremely simple level, I would create a lockfile (like mentioned before, similar to OpenOffice and Microsoft Office) but I would have details in it containing the name of the machine and user, and process details, and then look to see if that machine/user/process still exists when I want to lock the file. If it can be found then the file is locked, if not then the file is no longer locked. Obviously, removing the file at the end of need will make the lock check easier for the next process.

I can't remember exactly how to check for the existence of a process over the network, but the idea should cover everything you need. I think.


-Paul.


-----Original Message-----
From: JAVA400-L [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of David Gibbs
Sent: 07 November 2014 14:48
To: Java Programming on and around the IBM i
Subject: Re: Create an exclusive lock on an IFS file?

On 11/7/2014 7:48 AM, Ron Byrd wrote:
Have you looked into the "Check Out" and "Check In" processes that are
available from within the IBM I Navigator. I do not know if this
process is available from within Java or not.

If I understand the CHKIN & CHKOUT commands correctly, this would create a static lock that would persist after the connection from the java app was dropped. I don't want this.

I want to create a system level lock to prevent the same application, running on two workstations, from performing the same function at the same time.

david


--
IBM i on Power Systems: For when you can't afford to be out of business!

I'm riding a metric century (100 km / 62 miles) in the 2015 American Diabetes Association's Tour de Cure to raise money for diabetes research, education, advocacy, and awareness. You can make a tax deductible donation to my ride by visiting http://email.diabetessucks.net. My goal is $5500 but any amount is appreciated.

See where I get my donations from ... visit http://email.diabetessucks.net/mapdonations.php for an interactive map (it's a geeky thing).
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
---------------------------------------------------------------------------------------
This email has been scanned for email related threats and delivered safely by Mimecast.
For more information please visit http://www.mimecast.com
---------------------------------------------------------------------------------------


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.