proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppClientCostTimeTotalStat.java
AppClientCostTimeTotalStat
getFromAppClientCostTimeStat
class AppClientCostTimeTotalStat { private long id; /** * 应用id */ private long appId; /** * 格式yyyyMMddHHmm00 */ private long collectTime; /** * 创建时间 */ private Date createTime; /** * 命令 */ private String command; ...
AppClientCostTimeTotalStat appClientCostTimeTotalStat = new AppClientCostTimeTotalStat(); appClientCostTimeTotalStat.setAppId(stat.getAppId()); appClientCostTimeTotalStat.setCollectTime(stat.getCollectTime()); appClientCostTimeTotalStat.setCommand(stat.getCommand()); appCli...
965
427
1,392
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppClientExceptionStat.java
AppClientExceptionStat
getCollectTimeFormat
class AppClientExceptionStat { private long id; /** * 应用id */ private long appId; /** * 格式yyyyMMddHHmm00 */ private long collectTime; /** * 客户端ip */ private String clientIp; /** * 上报时间 */ private Date reportTime; ...
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); try { Date date = sdf.parse(String.valueOf(collectTime)); SimpleDateFormat newSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return newSdf.format(date); } catch (ParseException e) { ...
473
110
583
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppCommandStats.java
AppCommandStats
compareTo
class AppCommandStats implements Comparable<AppCommandStats> { /** * 应用id */ private long appId; /** * 收集时间:格式yyyyMMddHHmm/yyyyMMdd/yyyyMMddHH */ private long collectTime; /** * 命令名称 */ private String commandName; /** * 命令执行次数 */...
if (o.commandCount > this.commandCount) { return 1; } else if (o.commandCount < this.commandCount) { return -1; } return 0;
357
63
420
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppDailyData.java
AppDailyData
getValueSizeDistributeCountDesc
class AppDailyData { /** * 应用id */ private long appId; /** * 开始日期 */ private Date startDate; /** * 结束日期 */ private Date endDate; /** * 日期 */ private Date date; /** * bigkey次数 */ private long bigKeyTimes; /** * bigke...
if (MapUtils.isEmpty(valueSizeDistributeCountMap)) { return "无"; } StringBuffer desc = new StringBuffer(); for (Map.Entry<String, Long> entry : valueSizeDistributeCountMap.entrySet()) { desc.append(entry.getKey()).append(":").append(entry.getValue()).append("次<br...
945
103
1,048
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppInstanceClientRelation.java
AppInstanceClientRelation
generateFromAppClientCostTimeStat
class AppInstanceClientRelation { /** * 应用id */ private long appId; /** * 客户端ip */ private String clientIp; /** * 节点ip */ private String instanceHost; /** * 节点端口 */ private int instancePort; /** * 节点端口 */ ...
if (appClientCostTimeStat == null) { return null; } else { return new AppInstanceClientRelation(appClientCostTimeStat.getAppId(), appClientCostTimeStat.getClientIp(), appClientCostTimeStat.getInstanceHost(), appClientCostTimeStat .ge...
399
112
511
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppStats.java
AppStats
getHitPercent
class AppStats { /** * 应用id */ private long appId; /** * 收集时间:格式yyyyMMddHHmm/yyyyMMdd/yyyyMMddHH */ private long collectTime; /** * 命中数量 */ private long hits; /** * 未命中数量 */ private long misses; /** * 命令执行次数 ...
long total = hits + misses; if (total == 0) { return 0; } else { NumberFormat formatter = new DecimalFormat("0"); return NumberUtils.toLong(formatter.format(hits * 100.0 / total)); }
823
84
907
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/AppUser.java
AppUser
buildFrom
class AppUser implements Serializable { private static final long serialVersionUID = 7425158151337667662L; /** * 自增id */ @ApiModelProperty(value = "用户id",hidden = true) private Long id; /** * 用户名(英文,域账户) */ @ApiModelProperty(value = "用户名(英文,域账户)",required = tr...
AppUser appUser = new AppUser(); appUser.setId(userId); appUser.setName(name); appUser.setChName(chName); appUser.setEmail(email); appUser.setMobile(mobile); appUser.setWeChat(weChat); appUser.setType(type); appUser.setIsAlert(isAlert); ...
1,388
144
1,532
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/DeployInfo.java
DeployInfo
isSentinelNode
class DeployInfo { /** * 部署形态: 参考 ConstUtils * 2: Redis Cluster * 5: Redis+Sentinel * 7: Redis+Twemproxy * 8: Pika+Sentinel * 9: Pika+Twemproxy * 6: Redis Standalone */ private Integer deployType; /** * 分配内存大小,单位M */ private Integer memSize; /** ...
if(type == NodeEnum.SENTINEL_NODE.getValue() ){ return true; } return false;
987
36
1,023
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/InstanceAlertConfig.java
InstanceAlertConfig
getCheckCycleMillionTime
class InstanceAlertConfig { /** * 自增id */ private long id; /** * 报警配置 */ private String alertConfig; /** * 报警阀值 */ private String alertValue; /** * 详见CompareTypeEnumNew */ private int compareType; /** * 配置说明 ...
if (InstanceAlertCheckCycleEnum.ONE_MINUTE.getValue() == checkCycle) { return TimeUnit.MINUTES.toMillis(1); } else if (InstanceAlertCheckCycleEnum.FIVE_MINUTE.getValue() == checkCycle) { return TimeUnit.MINUTES.toMillis(5); } else if (InstanceAlertCheckCycleEnum.HAL...
700
241
941
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/InstanceCommandStats.java
InstanceCommandStats
compareTo
class InstanceCommandStats implements Comparable<InstanceCommandStats> { /** * 应用id */ private long instanceId; /** * 收集时间:格式yyyyMMddHHmm/yyyyMMdd/yyyyMMddHH */ private long collectTime; /** * 命令名称 */ private String commandName; /** * ...
if (o.commandCount > this.commandCount) { return 1; } else if (o.commandCount < this.commandCount) { return -1; } return 0;
433
63
496
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/InstanceConfig.java
InstanceConfig
getStatusDesc
class InstanceConfig { private long id; /** * 配置名:为了防止与key冲突 */ private String configKey; /** * 配置值:为了防止与value冲突 */ private String configValue; /** * 配置说明 */ private String info; /** * 更新时间 */ private Date updateTime;...
if (1 == status) { return "有效"; } else if (0 == status) { return "无效"; } else { return ""; }
358
56
414
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/InstanceInfo.java
InstanceInfo
setRoleDesc
class InstanceInfo implements Serializable { private static final long serialVersionUID = -903896025243493024L; /** * 实例id */ private int id; /** * 应用id */ private long appId; /** * host id */ private long hostId; /** * ip */ private String ip;...
if (isMaster == BooleanEnum.OTHER) { roleDesc = "未知"; } else if (isMaster == BooleanEnum.TRUE) { roleDesc = "master"; } else if (isMaster == BooleanEnum.FALSE) { roleDesc = "slave"; }
1,087
75
1,162
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/InstanceSlowLog.java
InstanceSlowLog
getCommand
class InstanceSlowLog { private long id; /** * 实例id */ private long instanceId; /** * app id */ private long appId; /** * ip地址 */ private String ip; /** * port */ private int port; /** * 慢查询日志id */ ...
int maxLength = 30; if (StringUtils.isNotBlank(command) && command.length() > maxLength) { return command.substring(0, maxLength) + "..."; } return command;
403
67
470
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/InstanceStats.java
InstanceStats
getHitPercent
class InstanceStats { /* id */ private long id; /* 实例id */ private long instId; /* app id */ private long appId; /* host id */ private long hostId; /* ip地址 */ private String ip; /* port */ private int port; /* 主从,1主2从 */ private byte role...
long totalHits = hits + misses; if (totalHits <= 0) { return "无命令执行"; } double percent = 100 * (double) hits / totalHits; DecimalFormat df = new DecimalFormat("##.##"); return df.format(percent) + "%";
744
95
839
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/MachineInfo.java
MachineInfo
getModifyTime
class MachineInfo { /** * 机器id */ @ApiModelProperty(hidden = true) private long id; /** * ssh用户名 */ @ApiModelProperty(hidden = true) private String sshUser; /** * ssh密码 */ @ApiModelProperty(hidden = true) private String sshPasswd; ...
if(modifyTime == null){ return null; } return (Date) modifyTime.clone();
1,677
37
1,714
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/MachineStats.java
MachineStats
validate
class MachineStats{ private long id; private long hostId; private String ip; private String cpuUsage; private String load; private String traffic; private String memoryUsageRatio; /** * 如果机器是物理机/虚机,收集内存占用空间正常;如果是容器,收集可能不是实际内存占用空间 */ private String m...
if (StringUtils.isBlank(load) && StringUtils.isBlank(cpuUsage) && StringUtils.isBlank(memoryFree) && StringUtils.isBlank(memoryTotal)) { return false; } return true;
755
77
832
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/RedisModuleConfig.java
RedisModuleConfig
getStatusDesc
class RedisModuleConfig { private long id; /** * 配置名 */ private String configKey; /** * 配置值 */ private String configValue; /** * 配置说明 */ private String info; /** * 更新时间 */ private Date updateTime; /** * Redis类型(参考ConstUtil) ...
if (1 == status) { return "有效"; } else if (0 == status) { return "无效"; } else { return ""; }
332
48
380
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/StandardStats.java
StandardStats
getInfoMap
class StandardStats { private final Logger logger = LoggerFactory.getLogger(this.getClass()); /** * id */ private long id; /** * 实例IP */ private String ip; /** * 实例端口号/hostId */ private int port; /** * 实例类型 */ private String dbType; /*...
if (infoMap != null) { return infoMap; } else { if (StringUtils.isNotBlank(infoJson)) { JSONObject jsonObject; try { jsonObject = JSONObject.fromObject(infoJson); Map<String, Object> map = transferMapByJson(...
1,195
125
1,320
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/TimeBetween.java
TimeBetween
getFormatStartDate
class TimeBetween { private long startTime; private long endTime; private Date startDate; private Date endDate; public TimeBetween() { } public TimeBetween(long startTime, long endTime, Date startDate, Date endDate) { this.startTime = startTime; this.endTime = endTime; ...
String dateFormat = "yyyy-MM-dd"; SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); if (startDate != null) { return sdf.format(startDate); } return "";
207
62
269
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/TimeDimensionality.java
TimeDimensionality
getSuitableDimensionality
class TimeDimensionality { private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final long begin; private final long end; private final int dimensionality; public TimeDimensionality(long begin, long end, String format) { Date beginDate = DateUtil.getD...
try { long s1 = begin.getTime(); long s2 = end.getTime(); long hour = (s2 - s1) / 1000 / 60 / 60; if (hour >= 48) { return AppStatsDao.HOUR_DIMENSIONALITY; } else { return AppStatsDao.MINUTE_DIMENSIONALITY; ...
395
166
561
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/TopologyExamResult.java
TopologyExamResult
getCreateTimeFormat
class TopologyExamResult { private long id; private long appId; private String type; private String status; private String description; private Date createTime; public TopologyExamResult(long appId, String type, String status, String description){ this.appId=appId; this...
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if (createTime != null) { return sdf.format(createTime); } return "";
202
58
260
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/entity/TriggerInfo.java
TriggerInfo
getPrevFireDate
class TriggerInfo { private String schedName; private String triggerName; private String triggerGroup; private String jobName; private String jobGroup; private String description; private long nextFireTime; private String nextFireDate; private long prevFireTime; private...
if (prevFireTime > 0) { return DateUtil.formatYYYYMMddHHMMSS(new Date(prevFireTime)); } return "";
375
48
423
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/inspect/InspectorJob.java
InspectorJob
action
class InspectorJob extends CacheBaseJob { private static final long serialVersionUID = -4277329946053271489L; @Override public void action(JobExecutionContext context) {<FILL_FUNCTION_BODY>} }
try { long start = System.currentTimeMillis(); SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY); Environment env = applicatio...
78
447
525
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/inspect/impl/AbstractInspectHandler.java
AbstractInspectHandler
handle
class AbstractInspectHandler implements InspectHandler { protected final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired protected InstanceDao instanceDao; @Autowired protected AsyncService asyncService; protected List<Inspector> inspectorList; protected abstr...
if (inspectorList == null || inspectorList.isEmpty()) { logger.warn("inspectorList is null"); return; } Map<String, List<InstanceInfo>> splitMap = getSplitMap(); for (Map.Entry<String, List<InstanceInfo>> entry : splitMap.entrySet()) { String s...
308
378
686
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/inspect/impl/AppClientConnInspector.java
AppClientConnInspector
inspect
class AppClientConnInspector extends BaseAlertService implements Inspector { /** * app统计相关 */ private AppStatsCenter appStatsCenter; /** * 实例统计相关 */ private InstanceStatsCenter instanceStatsCenter; @Override public boolean inspect(Map<InspectParamEnum, Object>...
Long appId = MapUtils.getLong(paramMap, InspectParamEnum.SPLIT_KEY); AppDetailVO appDetailVO = appStatsCenter.getAppDetail(appId); if (appDetailVO == null) { logger.warn("appId {} appDetailVO is empty", appId); return true; } List<InstanceInfo> app...
1,046
574
1,620
<methods>public non-sealed void <init>() <variables>protected com.sohu.cache.web.service.AppAlertRecordService appAlertRecordService,protected com.sohu.cache.alert.EmailComponent emailComponent,protected final org.slf4j.Logger logger,protected com.sohu.cache.alert.WeChatComponent weChatComponent
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/inspect/impl/AppHitPrecentInspector.java
AppHitPrecentInspector
alertAppHitPrecnt
class AppHitPrecentInspector extends BaseAlertService implements Inspector { /** * app统计相关 */ private AppStatsCenter appStatsCenter; /** * 应用相关dao */ private AppDao appDao; @Override public boolean inspect(Map<InspectParamEnum, Object> paramMap) { Long appId = Map...
AppDesc appDesc = appDetailVO.getAppDesc(); String content = String.format("应用(%s)-应用平均命中率报警-当前命中率百分之%s-现已低于预设百分之%s-请及时关注", appDesc.getAppId(), appDetailVO.getHitPercent(), appDesc.getHitPrecentAlertValue()); String title = "CacheCloud系统-应用平均命中率报警"; appAlertRecordService...
664
215
879
<methods>public non-sealed void <init>() <variables>protected com.sohu.cache.web.service.AppAlertRecordService appAlertRecordService,protected com.sohu.cache.alert.EmailComponent emailComponent,protected final org.slf4j.Logger logger,protected com.sohu.cache.alert.WeChatComponent weChatComponent
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/inspect/impl/AppInspectHandler.java
AppInspectHandler
getSplitMap
class AppInspectHandler extends AbstractInspectHandler{ private final static String inspectPoolKey="inspector-app-pool"; @Override public String getThreadPoolKey() { return inspectPoolKey; } @Override protected Map<String, List<InstanceInfo>> getSplitMap() {<FILL_FUNCTION_BODY...
List<InstanceInfo> list = getAllInstanceList(); Map<String, List<InstanceInfo>> hostMap = new TreeMap<String, List<InstanceInfo>>(); for (InstanceInfo instanceInfo : list) { String appId = String.valueOf(instanceInfo.getAppId()); if (hostMap.containsKey(appId)) { ...
101
176
277
<methods>public non-sealed void <init>() ,public List<com.sohu.cache.entity.InstanceInfo> getAllInstanceList() ,public void handle() ,public void init() ,public void setInspectorList(List<com.sohu.cache.inspect.Inspector>) <variables>protected com.sohu.cache.async.AsyncService asyncService,protected List<com.sohu.cache...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/inspect/impl/AppMemInspector.java
AppMemInspector
inspect
class AppMemInspector extends BaseAlertService implements Inspector { /** * app统计相关 */ private AppStatsCenter appStatsCenter; /** * 应用相关dao */ private AppDao appDao; /** * 实例统计相关 */ private InstanceStatsCenter instanceStatsCenter; @Override ...
Long appId = MapUtils.getLong(paramMap, InspectParamEnum.SPLIT_KEY); List<AppDesc> appDescList = new ArrayList<AppDesc>(); AppDesc app = appDao.getAppDescById(appId); if (app != null) { appDescList.add(app); } if (CollectionUtils.isEmpty(appDescList)) ...
822
655
1,477
<methods>public non-sealed void <init>() <variables>protected com.sohu.cache.web.service.AppAlertRecordService appAlertRecordService,protected com.sohu.cache.alert.EmailComponent emailComponent,protected final org.slf4j.Logger logger,protected com.sohu.cache.alert.WeChatComponent weChatComponent
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/inspect/impl/HostInspectHandler.java
HostInspectHandler
getSplitMap
class HostInspectHandler extends AbstractInspectHandler{ private final static String inspectPoolKey="inspector-host-pool"; @Override public String getThreadPoolKey() { return inspectPoolKey; } @Override protected Map<String, List<InstanceInfo>> getSplitMap() {<FILL_FUNCTION_BO...
List<InstanceInfo> list = getAllInstanceList(); Map<String, List<InstanceInfo>> hostMap = new TreeMap<String, List<InstanceInfo>>(); for (InstanceInfo instanceInfo : list) { String host = instanceInfo.getIp(); if (hostMap.containsKey(host)) { hostMa...
101
167
268
<methods>public non-sealed void <init>() ,public List<com.sohu.cache.entity.InstanceInfo> getAllInstanceList() ,public void handle() ,public void init() ,public void setInspectorList(List<com.sohu.cache.inspect.Inspector>) <variables>protected com.sohu.cache.async.AsyncService asyncService,protected List<com.sohu.cache...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/inspect/impl/InstanceRunInspector.java
InstanceRunInspector
saveFault
class InstanceRunInspector extends BaseAlertService implements Inspector { /** * 实例相关 */ @Autowired private InstanceDao instanceDao; /** * redis相关 */ @Autowired private RedisCenter redisCenter; /** * 应用相关dao */ @Autowired private AppDao appDao; @A...
InstanceFault instanceFault = new InstanceFault(); instanceFault.setAppId((int) info.getAppId()); instanceFault.setInstId(info.getId()); instanceFault.setIp(info.getIp()); instanceFault.setPort(info.getPort()); instanceFault.setType(info.getType()); instanceFault...
1,291
163
1,454
<methods>public non-sealed void <init>() <variables>protected com.sohu.cache.web.service.AppAlertRecordService appAlertRecordService,protected com.sohu.cache.alert.EmailComponent emailComponent,protected final org.slf4j.Logger logger,protected com.sohu.cache.alert.WeChatComponent weChatComponent
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/inspect/impl/InstanceStateInspector.java
InstanceStateInspector
inspect
class InstanceStateInspector extends BaseAlertService { /** * 实例相关 */ @Autowired private InstanceDao instanceDao; @Autowired private AppService appService; @Autowired private UserService userService; @Autowired private Configuration configuration; public boolean inspe...
List<InstanceAlertValueResult> alertInstInfo = new ArrayList<>(); List<InstanceInfo> heartStopInstances = instanceDao.getAllHeartStopInstance(); if (!CollectionUtils.isEmpty(heartStopInstances)) { for (InstanceInfo info : heartStopInstances) { long appId = info.getA...
107
382
489
<methods>public non-sealed void <init>() <variables>protected com.sohu.cache.web.service.AppAlertRecordService appAlertRecordService,protected com.sohu.cache.alert.EmailComponent emailComponent,protected final org.slf4j.Logger logger,protected com.sohu.cache.alert.WeChatComponent weChatComponent
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/interceptor/AppAndInstanceAuthorityInterceptor.java
AppAndInstanceAuthorityInterceptor
preHandle
class AppAndInstanceAuthorityInterceptor extends HandlerInterceptorAdapter { private Logger logger = LoggerFactory.getLogger(AppAndInstanceAuthorityInterceptor.class); @Autowired private AppService appService; @Autowired private UserService userService; @Autowired private InstanceStat...
// 1. 获取用户 String userName = userLoginStatusService.getUserNameFromLoginStatus(request); //未登录 if (StringUtils.isBlank(userName)) { String redirectUrl = userLoginStatusService.getRedirectUrl(request); response.sendRedirect(redirectUrl); return ...
541
417
958
<methods>public void <init>() ,public void afterCompletion(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception) throws java.lang.Exception,public void afterConcurrentHandlingStarted(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResp...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/interceptor/FrontUserLoginInterceptor.java
FrontUserLoginInterceptor
preHandle
class FrontUserLoginInterceptor extends HandlerInterceptorAdapter { @Autowired private UserService userService; @Autowired private UserLoginStatusService userLoginStatusService; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Obje...
String userName = userLoginStatusService.getUserNameFromLoginStatus(request); //未登录 if (StringUtils.isBlank(userName)) { String redirectUrl = userLoginStatusService.getRedirectUrl(request); response.sendRedirect(redirectUrl); return false; } ...
101
210
311
<methods>public void <init>() ,public void afterCompletion(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception) throws java.lang.Exception,public void afterConcurrentHandlingStarted(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResp...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/interceptor/ManageUserLoginInterceptor.java
ManageUserLoginInterceptor
preHandle
class ManageUserLoginInterceptor extends HandlerInterceptorAdapter { private Logger logger = LoggerFactory.getLogger(ManageUserLoginInterceptor.class); @Autowired private UserService userService; @Autowired private UserLoginStatusService userLoginStatusService; @Override public ...
String userName = userLoginStatusService.getUserNameFromLoginStatus(request); //未登录 if (StringUtils.isBlank(userName)) { String redirectUrl = userLoginStatusService.getRedirectUrl(request); response.sendRedirect(redirectUrl); return false; } ...
221
287
508
<methods>public void <init>() ,public void afterCompletion(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception) throws java.lang.Exception,public void afterConcurrentHandlingStarted(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResp...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/log/CustLogAppenderInit.java
CustLogAppenderInit
run
class CustLogAppenderInit implements ApplicationRunner{ @Autowired private TaskFlowRecordAppender taskFlowRecordAppender; private final org.slf4j.Logger logger = LoggerFactory.getLogger(CustLogAppenderInit.class); @Override public void run(ApplicationArguments args) throws Exception {<FILL_FUNCTI...
logger.warn("custLogAppender init begin!"); if (LoggerFactory.getILoggerFactory() instanceof LoggerContext) { LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); //自定义任...
96
193
289
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/log/TaskFlowRecordAppender.java
TaskFlowRecordAppender
generateCustomLog
class TaskFlowRecordAppender extends AppenderBase<ILoggingEvent> { @Autowired private AssistRedisService assistRedisService; @Override protected void append(ILoggingEvent event) { if (event == null) { return; } Marker marker = event.getMarker(); if (marker !...
Date date = new Date(event.getTimeStamp()); String formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(date); String threadName = event.getThreadName(); String logLevel = event.getLevel().toString(); String className = event.getLoggerName(); String simple...
311
148
459
<methods>public void <init>() ,public void addFilter(Filter<ch.qos.logback.classic.spi.ILoggingEvent>) ,public void clearAllFilters() ,public synchronized void doAppend(ch.qos.logback.classic.spi.ILoggingEvent) ,public List<Filter<ch.qos.logback.classic.spi.ILoggingEvent>> getCopyOfAttachedFiltersList() ,public ch.qos....
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/machine/MachineProperty.java
MachineProperty
compare
class MachineProperty implements Comparator<MachineProperty>, Serializable { private static final long serialVersionUID = 2498956982032225654L; private long hostId; private long memory; private double traffic; private double load; public MachineProperty() { } public MachineProperty(lo...
return ComparisonChain.start() .compare(o1.traffic, o2.traffic) .compare(o1.load, o2.load) .compare(o2.memory, o1.memory) .result();
348
64
412
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/machine/PortGenerator.java
PortGenerator
getRedisPort
class PortGenerator { private static Logger logger = LoggerFactory.getLogger(PortGenerator.class); /** * redis port常量 */ private static final Integer REDIS_START_PORT = 6379; private static AtomicLongMap<String> redisPortHolder = AtomicLongMap.create(); /** * 返回一个redis的可用端口:...
if (redisPortHolder.get(ip) == 0L) { redisPortHolder.put(ip, REDIS_START_PORT); } String maxPortStr = ""; try { int sshPort = SSHUtil.getSshPort(ip); maxPortStr = getMaxPortStr(ip, sshPort); } catch (SSHException e) { logg...
1,031
498
1,529
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/machine/impl/MachineCenterImpl.java
MachinetaskCallable
call
class MachinetaskCallable implements Callable<Map<String, Object>> { private String ip; private String cmd; private SSHService sshService; private String type; public MachinetaskCallable(String ip, String cmd, SSHService sshService, String type) { this.ip = ip; ...
Map<String, Object> machineResult = new HashMap<String, Object>(); String info = null; try { info = sshService.execute(ip, cmd); machineResult.put("ip", ip); if (!StringUtil.isBlank(info)) { if (type.equals(Machine...
140
441
581
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/machine/impl/MachineDeployCenterImpl.java
MachineDeployCenterImpl
removeMachineRoom
class MachineDeployCenterImpl implements MachineDeployCenter { private Logger logger = LoggerFactory.getLogger(MachineDeployCenterImpl.class); @Autowired private MachineDao machineDao; @Autowired private MachineRoomDao machineRoomDao; @Autowired private MachineStatsDao machineStatsDao; @...
try { machineRoomDao.removeRoom(roomId); } catch (Exception e) { logger.error("remove machineRoom from db error, machineRoom: {}", roomId, e); return false; } logger.info("remove machineRoom ok: {}", roomId); return true;
1,222
86
1,308
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/protocol/MachineProtocol.java
MachineProtocol
getDir
class MachineProtocol { /** * 统一的目录结构 */ public static final String CONF_DIR = ConstUtils.CACHECLOUD_BASE_DIR + "/cachecloud/conf/"; public static final String DATA_DIR = ConstUtils.CACHECLOUD_BASE_DIR + "/cachecloud/data/"; public static final String LOG_DIR = ConstUtils.CACHECLOUD_BA...
if (dirType == DirEnum.CONF_DIR.getValue()) { return CONF_DIR; } else if (dirType == DirEnum.DATA_DIR.getValue()) { return DATA_DIR; } else if (dirType == DirEnum.LOG_DIR.getValue()) { return LOG_DIR; } return null;
836
99
935
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/protocol/RedisProtocol.java
RedisProtocol
getConfig
class RedisProtocol { private static final String RUN_SHELL_VERSION = "%s/src/redis-server %s > " + MachineProtocol.LOG_DIR + "redis-%d-%s.log 2>&1 &"; private static final String SENTINEL_SHELL_VERSION = "%s/src/redis-sentinel %s --sentinel > " + MachineProtocol.LOG_DIR + "redis-sentinel-%d-%s.log 2>&1 &...
if (isCluster) { return String.format(CLUSTER_CONFIG, port); } else { return String.format(COMMON_CONFIG, port); }
1,756
54
1,810
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/redis/RedisClusterNode.java
RedisClusterNode
toString
class RedisClusterNode { /** * 主节点地址 */ private String masterHost; /** * 从节点地址 */ private String slaveHost; public String getMasterHost() { return masterHost; } public void setMasterHost(String masterHost) { this.masterHost = masterHos...
return "RedisClusterNode{" + "masterHost='" + masterHost + '\'' + ", slaveHost='" + slaveHost + '\'' + '}';
264
51
315
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/redis/util/AuthUtil.java
AuthUtil
getAppIdMD5
class AuthUtil { //客户端埋点SECRET_KEY,如果使用动态密码,建议客户端自行修改 public final static String SECRET_KEY = "asdfjlajrl2k3jflsdafjal$$$asfdf"; public final static String SPLIT_KEY = ":cc:"; /** * 密码判定 * 初始化用例: * 1:redis未设置密码,未设置password参数 * 2:redis未设置密码,设置password参数:原文 * 3:redis未设置密码,设置passw...
String key = SECRET_KEY + ":" + appId; try { //确定计算方法 MessageDigest md5 = MessageDigest.getInstance("MD5"); byte[] md5Bytes = md5.digest(key.getBytes("UTF-8")); StringBuffer hexValue = new StringBuffer(); for (int i = 0; i < md5Bytes.length; i...
979
196
1,175
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/redis/util/ClusterNodeInformationParser.java
ClusterNodeInformationParser
parse
class ClusterNodeInformationParser { private static final String SLOT_IMPORT_IDENTIFIER = "-<-"; private static final String SLOT_IN_TRANSITION_IDENTIFIER = "["; public static final int SLOT_INFORMATIONS_START_INDEX = 8; public static final int HOST_AND_PORT_INDEX = 1; public ClusterNodeInformation parse(Str...
String[] nodeInfoPartArray = nodeInfo.split(" "); HostAndPort node = getHostAndPortFromNodeLine(nodeInfoPartArray, current); ClusterNodeInformation info = new ClusterNodeInformation(node); if (nodeInfoPartArray.length >= SLOT_INFORMATIONS_START_INDEX) { String[] slotInfoPartArray = extractSlotP...
720
126
846
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/redis/util/JedisUtil.java
JedisUtil
latencyLatest
class JedisUtil { public static final String SENTINEL_FLUSH_CONFIG = "flushconfig"; public static List<LatencyItem> latencyLatest(Jedis jedis){<FILL_FUNCTION_BODY>} public static String sentinelFlushConfig(Jedis jedis){ Client client = jedis.getClient(); client.sentinel(SENTINEL_FLUSH_CON...
Client client = jedis.getClient(); client.sendCommand(Command.LATENCY, Keyword.LATEST.raw); List<LatencyItem> latencyItems = LatencyItem.from(client.getObjectMultiBulkReply()); return latencyItems;
180
71
251
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/redis/util/LatencyHistoryItem.java
LatencyHistoryItem
from
class LatencyHistoryItem { private final long timeStamp; private final long executionTime; private static final String COMMA = ","; @SuppressWarnings("unchecked") public LatencyHistoryItem(List<Object> properties) { super(); this.timeStamp = (Long) properties.get(0); this.e...
List<LatencyHistoryItem> items = new ArrayList<>(nestedMultiBulkReply.size()); for (Object obj : nestedMultiBulkReply) { List<Object> properties = (List<Object>) obj; items.add(new LatencyHistoryItem(properties)); } return items;
239
82
321
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/redis/util/LatencyItem.java
LatencyItem
from
class LatencyItem { private final String event; private final long timeStamp; private final long latestExecutionTime; private final long maxExecutionTime; private static final String COMMA = ","; @SuppressWarnings("unchecked") private LatencyItem(List<Object> properties) { super();...
List<LatencyItem> items = new ArrayList<>(nestedMultiBulkReply.size()); for (Object obj : nestedMultiBulkReply) { List<Object> properties = (List<Object>) obj; items.add(new LatencyItem(properties)); } return items;
353
80
433
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/redis/util/PipelineUtil.java
PipelineUtil
joinParameters
class PipelineUtil { public static Response<Object> latencyHistory(Pipeline pipeline, String event){ return pipeline.sendCommand(Command.LATENCY, Keyword.HISTORY.raw, SafeEncoder.encode(event)); } public static Response<Object> latencyReset(Pipeline pipeline, String event){ return pipeline...
byte[][] result = new byte[rest.length + 1][]; result[0] = first; System.arraycopy(rest, 0, result, 1, rest.length); return result;
343
55
398
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/redis/util/ProtostuffSerializer.java
ProtostuffSerializer
deserialize
class ProtostuffSerializer { private static ConcurrentHashMap<Class<?>, Schema<?>> cachedSchema = new ConcurrentHashMap<Class<?>, Schema<?>>(); public <T> byte[] serialize(final T source) { VO<T> vo = new VO<T>(source); final LinkedBuffer buffer = LinkedBuffer.allocate(LinkedBuffer.DEFAULT_BU...
try { Schema<VO> schema = getSchema(VO.class); VO vo = deserializeInternal(bytes, schema.newMessage(), schema); if (vo != null && vo.getValue() != null) { return (T) vo.getValue(); } } catch (final Exception e) { throw new Ille...
431
106
537
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/redis/util/VO.java
VO
equals
class VO<T> implements Serializable { private T value; public VO(T value) { this.value = value; } public VO() { } public T getValue() { return value; } @Override public String toString() { return "VO{" + "value=" + value + ...
if (this == o) return true; if (!(o instanceof VO)) return false; VO vo = (VO) o; if (value != null ? !value.equals(vo.value) : vo.value != null) return false; return true;
167
72
239
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/brevity/BrevitySchedulerJob.java
BrevitySchedulerJob
action
class BrevitySchedulerJob extends CacheBaseJob { private static final long serialVersionUID = 2626836144949582163L; /** * 维护短频任务 * * @param context */ @Override public void action(JobExecutionContext context) {<FILL_FUNCTION_BODY>} }
try { SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY); BrevityScheduler brevityScheduler = applicationContext.getBean(BrevityScheduler.class); ...
98
115
213
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/brevity/DispatcherBrevityScheduleJob.java
DispatcherBrevityScheduleJob
action
class DispatcherBrevityScheduleJob extends CacheBaseJob { private static final long serialVersionUID = 2626836144949582163L; /** * 维护短频任务 * * @param context */ @Override public void action(JobExecutionContext context) {<FILL_FUNCTION_BODY>} }
try { SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY); BrevityScheduler brevityScheduler = applicationContext.getBean(BrevityScheduler.class); ...
100
115
215
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/impl/SchedulerCenterImpl.java
SchedulerCenterImpl
getTrigger
class SchedulerCenterImpl implements SchedulerCenter { private Logger logger = LoggerFactory.getLogger(this.getClass()); // 注入预定义的scheduler @Autowired private Scheduler clusterScheduler; @Autowired private QuartzDao quartzDao; /** * 删除trigger * * @param triggerKe...
Trigger trigger = null; try { trigger = clusterScheduler.getTrigger(triggerKey); } catch (SchedulerException e) { logger.error(e.getMessage(), e); } return trigger;
662
69
731
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/impl/TriggerCenterImpl.java
TriggerCenterImpl
getTriggersByJobGroup
class TriggerCenterImpl implements TriggerCenter { private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private Scheduler clusterScheduler; @Autowired private QuartzDao quartzDao; /** * 暂停trigger * * @param triggerKey * @return 操作成功返回true,否...
List<TriggerInfo> triggersOfGroup = null; try { triggersOfGroup = quartzDao.getTriggersByJobGroup(jobGroup); } catch (Exception e) { logger.error("jobGroup: {}", jobGroup, e); } return triggersOfGroup;
879
86
965
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/AppDailyJob.java
AppDailyJob
action
class AppDailyJob extends CacheBaseJob { private static final long serialVersionUID = 7751425759758902400L; @Override public void action(JobExecutionContext context) {<FILL_FUNCTION_BODY>} }
try { SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY); Environment env = applicationContext.getBean(Environment.class); if (EnvUtil...
74
206
280
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/CacheBaseJob.java
CacheBaseJob
execute
class CacheBaseJob implements Job, Serializable { private static final long serialVersionUID = -6605766126594260961L; protected Logger logger = LoggerFactory.getLogger(this.getClass()); protected final static String APPLICATION_CONTEXT_KEY = "applicationContext"; // 抽象方法,由子类实现,即具体的业务逻辑 publ...
long start = System.currentTimeMillis(); this.action(context); long cost = System.currentTimeMillis() - start; if (cost > 2000) { logger.warn("slowJob: job: {}, trigger: {}, cost: {} ms", context.getJobDetail().getKey(), context.getTrigger().getKey(...
194
150
344
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/CleanupDayAppClientStatJob.java
CleanupDayAppClientStatJob
action
class CleanupDayAppClientStatJob extends CacheBaseJob { private static final long serialVersionUID = 8815839394475276540L; /** * 清除命令统计&异常统计 */ private static int BATCH_SIZE = 1000; private static final String CLEAN_APP_CLIENT_COMMAND_MINUTE_STATISTICS = "delete from app_client_command_minute_...
if (!ConstUtils.WHETHER_SCHEDULE_CLEAN_DATA) { logger.warn("whether_schedule_clean_data is false , ignored"); return; } try { logger.warn("begin-CleanupDayAppClientStatJob"); SchedulerContext schedulerContext = context.getScheduler().getContext();...
467
762
1,229
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/CleanupDayDimensionalityJob.java
CleanupDayDimensionalityJob
action
class CleanupDayDimensionalityJob extends CacheBaseJob { private static final long serialVersionUID = 8815839394475276540L; private static int BATCH_SIZE = 1000; private static final String CLEAN_APP_HOUR_COMMAND_STATISTICS = "delete from app_hour_command_statistics where create_time < ? limit " + BATCH_...
if (!ConstUtils.WHETHER_SCHEDULE_CLEAN_DATA) { logger.warn("whether_schedule_clean_data is false , ignored"); return; } try { SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (Applica...
565
1,184
1,749
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/CleanupMinuteDimensionalityJob.java
CleanupMinuteDimensionalityJob
action
class CleanupMinuteDimensionalityJob extends CacheBaseJob { private static final long serialVersionUID = 8815839394475276540L; /** * 实例基准数据,主要用于报警 */ private static final String CLEAN_STANDARD_STATISTICS = "delete from standard_statistics where collect_time < ?"; @Override pub...
if (!ConstUtils.WHETHER_SCHEDULE_CLEAN_DATA) { logger.warn("whether_schedule_clean_data is false , ignored"); return; } try { SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (...
145
317
462
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/ExpAppsDailyJob.java
ExpAppsDailyJob
action
class ExpAppsDailyJob extends CacheBaseJob { private static final long serialVersionUID = 8864245475347417291L; @Override public void action(JobExecutionContext context) {<FILL_FUNCTION_BODY>} }
try { SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY); Environment env = applicationContext.getBean(Environment.class); if (EnvUtil...
77
226
303
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/GatherAppClientStatisticsJob.java
GatherAppClientStatisticsJob
fillWithDateFormat
class GatherAppClientStatisticsJob extends CacheBaseJob { private static final long serialVersionUID = 8815839394475276540L; private final static String COLLECT_TIME_FORMAT = "yyyyMMddHHmm00"; @Override public void action(JobExecutionContext context) { try { logger.warn("begin-gathe...
Date endDate = DateUtils.addMinutes(new Date(), -5); Date startDate = DateUtils.addMinutes(endDate, -5); long startTime = NumberUtils.toLong(DateUtil.formatDate(startDate, COLLECT_TIME_FORMAT)); long endTime = NumberUtils.toLong(DateUtil.formatDate(endDate, COLLECT_TIME_FORMAT)); ...
346
117
463
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/InstanceAlertValueJob.java
InstanceAlertValueJob
action
class InstanceAlertValueJob extends CacheBaseJob { private static final long serialVersionUID = 1035952011763660681L; @Override public void action(JobExecutionContext context) {<FILL_FUNCTION_BODY>} }
try { long startTime = System.currentTimeMillis(); SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY); Environment env = applic...
82
239
321
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/InstanceStatJob.java
InstanceStatJob
action
class InstanceStatJob extends CacheBaseJob{ @Override public void action(JobExecutionContext context) {<FILL_FUNCTION_BODY>} }
try { long startTime = System.currentTimeMillis(); SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY); Environment env = application...
41
209
250
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/ReviseAppClientStatisGatherJob.java
ReviseAppClientStatisGatherJob
fillWithDateFormat
class ReviseAppClientStatisGatherJob extends CacheBaseJob { private static final long serialVersionUID = -5968147536403452672L; private final static String COLLECT_TIME_FORMAT = "yyyyMMdd000000"; @Override public void action(JobExecutionContext context) { try { logger.warn("begin-r...
Date endDate = new Date(); Date startDate = DateUtils.addDays(endDate, -1); long startTime = NumberUtils.toLong(DateUtil.formatDate(startDate, COLLECT_TIME_FORMAT)); long endTime = NumberUtils.toLong(DateUtil.formatDate(endDate, COLLECT_TIME_FORMAT)); return new TimeBetween(star...
353
107
460
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/SystemConfigRefreshJob.java
SystemConfigRefreshJob
action
class SystemConfigRefreshJob extends CacheBaseJob { private static final long serialVersionUID = 7751425759758902400L; @Override public void action(JobExecutionContext context) {<FILL_FUNCTION_BODY>} }
try { SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY); ConfigService configService = applicationContext.getBean("configService", ConfigServ...
81
121
202
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/TaskExecuteJob.java
TaskExecuteJob
action
class TaskExecuteJob extends CacheBaseJob { private static final long serialVersionUID = -1697673324465500314L; @Override public void action(JobExecutionContext context) {<FILL_FUNCTION_BODY>} }
long startTime = System.currentTimeMillis(); logger.warn("TaskExecuteJob start"); try { SchedulerContext schedulerContext = context.getScheduler().getContext(); ApplicationContext applicationContext = (ApplicationContext) schedulerContext.get(APPLICATION_CONTEXT_KEY); Ta...
76
160
236
<methods>public non-sealed void <init>() ,public abstract void action(JobExecutionContext) ,public void execute(JobExecutionContext) throws JobExecutionException<variables>protected static final java.lang.String APPLICATION_CONTEXT_KEY,protected org.slf4j.Logger logger,private static final long serialVersionUID
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/server/ServerStatusCollector.java
ServerStatusCollector
asyncFetchServerStatus
class ServerStatusCollector { private static final Logger logger = LoggerFactory.getLogger(ServerStatusCollector.class); //获取监控结果 public static final String COLLECT_SERVER_STATUS = "[ -e \"" + NMONService.SOCK_LOG + "\" ] && /bin/cat " + NMONService.SOCK_LOG + " >> " + NMONService.NMON_LOG...
String key = "collect-server-" + ip; asyncService.submitFuture(AsyncThreadPoolFactory.MACHINE_POOL, new KeyCallable<Boolean>(key) { public Boolean execute() { try { fetchServerStatus(ip); return true; } catch (Ex...
1,080
119
1,199
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/server/data/CPU.java
Usage
toString
class Usage{ //代表那个cpu private String name; //用户空间使用率 private float user; //内核空间使用率 private float sys; //wio private float wait; public float getUser() { return user; } public void setUser(float user) { this.user = user; } public float getSys() { return sys; } pu...
return "Usage [name=" + name + ", user=" + user + ", sys=" + sys + ", wait=" + wait + "]";
270
44
314
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/server/data/Connection.java
Connection
parse
class Connection implements LineParser{ public static final String FLAG = "TCP"; private int established; private int timeWait; private int orphan; /** * line format: * TCP: inuse 454 orphan 0 tw 159620 alloc 454 mem 79 */ public void parse(String line, String timeKey) throws Exception{<FILL_...
if(line.startsWith(FLAG)) { String[] items = line.split("\\s+"); for(int i = 0; i < items.length; ++i) { if(items[i].equals("inuse")) { established = NumberUtils.toInt(items[i+1]); } else if(items[i].equals("orphan")) { orphan = NumberUtils.toInt(items[i+1]); } else if(items[i].eq...
186
170
356
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/server/data/Load.java
Load
toString
class Load implements LineParser{ public static final Pattern PATTERN = Pattern.compile( "^BBBP,[0-9]+,uptime,.*(\\d+\\.\\d+), (\\d+\\.\\d+), (\\d+\\.\\d+)"); //1分钟负载 private float load1; //5分钟负载 private float load5; //15分钟负载 private float load15; /** * line format: * BBBP,585,uptime," 09:3...
return "Load [load1=" + load1 + ", load5=" + load5 + ", load15=" + load15 + "]";
398
45
443
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/server/data/Memory.java
Memory
toString
class Memory implements LineParser{ public static final String FLAG = "MEM"; //总内存,单位M private float total; //总空闲内存,单位M private float totalFree; //buffer,单位M private float buffer; //cache,单位M private float cache; //swap,单位M private float swap; //swap空闲内存,单位M private float swapFree; /** ...
return "Memory [total=" + total + ", totalFree=" + totalFree + ", buffer=" + buffer + ", cache=" + cache + ", swap=" + swap + ", swapFree=" + swapFree + "]";
619
65
684
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/server/data/Net.java
Net
caculate
class Net implements LineParser{ public static final String FLAG = "NET,"; private float nin; private float nout; private StringBuilder ninDetail = new StringBuilder(); private StringBuilder noutDetail = new StringBuilder(); private List<NetworkInterfaceCard> ncList = new ArrayList<NetworkInterfaceCar...
float totalIn = 0; float totalOut = 0; for(NetworkInterfaceCard nic : ncList) { String[] array = nic.getName().split("-"); if("read".equals(array[1])) { ninDetail.append(array[0]); ninDetail.append(","); ninDetail.append(nic.getValue()); ninDetail.append(";"); totalIn += nic.g...
783
294
1,077
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/server/data/OS.java
OS
toString
class OS { //操作系统类型 private OSType osType; //发行版本 private DistributionType distributionType; //发行版本号 private DistributionVersion distributionVersion; //处理器架构 private ProcessorArchitecture processorArchitecture; public OS(OSType osType, DistributionType distributionType, DistributionVersion dist...
return "OS [osType=" + osType + ", dist=" + distributionType + ", version=" + distributionVersion + ", bit=" + processorArchitecture + "]";
412
56
468
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/server/nmon/NMONService.java
NMONService
start
class NMONService { private static final Logger logger = LoggerFactory.getLogger(NMONService.class); //获取系统版本位数命令 public static final String OS_INFO_CMD = "/bin/uname -a; /bin/cat /etc/issue"; //nmon路径 public static final String NMON_DIR = "/opt/cachecloud/soft/"; //nmon文件名 public sta...
Result startCollectResult = session.executeCommand(START_SERVER_COLLECT); if (!startCollectResult.isSuccess()) { logger.error("start nmon " + ip + " err:" + startCollectResult.getResult(), startCollectResult.getExcetion()); //执行命令没有发生异常,则nmon可能不存在或有问题 ...
1,614
147
1,761
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/ssh/SSHClient.java
SSHClient
connect
class SSHClient { // 服务器 ssh 用户 private String serverUser; // 服务器 ssh 密码 private String serverPassword; // 服务器 ssh 端口 private Integer serverPort; // 服务器 ssh 链接建立超时时间 private Integer serverConnectTimeout; // 服务器 ssh 操作超时时间 private Integer serverOPTimeout; // 服务器 ssh 私钥 ...
ClientSession session = getClient().connect(getServerUser(), ip, getServerPort()).verify(getServerConnectTimeout(), TimeUnit.MILLISECONDS).getSession(); session.auth().verify(getServerConnectTimeout(), TimeUnit.MILLISECONDS); return session;
435
72
507
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/ssh/SSHMachineInfo.java
SSHMachineInfo
equals
class SSHMachineInfo { /** * ip */ private String ip; /** * 用户名 */ private String username; /** * 登录方式 */ private int authType; /** * 密码 */ private String password; @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} ...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SSHMachineInfo that = (SSHMachineInfo) o; return authType == that.authType && Objects.equals(ip, that.ip) && Objects.equals(password, that.password) && Objects.equals(username, that.username);
144
96
240
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/ssh/SSHServiceImpl.java
SSHServiceImpl
matchCpuLine
class SSHServiceImpl implements SSHService { private Logger logger = LoggerFactory.getLogger(SSHServiceImpl.class); @Autowired private MachineDao machineDao; private Map<String, MachineInfo> machineIpInfoMap = new ConcurrentHashMap<String, MachineInfo>(); private Map<String, Long> appNa...
String result = EMPTY_STRING; if (content == null || EMPTY_STRING.equals(content.trim())) { return result; } Pattern pattern = Pattern.compile("(\\d+).(\\d+)"); Matcher matcher = pattern.matcher(content); if (matcher.find()) { result = mat...
1,667
117
1,784
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/ssh/SSHSessionPooledObjectFactory.java
SSHSessionPooledObjectFactory
makeObject
class SSHSessionPooledObjectFactory implements KeyedPooledObjectFactory<SSHMachineInfo, ClientSession> { private final Logger logger = LoggerFactory.getLogger(getClass()); private SSHClient sshClient; public SSHSessionPooledObjectFactory() throws GeneralSecurityException, IOException { sshClient ...
int port = ConstUtils.SSH_PORT_DEFAULT; ClientSession session = sshClient.getClient().connect(ConstUtils.USERNAME, sshMachineInfo.getIp(), port).verify(ConstUtils.SSH_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS).getSession(); session.setUsername(sshMachineInfo.getUsername()); ...
544
296
840
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/ssh/SSHTemplate.java
SSHSession
scp
class SSHSession { private String address; private ClientSession clientSession; private SSHSession(ClientSession clientSession, String address) { this.clientSession = clientSession; this.address = address; } /** * 执行命令并返回结果,可以执行多次 * @p...
try { ScpClient client = ScpClientCreator.instance().createScpClient(clientSession); String separator = FileSystems.getDefault().getSeparator(); if(localFiles.length == 1){ if(StringUtils.isBlank(remoteFile)){ clien...
1,262
499
1,761
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/stats/admin/impl/CoreAppsStatCenterImpl.java
CoreAppsStatCenterImpl
sendExpAppsStatDataEmail
class CoreAppsStatCenterImpl implements CoreAppsStatCenter { @Autowired private AppService appService; @Autowired private AppDao appDao; @Autowired private UserService userService; @Autowired private ResourceDao resourceDao; @Autowired private EmailComponent emailComponent; ...
try { log.info("sendExpAppsStatDataEmail"); if (StringUtil.isBlank(searchDate)) { //默认发送前一天的日报 Date startDate = DateUtils.addDays(new Date(), -1); searchDate = DateUtil.formatDate(startDate, "yyyy-MM-dd"); } List<Ap...
429
404
833
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/stats/app/impl/AppDataMigrateCenterImpl.java
AppDataMigrateCenterImpl
processRedisMigrateToolStats
class AppDataMigrateCenterImpl implements AppDataMigrateCenter { @Autowired private AppDataMigrateStatusDao appDataMigrateStatusDao; @Autowired private MachineCenter machineCenter; @Override public String showDataMigrateLog(long id, int pageSize) { AppDataMigrateStatus appDataMigrateSta...
Map<RedisMigrateToolConstant, Map<String, Object>> redisStatMap = new HashMap<RedisMigrateToolConstant, Map<String, Object>>(); String[] data = statResult.split("\r\n"); String key; int i = 0; int length = data.length; while (i < length) { if (data[i].contain...
1,671
306
1,977
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/swagger/Swagger2.java
Swagger2
apiInfo
class Swagger2 { @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.sohu.cache.web.controller")) .paths(PathSelectors.any()) ...
return new ApiInfoBuilder() .title("CacheCloud项目 RESTful APIs") .description("CacheCloud项目后台api接口文档") .version("1.0") .build();
124
56
180
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/entity/InstanceBigKey.java
InstanceBigKey
getLengthFormat
class InstanceBigKey { private long id; /** * 实例id */ private long instanceId; /** * app id */ private long appId; /** * 工单id */ private long auditId; /** * ip地址 */ private String ip; /** * port */ private int port; ...
if (RedisDataStructureTypeEnum.string.getValue().equals(type)) { return new DecimalFormat("#,###").format(length); } else { return length + "个元素"; }
721
56
777
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/entity/RedisServerNode.java
RedisServerNode
transferFromPika
class RedisServerNode { private long taskId; private String ip; private int port; private int role; private int maxmemory; private String masterHost; private int masterPort; private String masterName; public RedisServerNode() { } public RedisServerNode(String ip, in...
RedisServerNode redisServerNode = new RedisServerNode(); redisServerNode.setIp(pikaNode.getIp()); redisServerNode.setMasterHost(pikaNode.getMasterHost()); redisServerNode.setMasterName(pikaNode.getMasterName()); redisServerNode.setMasterPort(pikaNode.getMasterPort()); re...
550
157
707
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/entity/TaskQueue.java
TaskQueue
getCostSeconds
class TaskQueue { /** * 自增id */ private long id; /** * 进行任务的ip:port */ private String executeIpPort; /** * 应用id */ private long appId; /** * 类名 */ private String className; /** * 全局参数:json格式,内容会变 */ private String param; ...
if (status != TaskStatusEnum.SUCCESS.getStatus()) { return ""; } if (endTime != null && startTime != null) { long ms = (endTime.getTime() - startTime.getTime()) / 1000; return String.valueOf(ms); } return "";
1,089
89
1,178
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/entity/TaskStepFlow.java
TaskStepFlow
getCostSeconds
class TaskStepFlow { /** * 自增id */ private long id; /** * 任务id */ private long taskId; /** * 子任务id */ private long childTaskId; /** * 类名 */ private String className; /** * 步骤名 */ private String stepName; /** * 序号 ...
if (status != TaskFlowStatusEnum.SUCCESS.getStatus()) { return ""; } if (endTime != null && startTime != null) { long ms = (endTime.getTime() - startTime.getTime()) / 1000; return String.valueOf(ms); } return "";
792
90
882
<no_super_class>
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/OffLineAppTask.java
OffLineAppTask
init
class OffLineAppTask extends BaseTask { private long appId; private AppDesc appDesc; private AppUser userInfo; private long auditId; @Autowired private AppService appService; @Autowired private InstanceDao instanceDao; @Resource(name = "appEmailUtil") private AppEmailUtil appEmai...
TaskFlowStatusEnum taskFlowStatusEnum = super.init(); appId = MapUtils.getLongValue(paramMap, TaskConstants.APPID_KEY); if (appId <= 0) { logger.error(marker, "task {} appId {} is wrong", taskId, appId); taskFlowStatusEnum = TaskFlowStatusEnum.ABORT; } a...
927
495
1,422
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/analysis/RedisServerIdleKeyAnalysisTask.java
RedisServerIdleKeyAnalysisTask
idleKeyAnalysis
class RedisServerIdleKeyAnalysisTask extends BaseTask { private String host; private int port; private long appId; private long auditId; /** * 扫描master */ private final static int SCAN_COUNT = 100; @Override public List<String> getTaskSteps() { List<String> taskSt...
long startTime = System.currentTimeMillis(); //本地结果集 AtomicLongMap<IdleTimeDistriEnum> idleTimeCountMap = AtomicLongMap.create(); Jedis jedis = null; try { jedis = redisCenter.getJedis(appId, host, port); jedis.readonly(); //如果 l...
631
1,060
1,691
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/analysis/RedisServerKeyTtlAnalysisTask.java
RedisServerKeyTtlAnalysisTask
keyTtlAnalysis
class RedisServerKeyTtlAnalysisTask extends BaseTask { private String host; private int port; private long appId; private long auditId; /** * 扫描slave */ private final static int SCAN_COUNT = 100; @Override public List<String> getTaskSteps() { List<String> taskStep...
long startTime = System.currentTimeMillis(); //本地结果集 AtomicLongMap<TtlTimeDistriEnum> ttlTimeCountMap = AtomicLongMap.create(); Jedis jedis = null; try { jedis = redisCenter.getJedis(appId, host, port); jedis.readonly(); long dbSize = jedis...
632
1,066
1,698
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/analysis/RedisServerKeyTypeAnalysisTask.java
RedisServerKeyTypeAnalysisTask
keyTypeAnalysis
class RedisServerKeyTypeAnalysisTask extends BaseTask { private String host; private int port; private long appId; private long auditId; /** * 扫描slave */ private final static int SCAN_COUNT = 100; @Override public List<String> getTaskSteps() { List<String> taskSte...
long startTime = System.currentTimeMillis(); Jedis jedis = null; try { jedis = redisCenter.getJedis(appId, host, port); jedis.readonly(); long dbSize = jedis.dbSize(); if (dbSize == 0) { logger.info(marker, "{} {}:{} dbsize is {}...
629
862
1,491
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/analysis/RedisServerKeyValueAnalysisTask.java
RedisServerKeyValueAnalysisTask
getTaskSteps
class RedisServerKeyValueAnalysisTask extends BaseTask { private String host; private int port; private long appId; private long auditId; /** * 扫描slave */ private final static int SCAN_COUNT = 100; @Override public List<String> getTaskSteps() {<FILL_FUNCTION_BODY>} /...
List<String> taskStepList = new ArrayList<String>(); taskStepList.add(TaskConstants.INIT_METHOD_KEY); // 检查实例是否运行 taskStepList.add("checkIsRun"); // key类型分析 taskStepList.add("keyValueAnalysis"); return taskStepList;
1,671
83
1,754
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/daily/MachineExamTask.java
MachineExamTask
getTaskSteps
class MachineExamTask extends BaseTask { private List<String> machineIpList; private Integer useType; private List<MachineStats> machineStatsList = Lists.newArrayList(); private Map<String, Integer> machineInstanceCountMap = Maps.newHashMap(); private List<Map> examResult = Lists.newArrayList(); ...
List<String> taskStepList = new ArrayList<String>(); taskStepList.add(TaskConstants.INIT_METHOD_KEY); // 1. 准备任务参数 taskStepList.add("prepareAppParam"); // 2. 执行机器故障检查 taskStepList.add("executeMachineExam"); // 3. 检查结果展示 taskStepList.add("showMachineExamRe...
1,162
115
1,277
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/diagnosticTask/AppBigKeyTask.java
AppBigKeyTask
updateAudit
class AppBigKeyTask extends BaseTask { private long appId; private long auditId; private long fromBytes; private long toBytes; private int size; private List<RedisServerNode> redisServerNodes; @Override public List<String> getTaskSteps() { List<String> taskStepList = new ArrayL...
try { AppDesc appDesc = appService.getByAppId(appId); appAuditDao.updateAppAudit(auditId, AppCheckEnum.APP_PASS.value()); StringBuffer content = new StringBuffer(); content.append(String.format("应用(%s-%s) appBigKeyTask 完成", appDesc.getAppId(), appDesc.getName()))...
1,519
152
1,671
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/diagnosticTask/AppDelKeyTask.java
AppDelKeyTask
checkAppParam
class AppDelKeyTask extends BaseTask { private long appId; private long auditId; private String pattern; private List<RedisServerNode> redisServerNodes; @Override public List<String> getTaskSteps() { List<String> taskStepList = new ArrayList<>(); taskStepList.add(TaskConstan...
AppDesc appDesc = appDao.getAppDescById(appId); if (appDesc == null) { logger.error(marker, "appId {} appDesc is null", appId); return TaskFlowStatusEnum.ABORT; } if (!appDesc.isOnline()) { logger.error(marker, "appId {} is must be online, ", appId); ...
1,461
126
1,587
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/diagnosticTask/AppHotKeyTask.java
AppHotKeyTask
checkAppParam
class AppHotKeyTask extends BaseTask { private long appId; private long auditId; private String command; private List<RedisServerNode> redisServerNodes; @Override public List<String> getTaskSteps() { List<String> taskStepList = new ArrayList<>(); taskStepList.add(TaskConstan...
AppDesc appDesc = appDao.getAppDescById(appId); if (appDesc == null) { logger.error(marker, "appId {} appDesc is null", appId); return TaskFlowStatusEnum.ABORT; } if (!appDesc.isOnline()) { logger.error(marker, "appId {} is must be online, ", appId); ...
1,475
126
1,601
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/diagnosticTask/AppIdleKeyTask.java
AppIdleKeyTask
init
class AppIdleKeyTask extends BaseTask { private long appId; private long idleTime; private int size; private long auditId; private List<RedisServerNode> redisServerNodes; @Override public List<String> getTaskSteps() { List<String> taskStepList = new ArrayList<>(); taskStepL...
super.init(); appId = MapUtils.getLongValue(paramMap, TaskConstants.APPID_KEY); if (appId <= 0) { logger.error(marker, "task {} appId {} is wrong", taskId, appId); return TaskFlowStatusEnum.ABORT; } idleTime = MapUtils.getIntValue(paramMap, "idleTime");...
1,225
464
1,689
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/diagnosticTask/AppScanKeyTask.java
AppScanKeyTask
createAppScanKeyTask
class AppScanKeyTask extends BaseTask { private long appId; private long auditId; private String pattern; private int size; private List<RedisServerNode> redisServerNodes; private final static long SCANKEY_SLEEP_BASE = 20000000; @Override public List<String> getTaskSteps() { ...
redisServerNodes = buildRedisServerNodes(redisServerNodes, appId); paramMap.put(TaskConstants.REDIS_SERVER_NODES_KEY, redisServerNodes); // 每个server的dbsize Map<String, Long> redisServerDbSizeMap = new HashMap<>(); for (RedisServerNode redisServerNode : redisServerNodes) { ...
1,372
570
1,942
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/diagnosticTask/AppSlotAnalysisTask.java
AppSlotAnalysisTask
getTaskSteps
class AppSlotAnalysisTask extends BaseTask { private long appId; private long auditId; private List<RedisServerNode> redisServerNodes; @Override public List<String> getTaskSteps() {<FILL_FUNCTION_BODY>} /** * 0.初始化参数 * * @return */ @Override public TaskFlowStatus...
List<String> taskStepList = new ArrayList<>(); taskStepList.add(TaskConstants.INIT_METHOD_KEY); // 1. 检查集群参数 taskStepList.add("checkAppParam"); // 2.1 创建 appSlotAnalysisTask taskStepList.add("createAppSlotAnalysisTask"); // 2.2 等到 ppSlotAnalysisTask完成 tas...
1,398
151
1,549
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...
sohutv_cachecloud
cachecloud/cachecloud-web/src/main/java/com/sohu/cache/task/tasks/diagnosticTask/InstanceDelKeyTask.java
InstanceDelKeyTask
delKey
class InstanceDelKeyTask extends BaseTask { private String host; private int port; private long appId; private String pattern; private long auditId; private long parentTaskId; private final static int SCAN_COUNT = 100; private final static String CONDITION_TEMPLATE = "pattern:{0}...
DiagnosticTaskRecord record = new DiagnosticTaskRecord(); record.setAppId(appId); record.setAuditId(auditId); String hostPost = host + ":" + port; record.setNode(hostPost); record.setDiagnosticCondition(MessageFormat.format(CONDITION_TEMPLATE, pattern)); record.s...
811
1,101
1,912
<methods>public non-sealed void <init>() ,public static java.lang.String generateMasterName(java.lang.String, int) ,public Map<java.lang.String,java.lang.Object> getParamMap() ,public abstract List<java.lang.String> getTaskSteps() ,public com.sohu.cache.task.constant.TaskStepFlowEnum.TaskFlowStatusEnum init() ,public v...