|
Hi all. I was wondering if anybody has seen this problem. When trying to lock a file in java 1.4 on the As400, an IOException : ?Object is to large to process. Lock Failed.? is thrown. The things is the file is only 10 characters long. Is there a good work around for this without changing the code? Has anybody ever seen this exception in the case of a small file? Here is the code: try{ FileChannel channel = null; RandomAccessFile raf = null; raf = new RandomAccessFile(file,"rw"); channel = raf.getChannel(); // Try acquiring the lock without blocking. This method returns // null or throws an exception if the file is already locked. if(channel.tryLock() == null){ retval = false; logger.error("File in use by another object or process: "+file.getAbsolutePath()); } channel.close(); raf.close(); }catch(Exception e){ e.printStacktrace(); retval = false; logger.error("File in use by another object or process: "+file.getAbsolutePath()); } Thanks! Dan __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.