-
Notifications
You must be signed in to change notification settings - Fork 395
Job Manager Configuration
There is no one fits for all solution, especially for a Job Manager. This is why we tried to keep it as flexible as possible.
while constructing JobManager, you can provide a Configuration parameter.
-
Consumer Threads You can configure min number of consumer threads or max number of consumer threads as well as the keep alive timeout when a thread has no more jobs to consume. JobManager decides when to create a new thread based on the load factor.
-
Job Queues Job Manager comes with a memory only queue and a persistent queue written on top of Sqlite. In case you want to provide your own persistence layer or in memory queue, you can do so by providing a custom Queue Factory.
-
Job Persistence By default, Job Manager uses java serialization to persist jobs to disk. If you want to use another option (e.g. Json), you can provide a Job Serializer.
-
Network Utility By default, Job Manager queries Connectivity Manager to check if network is available or not (for network bound jobs). It also listens for
android.net.conn.CONNECTIVITY_CHANGE
event to detect network changes instantly (e.g. if you have pending network bound jobs, they will start as soon as network is recovered). If you want to customize this logic, you can provide a custom Network Util. If you do so, make sure you also implement Network Event Provider. Otherwise, JobManager will have to poll your utility and waste CPU cycles. -
Job Schedulers JobManager can work with other JobSchedulers to wake up the application when necessary. For integration, see the wiki.
-
Dependency Injection If you are using dependency injector, you can provide it via injector method. JobManager will call it before calling onAdded . If your job is persistent, it will also be called when job is deserialized from disk.
-
Multiple Job Managers In case you need multiple Job Managers, you should provide an id. This will help them identify persistence layer when application re-starts.
-
Logs To be able to see what is going on with jobs, you can provide a custom logger. Make sure your isDebugEnabled returns false on production to avoid unnecessary string generation.