if the watcher parameter is setted , the watch process detect modification but never send this mod to the core to rescan and update libraries watched (this has noting to do with the watched item of the PCH - trakttv)
some tasks are taken care of by Spring. So there may be some things that are never really called from within the filescanner, the idea was to have a shared "queue" of items that the filescanner finds and then a process to send those to the core.
So the part that reads the directories should add something to the queue and then the routine to read the queue send it to the core , which have to process the job.
after a big analysis, what is done
a lot of solution could solve the problem while scan / send / watch are parallel process , the one i implement is the following :
1rst mod was to adjust send mecanism which previously queued what was scanned and send to the core while looping the same action. The sendLibraries action (inside LibrarySendScheduler) was scheduled to run once (10s) for queuing and loop every 15s to finish what is queued.
This is too short (my opinion, use too much resources and fill to much the log) and start the watcher process while there is no simple way to communicate between Scanner and Watcher (call libaries from watcher failed with null pointer).
the loop (sendLibraries) as been setted now to 10 minutes. (need to be setted by parameter later).
and when the scan is complete, the send mecanism (for a short or long update) is now called out of the scheduled loop till the scanned queue is completely sended.
This is done inside sendToCore which set the sendComplete flag when the queue is empty.
Then statistics and send complete are displayed, to tell the user that the process is now complete.
Scanner (ScannerManagementImpl) could enter the watcher Spring to wait a modification inside the library watched while the above mecanism is still running.
2nd mod was to establish a communication between scanner and watcher.
As watcher could directly set info inside libraries (i don't find a way to simply write in the sending queue or any libraries, each time i got a null pointer), when something is detected watcher display what change have been modified, reset keys , and stop watching.
Inside the scanner (ScannerManagementImpl) when the watcher is ended, the scanner perform a new scan of the library which queue what is modified, then start a send to the core and rearm the watcher for a new sequence.
This is done with a new status = LOOP, because each time the watcher stopped, as the status has been setted to SUCCESS (by scan or send complete) the filescanner Spring enter a shutdown sequence and never restart watching.
NOTA:
several filescanner could start while watcher is enable , each are performed by his own.
before i update all the modification , thanks to comment.
add filescanner.wait.time to yamj3-filescanner.properties , default value is 600000 milliseconds (10 minutes)
could be modified by user in yamj3-filescanner.user.properties
if the watcher parameter is setted , the watch process detect modification but never send this mod to the core to rescan and update libraries watched (this has noting to do with the watched item of the PCH - trakttv)
some tasks are taken care of by Spring. So there may be some things that are never really called from within the filescanner, the idea was to have a shared "queue" of items that the filescanner finds and then a process to send those to the core. So the part that reads the directories should add something to the queue and then the routine to read the queue send it to the core , which have to process the job.
after a big analysis, what is done a lot of solution could solve the problem while scan / send / watch are parallel process , the one i implement is the following :
1rst mod was to adjust send mecanism which previously queued what was scanned and send to the core while looping the same action. The sendLibraries action (inside LibrarySendScheduler) was scheduled to run once (10s) for queuing and loop every 15s to finish what is queued. This is too short (my opinion, use too much resources and fill to much the log) and start the watcher process while there is no simple way to communicate between Scanner and Watcher (call libaries from watcher failed with null pointer).
the loop (sendLibraries) as been setted now to 10 minutes. (need to be setted by parameter later).
and when the scan is complete, the send mecanism (for a short or long update) is now called out of the scheduled loop till the scanned queue is completely sended. This is done inside sendToCore which set the sendComplete flag when the queue is empty. Then statistics and send complete are displayed, to tell the user that the process is now complete.
Scanner (ScannerManagementImpl) could enter the watcher Spring to wait a modification inside the library watched while the above mecanism is still running.
2nd mod was to establish a communication between scanner and watcher. As watcher could directly set info inside libraries (i don't find a way to simply write in the sending queue or any libraries, each time i got a null pointer), when something is detected watcher display what change have been modified, reset keys , and stop watching. Inside the scanner (ScannerManagementImpl) when the watcher is ended, the scanner perform a new scan of the library which queue what is modified, then start a send to the core and rearm the watcher for a new sequence. This is done with a new status = LOOP, because each time the watcher stopped, as the status has been setted to SUCCESS (by scan or send complete) the filescanner Spring enter a shutdown sequence and never restart watching.
NOTA: several filescanner could start while watcher is enable , each are performed by his own.
before i update all the modification , thanks to comment.