helmbold / rxfilewatcher Goto Github PK
View Code? Open in Web Editor NEWConvenient file watcher with an RxJava interface, based on JDK WatchService
License: Other
Convenient file watcher with an RxJava interface, based on JDK WatchService
License: Other
A Path
for a non-default FileSystem
might be used for creation yet the created observables assumes it can watch from FileSystems.getDefault()
. The FileSystem
from the supplied Path
should be used.
Hello :) I guess you have to close WatchService after use
Currently registration of directories happens in the constructor of ObservableFactory
. This is incorrect as the observables being created are cold, not hot. Registration should be deferred until subscription happens.
The name of DirectoryObservable
in the context of RxJava messages that it is a subclass of rx.Obserable
and also that instances of it will be used by consumers (like ConnectedObservable
, BlockingObserable
, etc.) yet neither is true.
I would suggest changing the name to PathObservables
. Path
is the subject of the observables being created and the plural of Observable
indicates its a utility class with static methods. As to the method names, using something like watch
and watchRecursive
describe the implementation of the observable which takes the subject (Path
) as an argument.
As in usage place we might have no context information about the parent, and relative path not enough.
The problem here that per one instance of this we can track single directory(+recursive). So If the amount of tracking candidates vary during program lifecycle, it appears that per each I need create new Instance that will ate another thread.
But we can utilize existed thread that already created during previous instances.
And no, I am not asking for single thread per all, as this may cause StandardWatchEventKinds.OVERFLOW. Many threads is good. 1 thread per 1 folder - not so good. So having some way to alter existed watchers by adding/removing targets is best option.
Do you have try in Window or Linux OS?
When the consumer of a created observable unsubscribes the loop is not shut down.
After onError
is invoked, no events sent to onNext
or onComplete
will be sent downstream per the contract of Observable
(and enforced by RxJava's SafeSubscriber
). The loop should break, not continue if such an exception occurs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.