1
1
ShedLock [ ![ Build Status] ( https://travis-ci.org/lukas-krecan/ShedLock.png?branch=master )] ( https://travis-ci.org/lukas-krecan/ShedLock ) [ ![ Maven Central] ( https://maven-badges.herokuapp.com/maven-central/net.javacrumbs.shedlock/shedlock-parent/badge.svg )] ( https://maven-badges.herokuapp.com/maven-central/net.javacrumbs.shedlock/shedlock-parent )
2
2
========
3
3
4
- You have a simple Spring scheduler which works great until you need to run the application
5
- on multiple instances. Now what? You want to execute your tasks only once. You can use Quartz,
6
- but it's incredibly complex. You can use environment variable to determine a "scheduler master",
7
- but what if it dies? Or you can use ShedLock.
8
-
9
- ShedLock does one and only thing. It makes sure your tasks ar executed at most once. It coordinates
4
+ ShedLock does one and only thing. It makes sure your scheduled tasks ar executed at most once. It coordinates
10
5
cluster nodes using shared database. If a task is being executed on one node, it acquires a lock which
11
- prevents execution of the same task from another node (or thread). Please note, that ** if one task is already running
12
- execution from another node does not wait, it is simply skipped** .
6
+ prevents execution of the same task from another node (or thread). Please note, that ** if one task is already being
7
+ executed on one node, execution on other nodes does not wait, it is simply skipped** .
13
8
14
- Currently, only Spring scheduled tasks coordinated through Mongo or JDBC database are supported. More
9
+ Currently, only Spring scheduled tasks coordinated through Mongo, JDBC database or ZooKeeper are supported. More
15
10
scheduling and coordination mechanisms and expected in the future.
16
11
17
12
Feedback and pull-requests welcome!
@@ -23,7 +18,7 @@ Feedback and pull-requests welcome!
23
18
<dependency >
24
19
<groupId >net.javacrumbs.shedlock</groupId >
25
20
<artifactId >shedlock-spring</artifactId >
26
- <version >0.4.1 </version >
21
+ <version >0.5.0 </version >
27
22
</dependency >
28
23
```
29
24
@@ -78,7 +73,7 @@ Import the project
78
73
<dependency >
79
74
<groupId >net.javacrumbs.shedlock</groupId >
80
75
<artifactId >shedlock-provider-mongo</artifactId >
81
- <version >0.4.1 </version >
76
+ <version >0.5.0 </version >
82
77
</dependency >
83
78
```
84
79
@@ -118,7 +113,7 @@ Add dependency
118
113
<dependency >
119
114
<groupId >net.javacrumbs.shedlock</groupId >
120
115
<artifactId >shedlock-provider-jdbc-template</artifactId >
121
- <version >0.4.1 </version >
116
+ <version >0.5.0 </version >
122
117
</dependency >
123
118
```
124
119
@@ -144,7 +139,7 @@ For those who do not want to use jdbc-template, there is plain JDBC lock provide
144
139
<dependency >
145
140
<groupId >net.javacrumbs.shedlock</groupId >
146
141
<artifactId >shedlock-provider-jdbc</artifactId >
147
- <version >0.4.1 </version >
142
+ <version >0.5.0 </version >
148
143
</dependency >
149
144
```
150
145
@@ -160,7 +155,27 @@ public LockProvider lockProvider(DataSource dataSource) {
160
155
return new JdbcLockProvider (dataSource);
161
156
}
162
157
```
163
- the rest is the same as with JdbcTemplate lock provider.
158
+ the rest is the same as with JdbcTemplate lock provider.
159
+
160
+ #### ZooKeeper (using Curator)
161
+ Import
162
+ ``` xml
163
+ <dependency >
164
+ <groupId >net.javacrumbs.shedlock</groupId >
165
+ <artifactId >shedlock-provider-zookeeper-curator</artifactId >
166
+ <version >0.5.0</version >
167
+ </dependency >
168
+ ```
169
+
170
+ and configure
171
+
172
+ ``` java
173
+ @Bean
174
+ public LockProvider lockProvider(org.apache.curator.framework. CuratorFramework client) {
175
+ return new ZookeeperCuratorLockProvider (client);
176
+ }
177
+ ```
178
+ By default, ephemeral nodes for locks will be created under ` /shedlock ` node.
164
179
165
180
### Spring XML configuration
166
181
@@ -199,6 +214,9 @@ public void run() {
199
214
200
215
201
216
##Change log
217
+ ## 0.5.0
218
+ 1 . ZooKeeper nodes created under /shedlock by default
219
+
202
220
## 0.4.1
203
221
1 . JdbcLockProvider insert does not fail on DataIntegrityViolationException
204
222
0 commit comments