alexoro/named-queue-executor


Named Queue Executor (Queue over one ExecutorService)

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.alexoro:named-queue-executor:1.0'
	}
	dependencies {
		implementation("com.github.alexoro:named-queue-executor:1.0")
	}
	<dependency>
	    <groupId>com.github.alexoro</groupId>
	    <artifactId>named-queue-executor</artifactId>
	    <version>1.0</version>
	</dependency>

                            
    libraryDependencies += "com.github.alexoro" % "named-queue-executor" % "1.0"
        
        

                            
    :dependencies [[com.github.alexoro/named-queue-executor "1.0"]]
        
        

Readme


NamedQueueExecutor

Android library that implements basic queue logic over one executor. Currently, if you want to have several background queues you have to create ExecutorService for every queue. This library extends ThreadPoolExecutor and implements such multi-queue behaviour over single ThreadPoolExecutor.

How to include in project

Library is distributed via jitpack.io

// Add this lines into your roou build.gradle
allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
// Add dependency to library in any target project module
dependencies {
    compile 'com.github.alexoro:named-queue-executor:VERSION'
}

Usage

NamedQueueExecutor namedQueueExecutor = new NamedQueueExecutor();

Callable<Void> task = new Callable<Void>() {
    @Override
    public Void call() throws Exception {
        Thread.sleep(1000);
        return null;
    }
};

Future<?> future = mNamedQueueExecutor.submitNamedQueueTask(
        "CustomQueue",
        task);