code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
public static String parseMillisecond2DisplayTime(String longInStr, TimeZone timezone) { if (StringUtils.isBlank(longInStr)) { return null; } return dtf.print(new DateTime(Long.parseLong(longInStr), DateTimeZone.forTimeZone(timezone))); }
Utils for saturn console. @author kfchu
parseMillisecond2DisplayTime
java
vipshop/Saturn
saturn-console-api/src/main/java/com/vip/saturn/job/console/utils/SaturnConsoleUtils.java
https://github.com/vipshop/Saturn/blob/master/saturn-console-api/src/main/java/com/vip/saturn/job/console/utils/SaturnConsoleUtils.java
Apache-2.0
public void updateJobCron(String jobName, String cron, Map<String, String> customContext) throws SaturnJobException { UpdateJobCronUtils.updateJobCron(namespace, jobName, cron, customContext); }
Provide the hook for client job callback.
updateJobCron
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/basic/SaturnApi.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/basic/SaturnApi.java
Apache-2.0
public void raiseAlarm(Map<String, Object> alarmInfo) throws SaturnJobException { // set executorName into the alarmInfo alarmInfo.put("executorName", executorName); AlarmUtils.raiseAlarm(alarmInfo, namespace); }
The hook for client job raise alarm. @param alarmInfo The alarm information.
raiseAlarm
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/basic/SaturnApi.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/basic/SaturnApi.java
Apache-2.0
public void start() throws Exception { treeCache = TreeCache.newBuilder((CuratorFramework) regCenter.getRawClient(), JobNodePath.ROOT).setExecutor( new CloseableExecutorService(Executors .newSingleThreadExecutor(new SaturnThreadFactory(executorName + "-$Jobs-watcher", false)), true)).setMaxDepth(1).bu...
record the alarm message hashcode, permanently saved, used for just raising alarm one time for one type exception
start
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java
Apache-2.0
public void shutdown() { try { if (treeCache != null) { treeCache.close(); } } catch (Throwable t) { LogUtils.error(log, LogEvents.ExecutorEvent.INIT_OR_SHUTDOWN, t.toString(), t); } try { if (executorService != null && !executorService.isTerminated()) { executorService.shutdownNow(); in...
record the alarm message hashcode, permanently saved, used for just raising alarm one time for one type exception
shutdown
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java
Apache-2.0
public boolean removeJobName(String jobName) { return jobNames.remove(jobName); }
record the alarm message hashcode, permanently saved, used for just raising alarm one time for one type exception
removeJobName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java
Apache-2.0
@Override public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception { if (event == null) { return; } ChildData data = event.getData(); if (data == null) { return; } String path = data.getPath(); if (path == null || path.equals(JobNodePath.ROOT)) { return...
record the alarm message hashcode, permanently saved, used for just raising alarm one time for one type exception
childEvent
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java
Apache-2.0
public void shutdown() throws Exception { if (isShutdown) { return; } shutdownLock.lockInterruptibly(); try { if (isShutdown) { return; } shutdown0(); restartThread.interrupt(); raiseAlarmExecutorService.shutdownNow(); shutdownJobsExecutorService.shutdownNow(); ShutdownHandler.remove...
block until all Job is completed if it is not timeout
shutdown
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
Apache-2.0
public void shutdownGracefully() throws Exception { if (isShutdown) { return; } shutdownLock.lockInterruptibly(); try { if (isShutdown) { return; } shutdownGracefully0(); restartThread.interrupt(); raiseAlarmExecutorService.shutdownNow(); shutdownJobsExecutorService.shutdownNow(); Sh...
block until all Job is completed if it is not timeout
shutdownGracefully
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
Apache-2.0
public SaturnExecutorService getSaturnExecutorService() { return saturnExecutorService; }
block until all Job is completed if it is not timeout
getSaturnExecutorService
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
Apache-2.0
public void setSaturnExecutorService(SaturnExecutorService saturnExecutorService) { this.saturnExecutorService = saturnExecutorService; }
block until all Job is completed if it is not timeout
setSaturnExecutorService
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
Apache-2.0
public String getExecutorName() { return executorName; }
block until all Job is completed if it is not timeout
getExecutorName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
Apache-2.0
public void setExecutorName(String executorName) { this.executorName = executorName; }
block until all Job is completed if it is not timeout
setExecutorName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
Apache-2.0
public String getNamespace() { return namespace; }
block until all Job is completed if it is not timeout
getNamespace
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
Apache-2.0
public void setNamespace(String namespace) { this.namespace = namespace; }
block until all Job is completed if it is not timeout
setNamespace
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/executor/SaturnExecutor.java
Apache-2.0
@Override protected void dataChanged(CuratorFramework client, TreeCacheEvent event, String path) { if (isShutdown) { return; } if (ConfigurationNode.isEnabledPath(jobName, path) && Type.NODE_UPDATED == event.getType()) { Boolean isJobEnabled = Boolean.valueOf(new String(event.getData().getData())); ...
if it's a msgJob, job should go down and up as the enabled value changed from false to true.<br> therefor, we don't care about whether the channel/queue name is changed.
dataChanged
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/ConfigurationListenerManager.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/ConfigurationListenerManager.java
Apache-2.0
private boolean isJobNotNull() { return jobScheduler != null && jobScheduler.getJob() != null; }
if it's a msgJob, job should go down and up as the enabled value changed from false to true.<br> therefor, we don't care about whether the channel/queue name is changed.
isJobNotNull
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/ConfigurationListenerManager.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/ConfigurationListenerManager.java
Apache-2.0
public boolean isDeleting() { return regCenter.isExisted(JobNodePath.getNodeFullPath(jobName, ConfigurationNode.TO_DELETE)); }
update cron cache and return it
isDeleting
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getCronFromZk() { cron = regCenter.getDirectly(JobNodePath.getNodeFullPath(jobName, ConfigurationNode.CRON)); return cron; }
update cron cache and return it
getCronFromZk
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public CoordinatorRegistryCenter getRegCenter() { return regCenter; }
update cron cache and return it
getRegCenter
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setRegCenter(CoordinatorRegistryCenter regCenter) { this.regCenter = regCenter; }
update cron cache and return it
setRegCenter
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getJobName() { return jobName; }
update cron cache and return it
getJobName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getJobClass() { return jobClass; }
update cron cache and return it
getJobClass
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setJobClass(String jobClass) { this.jobClass = jobClass; }
update cron cache and return it
setJobClass
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public int getShardingTotalCount() { return shardingTotalCount; }
update cron cache and return it
getShardingTotalCount
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setShardingTotalCount(int shardingTotalCount) { this.shardingTotalCount = shardingTotalCount; }
update cron cache and return it
setShardingTotalCount
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getTimeZone() { return timeZone; }
update cron cache and return it
getTimeZone
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setTimeZone(String timeZone) { this.timeZone = timeZone; }
update cron cache and return it
setTimeZone
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getCron() { return cron; }
update cron cache and return it
getCron
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setCron(String cron) { this.cron = cron; }
update cron cache and return it
setCron
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getPausePeriodDate() { return pausePeriodDate; }
update cron cache and return it
getPausePeriodDate
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setPausePeriodDate(String pausePeriodDate) { this.pausePeriodDate = pausePeriodDate; }
update cron cache and return it
setPausePeriodDate
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getPausePeriodTime() { return pausePeriodTime; }
update cron cache and return it
getPausePeriodTime
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setPausePeriodTime(String pausePeriodTime) { this.pausePeriodTime = pausePeriodTime; }
update cron cache and return it
setPausePeriodTime
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getShardingItemParameters() { return shardingItemParameters; }
update cron cache and return it
getShardingItemParameters
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setShardingItemParameters(String shardingItemParameters) { this.shardingItemParameters = shardingItemParameters; }
update cron cache and return it
setShardingItemParameters
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getJobParameter() { return jobParameter; }
update cron cache and return it
getJobParameter
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setJobParameter(String jobParameter) { this.jobParameter = jobParameter; }
update cron cache and return it
setJobParameter
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public int getProcessCountIntervalSeconds() { return processCountIntervalSeconds; }
update cron cache and return it
getProcessCountIntervalSeconds
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setProcessCountIntervalSeconds(int processCountIntervalSeconds) { this.processCountIntervalSeconds = processCountIntervalSeconds; }
update cron cache and return it
setProcessCountIntervalSeconds
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public boolean isFailover() { return failover; }
update cron cache and return it
isFailover
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setFailover(boolean failover) { this.failover = failover; }
update cron cache and return it
setFailover
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public boolean isEnabled() { return enabled; }
update cron cache and return it
isEnabled
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setEnabled(boolean enabled) { this.enabled = enabled; }
update cron cache and return it
setEnabled
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getDescription() { return description; }
update cron cache and return it
getDescription
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setDescription(String description) { this.description = description; }
update cron cache and return it
setDescription
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public boolean isOverwrite() { return overwrite; }
update cron cache and return it
isOverwrite
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setOverwrite(boolean overwrite) { this.overwrite = overwrite; }
update cron cache and return it
setOverwrite
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public int getTimeoutSeconds() { return timeoutSeconds; }
update cron cache and return it
getTimeoutSeconds
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setTimeoutSeconds(int timeoutSeconds) { this.timeoutSeconds = timeoutSeconds; }
update cron cache and return it
setTimeoutSeconds
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public boolean isShowNormalLog() { return showNormalLog; }
update cron cache and return it
isShowNormalLog
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setShowNormalLog(boolean showNormalLog) { this.showNormalLog = showNormalLog; }
update cron cache and return it
setShowNormalLog
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getJobType() { return jobType; }
update cron cache and return it
getJobType
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setJobType(String jobType) { this.jobType = jobType; }
update cron cache and return it
setJobType
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getQueueName() { return queueName; }
update cron cache and return it
getQueueName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setQueueName(String queueName) { this.queueName = queueName; }
update cron cache and return it
setQueueName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getChannelName() { return channelName; }
update cron cache and return it
getChannelName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setChannelName(String channelName) { this.channelName = channelName; }
update cron cache and return it
setChannelName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public Integer getLoadLevel() { return loadLevel; }
update cron cache and return it
getLoadLevel
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setLoadLevel(Integer loadLevel) { this.loadLevel = loadLevel; }
update cron cache and return it
setLoadLevel
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getPreferList() { return preferList; }
update cron cache and return it
getPreferList
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setPreferList(String preferList) { this.preferList = preferList; }
update cron cache and return it
setPreferList
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public boolean isLocalMode() { return localMode; }
update cron cache and return it
isLocalMode
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setLocalMode(boolean localMode) { this.localMode = localMode; }
update cron cache and return it
setLocalMode
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public boolean isUseSerial() { return useSerial; }
update cron cache and return it
isUseSerial
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setUseSerial(boolean useSerial) { this.useSerial = useSerial; }
update cron cache and return it
setUseSerial
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public boolean isUseDispreferList() { return useDispreferList; }
update cron cache and return it
isUseDispreferList
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setUseDispreferList(boolean useDispreferList) { this.useDispreferList = useDispreferList; }
update cron cache and return it
setUseDispreferList
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setEnabledReport(Boolean enabledReport) { this.enabledReport = enabledReport; }
update cron cache and return it
setEnabledReport
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public Boolean isEnabledReport() { return enabledReport; }
update cron cache and return it
isEnabledReport
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public String getDownStream() { return downStream; }
update cron cache and return it
getDownStream
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
public void setDownStream(String downStream) { this.downStream = downStream; }
update cron cache and return it
setDownStream
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/config/JobConfiguration.java
Apache-2.0
@Override protected void dataChanged(final CuratorFramework client, final TreeCacheEvent event, final String path) { if (isShutdown) { return; } if ((Type.NODE_ADDED == event.getType() || Type.NODE_UPDATED == event.getType()) && ServerNode .isRunOneTimePath(jobName, path, executorName)) { if (!j...
runOneTime operation.<br> once triggered, delete the node. @author chembo.huang
dataChanged
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/server/JobOperationListenerManager.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/server/JobOperationListenerManager.java
Apache-2.0
private String getTriggeredDataStr(final TreeCacheEvent event) { String transDataStr = null; try { byte[] data = event.getData().getData(); if (data != null) { transDataStr = new String(data, "UTF-8"); } } catch (UnsupportedEncodingException e) { LogUtils.error(log, jobName, "unexpected er...
runOneTime operation.<br> once triggered, delete the node. @author chembo.huang
getTriggeredDataStr
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/internal/server/JobOperationListenerManager.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/internal/server/JobOperationListenerManager.java
Apache-2.0
public String getJobName() { return jobName; }
Watchdog for shell job process, provide this function that kill process when timeout or forceStop. @author linzhaoming @author hebelala
getJobName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
public int getJobItem() { return jobItem; }
Watchdog for shell job process, provide this function that kill process when timeout or forceStop. @author linzhaoming @author hebelala
getJobItem
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
public String getExecParam() { return execParam; }
Watchdog for shell job process, provide this function that kill process when timeout or forceStop. @author linzhaoming @author hebelala
getExecParam
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
public long getPid() { return pid; }
Watchdog for shell job process, provide this function that kill process when timeout or forceStop. @author linzhaoming @author hebelala
getPid
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
public String getExecutorName() { return executorName; }
Watchdog for shell job process, provide this function that kill process when timeout or forceStop. @author linzhaoming @author hebelala
getExecutorName
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
public boolean isTimeout() { return status.get() == TIMEOUT; }
Watchdog for shell job process, provide this function that kill process when timeout or forceStop. @author linzhaoming @author hebelala
isTimeout
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
public boolean isForceStop() { return status.get() == FORCE_STOP; }
Watchdog for shell job process, provide this function that kill process when timeout or forceStop. @author linzhaoming @author hebelala
isForceStop
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
@Override public synchronized void start(final Process processToMonitor) { super.start(processToMonitor); this.monitoringProcess = processToMonitor; // get and save pid to file pid = getPidByProcess(monitoringProcess); if (hasValidPid()) { ScriptPidUtils.writePidToFile(executorName, jobName, jobItem, pid...
Watchdog for shell job process, provide this function that kill process when timeout or forceStop. @author linzhaoming @author hebelala
start
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
@Override public synchronized void destroyProcess() { status.compareAndSet(INIT, FORCE_STOP); super.destroyProcess(); }
Set status to forceStop. Destroy the running process and stop watchdog. At last, use kill, not kill -9.
destroyProcess
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
@Override public synchronized void timeoutOccured(final Watchdog w) { status.compareAndSet(INIT, TIMEOUT); try { // We must check if the process was not stopped // before being here if (monitoringProcess != null) { monitoringProcess.exitValue(); } } catch (final IllegalThreadStateException itse) ...
Set status to forceStop. Destroy the running process and stop watchdog. At last, use kill, not kill -9.
timeoutOccured
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
@Override public synchronized boolean killedProcess() { return hasKilledProcess; }
Set status to forceStop. Destroy the running process and stop watchdog. At last, use kill, not kill -9.
killedProcess
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
@Override protected synchronized void cleanUp() { super.cleanUp(); monitoringProcess = null; }
Set status to forceStop. Destroy the running process and stop watchdog. At last, use kill, not kill -9.
cleanUp
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
public static long getPidByProcess(Process p) { // linux, unix, macos should return true while calling OS.isFamilyUnix() if (!OS.isFamilyUnix()) { return INVALID_PID; } try { String clsName = "java.lang.UNIXProcess"; Class<?> cls = Class.forName(clsName); Field field = cls.getDeclaredField("pid"); ...
Set status to forceStop. Destroy the running process and stop watchdog. At last, use kill, not kill -9.
getPidByProcess
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
private boolean hasValidPid() { return pid != INVALID_PID; }
Set status to forceStop. Destroy the running process and stop watchdog. At last, use kill, not kill -9.
hasValidPid
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/shell/SaturnExecuteWatchdog.java
Apache-2.0
public void execute(Runnable command, long timeout, TimeUnit unit) { submittedCount.incrementAndGet(); try { super.execute(command); } catch (RejectedExecutionException rx) { if (super.getQueue() instanceof TaskQueue) { final TaskQueue queue = (TaskQueue) super.getQueue(); try { if (!queue.forc...
Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the <tt>Executor</tt> implementation. If no threads are available, it will be added to the work queue. If the work queue is full, the system will wait for th...
execute
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/threads/ExtendableThreadPoolExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/threads/ExtendableThreadPoolExecutor.java
Apache-2.0
@Override public void rejectedExecution(Runnable r, java.util.concurrent.ThreadPoolExecutor executor) { throw new RejectedExecutionException(); }
Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the <tt>Executor</tt> implementation. If no threads are available, it will be added to the work queue. If the work queue is full, the system will wait for th...
rejectedExecution
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/threads/ExtendableThreadPoolExecutor.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/threads/ExtendableThreadPoolExecutor.java
Apache-2.0
public void setParent(ExtendableThreadPoolExecutor tp) { parent = tp; }
As task queue specifically designed to run with a thread pool executor. The task queue is optimised to properly utilize threads within a thread pool executor. If you use a normal queue, the executor will spawn threads when there are idle threads and you wont be able to force items onto the queue itself.
setParent
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
Apache-2.0
public boolean force(Runnable o) { if (parent == null || parent.isShutdown()) { throw new RejectedExecutionException("Executor not running, can't force a command into the queue"); } return super.offer(o); // forces the item onto the queue, to be used if the task is rejected }
As task queue specifically designed to run with a thread pool executor. The task queue is optimised to properly utilize threads within a thread pool executor. If you use a normal queue, the executor will spawn threads when there are idle threads and you wont be able to force items onto the queue itself.
force
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
Apache-2.0
public boolean force(Runnable o, long timeout, TimeUnit unit) throws InterruptedException { if (parent == null || parent.isShutdown()) { throw new RejectedExecutionException("Executor not running, can't force a command into the queue"); } return super.offer(o, timeout, unit); // forces the item onto the queue,...
As task queue specifically designed to run with a thread pool executor. The task queue is optimised to properly utilize threads within a thread pool executor. If you use a normal queue, the executor will spawn threads when there are idle threads and you wont be able to force items onto the queue itself.
force
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
Apache-2.0
@Override public synchronized boolean offer(Runnable o) { // we can't do any checks if (parent == null) { return super.offer(o); } // we are maxed out on threads, simply queue the object if (parent.getPoolSize() == parent.getMaximumPoolSize()) { return super.offer(o); } // we have idle threads, jus...
As task queue specifically designed to run with a thread pool executor. The task queue is optimised to properly utilize threads within a thread pool executor. If you use a normal queue, the executor will spawn threads when there are idle threads and you wont be able to force items onto the queue itself.
offer
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
Apache-2.0
@Override public int remainingCapacity() { if (forcedRemainingCapacity != null) { // ThreadPoolExecutor.setCorePoolSize checks that // remainingCapacity==0 to allow to interrupt idle threads // I don't see why, but this hack allows to conform to this // "requirement" return forcedRemainingCapacity.int...
As task queue specifically designed to run with a thread pool executor. The task queue is optimised to properly utilize threads within a thread pool executor. If you use a normal queue, the executor will spawn threads when there are idle threads and you wont be able to force items onto the queue itself.
remainingCapacity
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
Apache-2.0
public void setForcedRemainingCapacity(Integer forcedRemainingCapacity) { this.forcedRemainingCapacity = forcedRemainingCapacity; }
As task queue specifically designed to run with a thread pool executor. The task queue is optimised to properly utilize threads within a thread pool executor. If you use a normal queue, the executor will spawn threads when there are idle threads and you wont be able to force items onto the queue itself.
setForcedRemainingCapacity
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/threads/TaskQueue.java
Apache-2.0
public static void raiseAlarm(Map<String, Object> alarmInfo, String namespace) throws SaturnJobException { int size = SystemEnvProperties.VIP_SATURN_CONSOLE_URI_LIST.size(); for (int i = 0; i < size; i++) { String consoleUri = SystemEnvProperties.VIP_SATURN_CONSOLE_URI_LIST.get(i); String targetUrl = console...
Send alarm request to Alarm API in Console.
raiseAlarm
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/utils/AlarmUtils.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/utils/AlarmUtils.java
Apache-2.0
private static void checkParameters(Map<String, Object> alarmInfo) throws SaturnJobException { if (alarmInfo == null) { throw new SaturnJobException(SaturnJobException.ILLEGAL_ARGUMENT, "alarmInfo cannot be null."); } String level = (String) alarmInfo.get("level"); if (StringUtils.isBlank(level)) { throw...
Send alarm request to Alarm API in Console.
checkParameters
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/utils/AlarmUtils.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/utils/AlarmUtils.java
Apache-2.0
public static boolean removeAllPidFile(String executorName, String jobName, int jobItem) { return removeAllPidFile(executorName, jobName, "" + Integer.toString(jobItem)); }
This method will kill all the child/grandchild/... processes. @param pid pid to kill.
removeAllPidFile
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/utils/ScriptPidUtils.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/utils/ScriptPidUtils.java
Apache-2.0
public static void killAllChildrenByPid(long pid, boolean force) { if (pid <= UNKNOWN_PID) { return; } String pidStr = Long.toString(pid) + ""; List<String> pidList = new ArrayList<>(); pidList.add(pidStr); while (null != (pidStr = exeCmdWithoutPipe(CommandLine.parse("pgrep -P " + pidStr), null, null))) ...
This method will kill all the child/grandchild/... processes. @param pid pid to kill.
killAllChildrenByPid
java
vipshop/Saturn
saturn-core/src/main/java/com/vip/saturn/job/utils/ScriptPidUtils.java
https://github.com/vipshop/Saturn/blob/master/saturn-core/src/main/java/com/vip/saturn/job/utils/ScriptPidUtils.java
Apache-2.0