io.alphatier.java.schedulers.clj Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alphatier-java Show documentation
Show all versions of alphatier-java Show documentation
Alphatier is a resource management library. It is designed to allow different schedulers to share the
resources of a pool of executors in order to execute tasks with those.
(ns io.alphatier.java.schedulers
(:import (io.alphatier.java Pool Commit CommitRejectedException)
(clojure.lang ExceptionInfo))
(:require [io.alphatier.schedulers :as schedulers]
[io.alphatier.java.mappings :as mappings])
(:gen-class
:name io.alphatier.java.InternalSchedulers
:implements [io.alphatier.java.Schedulers]))
(defn -commit [_ ^Pool pool ^Commit commit]
(try
(let [commit (mappings/from-Commit commit)]
(mappings/to-CommitResult
(schedulers/commit (.getPool pool) commit :force false)))
(catch ExceptionInfo e
(throw (CommitRejectedException.
(.getMessage e)
(mappings/to-CommitResult (ex-data e)))))))
(defn -forcedCommit [_ ^Pool pool ^Commit commit]
(mappings/to-CommitResult
(let [commit (mappings/from-Commit commit)]
(schedulers/commit (.getPool pool) commit :force true))))