Skip to content

Commit

Permalink
Fixed #189.
Browse files Browse the repository at this point in the history
  • Loading branch information
haocao committed Dec 7, 2016
1 parent fc6294b commit 71f278d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions elastic-job-doc/content/post/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ weight=1

## 2.0.4-SNAPSHOT

### 缺陷修正

1. [ISSUE #189](https://github.com/dangdangdotcom/elastic-job/issues/189) 管理后台执行失效操作,但任务还在执行

### 功能提升

1. [ISSUE #187](https://github.com/dangdangdotcom/elastic-job/issues/187) ShardingContext中增加taskId属性,供业务方使用

## 2.0.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public boolean isNeedSharding() {
public void shardingIfNecessary() {
List<String> availableShardingServers = serverService.getAvailableShardingServers();
if (availableShardingServers.isEmpty()) {
clearShardingInfo();
return;
}
if (!isNeedSharding()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ public void assertShardingWhenUnnecessary() {

@Test
public void assertShardingWithoutAvailableServers() {
when(serverService.getAllServers()).thenReturn(Arrays.asList("ip1", "ip2"));
when(serverService.getAvailableShardingServers()).thenReturn(Collections.<String>emptyList());
shardingService.shardingIfNecessary();
verify(serverService).getAvailableShardingServers();
verify(serverService).getAllServers();
verify(jobNodeStorage).removeJobNodeIfExisted("servers/ip1/sharding");
verify(jobNodeStorage).removeJobNodeIfExisted("servers/ip2/sharding");
verify(jobNodeStorage, times(0)).isJobNodeExisted("leader/sharding/necessary");
}

Expand Down

0 comments on commit 71f278d

Please sign in to comment.