-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
356 additions
and
449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...b-lite-core/src/main/java/com/dangdang/ddframe/job/lite/internal/server/InstanceNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright 1999-2015 dangdang.com. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* </p> | ||
*/ | ||
|
||
package com.dangdang.ddframe.job.lite.internal.server; | ||
|
||
import com.dangdang.ddframe.job.lite.internal.schedule.JobRegistry; | ||
import com.dangdang.ddframe.job.lite.internal.storage.JobNodePath; | ||
|
||
/** | ||
* Elastic Job运行实例节点名称的常量类. | ||
* | ||
* @author zhangliang | ||
*/ | ||
public class InstanceNode { | ||
|
||
/** | ||
* 运行实例信息根节点. | ||
*/ | ||
public static final String ROOT = "instances"; | ||
|
||
private static final String INSTANCES = ROOT + "/%s"; | ||
|
||
private final String jobName; | ||
|
||
private final JobNodePath jobNodePath; | ||
|
||
public InstanceNode(final String jobName) { | ||
this.jobName = jobName; | ||
jobNodePath = new JobNodePath(jobName); | ||
} | ||
|
||
/** | ||
* 获取本地作业运行实例路径. | ||
* | ||
* @return 本地作业运行实例路径 | ||
*/ | ||
public String getLocalInstanceNode() { | ||
return String.format(INSTANCES, JobRegistry.getInstance().getJobInstanceId(jobName)); | ||
} | ||
|
||
static String getInstanceNode(final String jobInstanceId) { | ||
return String.format(INSTANCES, jobInstanceId); | ||
} | ||
|
||
/** | ||
* 判断给定路径是否为本地作业运行实例路径. | ||
* | ||
* @param path 待判断的路径 | ||
* @return 是否为本地作业运行实例路径 | ||
*/ | ||
public boolean isLocalInstancePath(final String path) { | ||
return path.equals(jobNodePath.getFullPath(String.format(INSTANCES, JobRegistry.getInstance().getJobInstanceId(jobName)))); | ||
} | ||
|
||
/** | ||
* 判断给定路径是否为作业运行实例路径. | ||
* | ||
* @param path 待判断的路径 | ||
* @return 是否为作业运行实例路径 | ||
*/ | ||
public boolean isInstancePath(final String path) { | ||
return path.startsWith(jobNodePath.getFullPath(InstanceNode.ROOT)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
...core/src/main/java/com/dangdang/ddframe/job/lite/internal/server/ServerOperationNode.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.