Java 版的 Resque jesque

码农软件 · 软件分类 · 作业/任务调度 · 2019-09-04 21:43:07

软件介绍

jesque 是 Resque 的Java语言实现版。

使用示例:

// Configuration
final Config config = new ConfigBuilder().build();
// Add a job to the queue
final Job job = new Job("TestAction", 
    new Object[]{ 1, 2.3, true, "test", Arrays.asList("inner", 4.5)});
final Client client = new ClientImpl(config);
client.enqueue("foo", job);
client.end();
// Add a job to the delayed queue
final Job job = new Job("TestAction", 
    new Object[]{ 1, 2.3, true, "test", Arrays.asList("inner", 4.5)});
final long delay = 10; // in seconds
final long future = System.currentTimeMillis() + (delay * 1000); // timestamp
final Client client = new ClientImpl(config);
client.delayedEnqueue("fooDelay", job, future);
client.end();
// Start a worker to run jobs from the queue
final Worker worker = new WorkerImpl(config, 
    Arrays.asList("foo"), new MapBasedJobFactory(map(entry("TestAction", TestAction.class))));
final Thread workerThread = new Thread(worker);
workerThread.start();
// Wait a few secs then shutdown
try { Thread.sleep((delay * 1000) + 5000); } catch (Exception e){} // Give ourselves time to process
worker.end(true);
try { workerThread.join(); } catch (Exception e){ e.printStackTrace(); }


本文地址:https://codercto.com/soft/d/13891.html

Haskell趣学指南

Haskell趣学指南

[斯洛文尼亚] Miran Lipovaca / 李亚舟、宋方睿 / 人民邮电出版社 / 2014-1

《haskell趣学指南》是一本讲解haskell这门函数式编程语言的入门指南,语言通俗易懂,插图生动幽默,示例短小清晰,结构安排合理。书中从haskell的基础知识讲起,涵盖了所有的基本概念和语法,内容涉及基本语法、递归、类型和类型类、函子、applicative 函子、monad、zipper及所有haskell重要特性和强大功能。 《haskell趣学指南》适合对函数式编程及haske......一起来看看 《Haskell趣学指南》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

随机密码生成器
随机密码生成器

多种字符组合密码