|
Not being too strong on the specifics of the Toolbox I would have expected that in the sleep flow you would have something that would check if the file modify, file.lastModified() , is different to the previous and if so fire a FileEvent. James H H Lampert <jamesl@xxxxxxxxxxx> wrote: I note that the Toolbox has a FileListener interface, and the AS400File class has an AddFileListener method. I tried implementing the interface from my test class, and while I then received a "FileOpened" event as soon as the test class opened the file, that was about all I got. I was hoping to receive a "FileModified" event when I updated a record from QuestView in another terminal session, but it didn't get ANY events from actions taken elsewhere. Am I doing something wrong, or do I just have unrealistically high expectations? The test class now looks like: import com.ibm.as400.access.*; class test03 implements FileListener { public static void main (String args[]) { System.out.println("I like spam!"); AS400 as400 = new AS400("localhost"); System.out.println("CCSID = " + as400.getCcsid()); QSYSObjectPathName fileName = new QSYSObjectPathName("AQUESTVIEW", "VIEWCUS", "FILE"); System.out.println("Filename = " + fileName.getPath()); SequentialFile file = new SequentialFile(as400, fileName.getPath()); file.addFileListener(new test03()); AS400FileRecordDescription recDes = new AS400FileRecordDescription(as400, fileName.getPath()); try { RecordFormat recFmt = recDes.retrieveRecordFormat()[0]; System.out.println("Format = " + recFmt.getName()); file.setRecordFormat(recFmt); file.open(SequentialFile.READ_ONLY, 1, SequentialFile.COMMIT_LOCK_LEVEL_NONE); Record data = file.readNext(); while (data != null) { System.out.println((String) data.getField("CUNAME")); data = file.readNext(); } System.out.println("Going to sleep"); try {Thread.sleep((long)60000);} catch(InterruptedException ie) {System.out.println("Interrupted");} System.out.println("Waking up!"); as400.disconnectAllServices(); } catch (Exception e) {e.printStackTrace();} } -- JHHL -- This is the Java Programming on and around the iSeries / AS400 (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. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.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.