ThreadExecutor

Additional

Language
Kotlin
Version
0.2.3 (Apr 10, 2017)
Created
Feb 28, 2016
Updated
Apr 10, 2017 (Retired)
Owner
Pedro Paulo Amorim (ppamorim)
Contributor
Pedro Paulo Amorim (ppamorim)
1
Activity
Badge
Generate
Download
Source code

Advertisement

ThreadExecutor

Simple library that expose the ThreadPool, using Dagger 2. Now written in Kotlin.

Why?

Are you sad to create every time the ThreadPool and MainThread to be exposed with Dagger to the application? If yes, you can use this library to reduce boilerplate.

Right now you can change any parameter of ThreadExecutor, using the exposed instance to do it.

Custom configuration

You can easily change any parameter of InteractorExecutor, just change what do you want and run build(). Unfortunately, Dagger's modules needs to be written in Java right now.

@Provides @Singleton InteractorExecutor provideThreadExecutor(ThreadExecutor executor) {
    executor.setMaxPoolSize(6)
    executor.setKeepAliveTime(240)
    return executor;
  }

Import dependency

Into your build.gradle:

repositories {
  maven {
    url "https://jitpack.io"
  }
}

dependencies {
  compile 'com.github.ppamorim:threadexecutor:0.2'
}

Contributors

License

Copyright 2017 Pedro Paulo de Amorim

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.