executors-ninja

Parent pom for all Fizzed maven projects

License

License

Categories

Categories

Ninja User Interface Web Frameworks
GroupId

GroupId

com.fizzed
ArtifactId

ArtifactId

executors-ninja
Last Version

Last Version

0.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

executors-ninja
Parent pom for all Fizzed maven projects
Project Organization

Project Organization

Fizzed, Inc

Download executors-ninja

How to add to project

<!-- https://jarcasting.com/artifacts/com.fizzed/executors-ninja/ -->
<dependency>
    <groupId>com.fizzed</groupId>
    <artifactId>executors-ninja</artifactId>
    <version>0.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/com.fizzed/executors-ninja/
implementation 'com.fizzed:executors-ninja:0.0.5'
// https://jarcasting.com/artifacts/com.fizzed/executors-ninja/
implementation ("com.fizzed:executors-ninja:0.0.5")
'com.fizzed:executors-ninja:jar:0.0.5'
<dependency org="com.fizzed" name="executors-ninja" rev="0.0.5">
  <artifact name="executors-ninja" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.fizzed', module='executors-ninja', version='0.0.5')
)
libraryDependencies += "com.fizzed" % "executors-ninja" % "0.0.5"
[com.fizzed/executors-ninja "0.0.5"]

Dependencies

compile (1)

Group / Artifact Type Version
com.fizzed : executors-core jar 0.0.5

provided (1)

Group / Artifact Type Version
org.ninjaframework : ninja-core jar 6.0.0

test (2)

Group / Artifact Type Version
org.hamcrest : java-hamcrest jar 2.0.0.0
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Executors by Fizzed helps you build, manage, and operate long-lived workers (threads) on the JVM.

Java's standard ExecutorService and its various implementations (correctly) hide where and how your Runnable is executing. They are designed to abstract the run() method.

However, when building long-lived tasks, where some parts of your code are critical to not be interrupted (e.g. during a graceful shutdown). That's where the lack of context within your run() of how you're executing becomes a problem. This usually consists of waiting for work and being able to prevent shutdown until that work is completed.

This framework is a simple layer built on top of the ExecutorService to give your Workers the context and building blocks for rock-solid long-lived tasks.

Pattern 1: poll and accept next job (e.g. Blocking Queue)

while (!stopped) {
    job = pollAndAcceptNextJob()   // <-- critical start

if (job) {
        // handle job
}			       // <-- critical end

    sleep(2 seconds)               // <-- interrupt ok
}

Pattern 2: poll then accept next job (e.g. JMS w/ manual ack)

while (!stopped) {
    job = pollNextJob()            // <-- interrupt ok

    if (job) {
    // accept job (ack it)     // <-- critical start
        // handle job
    }                              // <-- critical end

    sleep(2 seconds)               // <-- interrupt ok
}
com.fizzed

Fizzed, Inc.

Helping companies launch and grow their mobile, web, and data products

Versions

Version
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1