Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Once processed do we need the file anymore? Who is modifying the files? If it is via a program the, will that program needs the information about already processed files? When that program going to modify the file are going to rename it again from <strong>file1_processed</strong> to <strong>file1</strong>? <br>You have to think about these use cases and many more if you change the file names (though I don't know in and out about your system but I felt it would be complected). <br>Better you just us <code>JNotifier</code>, it is really simple to use. Using this you can actually remove the scheduler. Whenever a notify comes for a particular files (added/modified etc), you can actually update the database that time only for particular that file only, no need traverse through the folders. <br>Just make sure in few cases you can get multiple notification in <code>JNotifier</code>, e.g. when new file added, you get added, modified, when renamed you get renamed, modified. So these things you have to take care. <br>With old scheduler also you can do the same. you can save the last updated timestamp of a file in the database. in next schedule you just check the latest timestamp, if timestamp is newer then process it and re-update the database. <br>Also you can do the mix of <code>JNotify</code> and scheduler. By jnotify you update the changed/modified file names in some <code>ADT</code>, scheduler can search inside the ADT, gets the modified files path and update those files only in database.</p> <p><br>You can take help from the below example,</p> <pre><code>public void register(String path) throws JNotifyException { int mask = JNotify.FILE_CREATED | JNotify.FILE_DELETED | JNotify.FILE_MODIFIED | JNotify.FILE_RENAMED; boolean watchSubtree = true; if (pathSet.contains(path)) { return; } System.out.println("Adding watch for: " + path); JNotify.addWatch(path, mask, watchSubtree, new JNotifyListener() { @Override public void fileCreated(int arg0, String folderName, String fileName) { fileChanged("New object created: " + fileName + " in folder: " + folderName); } @Override public void fileDeleted(int arg0, String folderName, String fileName) { fileChanged(fileName + " deleted in folder: " + folderName); } @Override public void fileModified(int arg0, String folderName, String fileName) { // fileChanged(fileName + " modified in folder: " + folderName); } @Override public void fileRenamed(int arg0, String folderName, String oldFileName, String newFileName) { fileChanged(oldFileName + " renamed to: "+ oldFileName +" in folder: " + folderName); } }); } private void fileChanged(String str){ //your code here } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload