IScheduleDataManager.java
6.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
package com.taobao.pamirs.schedule.taskmanager;
import java.util.List;
import java.util.Map;
import org.apache.zookeeper.data.Stat;
import com.taobao.pamirs.schedule.TaskItemDefine;
/**
* 调度配置中心客户端接口,可以有基于数据库的实现,可以有基于ConfigServer的实现
*
* @author xuannan
*
*/
public interface IScheduleDataManager{
public long getSystemTime();
/**
* 重新装载当前server需要处理的数据队列
*
* @param taskType
* 任务类型
* @param uuid
* 当前server的UUID
* @return
* @throws Exception
*/
public List<TaskItemDefine> reloadDealTaskItem(String taskType,String uuid) throws Exception;
/**
* 装载所有的任务队列信息
* @param taskType
* @return
* @throws Exception
*/
public List<ScheduleTaskItem> loadAllTaskItem(String taskType) throws Exception;
/**
* 释放自己把持,别人申请的队列
*
* @param taskType
* @param uuid
* @return
* @throws Exception
*/
public void releaseDealTaskItem(String taskType,String uuid) throws Exception;
/**
* 获取一共任务类型的处理队列数量
*
* @param taskType
* @return
* @throws Exception
*/
public int queryTaskItemCount(String taskType) throws Exception;
/**
* 装载任务类型相关信息
*
* @param taskType
* @throws Exception
*/
public ScheduleTaskType loadTaskTypeBaseInfo(String taskType) throws Exception;
/**
* 清除已经过期的调度服务器信息
*
* @param taskInfo
* @throws Exception
*/
public int clearExpireScheduleServer(String taskType,long expireTime) throws Exception;
/**
* 清除任务信息,服务器已经不存在的时候
*
* @param taskInfo
* @throws Exception
*/
public int clearTaskItem(String taskType, List<String> serverList) throws Exception;
/**
* 获取所有的有效服务器信息
*
* @param taskInfo
* @return
* @throws Exception
*/
public List<ScheduleServer> selectAllValidScheduleServer(String taskType) throws Exception;
public List<String> loadScheduleServerNames(String taskType)throws Exception;
/**
* 重新分配任务Item
*
* @param taskType
* @param serverList
* @throws Exception
*/
public void assignTaskItem(String taskType,String currentUuid, int maxNumOfOneServer,List<String> serverList) throws Exception;
/**
* 发送心跳信息
*
* @param server
* @throws Exception
*/
public boolean refreshScheduleServer(ScheduleServer server) throws Exception;
/**
* 注册服务器
*
* @param server
* @throws Exception
*/
public void registerScheduleServer(ScheduleServer server) throws Exception;
/**
* 注销服务器
* @param serverUUID
* @throws Exception
*/
public void unRegisterScheduleServer(String taskType,String serverUUID) throws Exception;
/**
* 清除已经过期的OWN_SIGN的自动生成的数据
* @param taskType 任务类型
* @param serverUUID 服务器
* @param expireDateInternal 过期时间,以天为单位
* @throws Exception
*/
public void clearExpireTaskTypeRunningInfo(String baseTaskType,String serverUUID,double expireDateInternal)throws Exception;
public boolean isLeader(String uuid,List<String> serverList);
public void pauseAllServer(String baseTaskType)throws Exception;
public void resumeAllServer(String baseTaskType)throws Exception;
public List<ScheduleTaskType> getAllTaskTypeBaseInfo()throws Exception ;
/**
* 清除一个任务类型的运行期信息
* @param baseTaskType
* @throws Exception
*/
public void clearTaskType(String baseTaskType) throws Exception;
/**
* 创建一个新的任务类型
* @param baseTaskType
* @throws Exception
*/
public void createBaseTaskType(ScheduleTaskType baseTaskType) throws Exception ;
public void updateBaseTaskType(ScheduleTaskType baseTaskType) throws Exception ;
public List<ScheduleTaskTypeRunningInfo> getAllTaskTypeRunningInfo(String baseTaskType) throws Exception;
/**
* 删除一个任务类型
* @param baseTaskType
* @throws Exception
*/
public void deleteTaskType(String baseTaskType) throws Exception;
/**
* 根据条件查询当前调度服务
* @param baseTaskType
* @param ownSign
* @param ip
* @param orderStr
* @return
* @throws Exception
*/
public List<ScheduleServer> selectScheduleServer(String baseTaskType, String ownSign, String ip, String orderStr)
throws Exception;
/**
* 查询调度服务的历史记录
* @param baseTaskType
* @param ownSign
* @param ip
* @param orderStr
* @return
* @throws Exception
*/
public List<ScheduleServer> selectHistoryScheduleServer(String baseTaskType, String ownSign, String ip, String orderStr)
throws Exception;
public List<ScheduleServer> selectScheduleServerByManagerFactoryUUID(String factoryUUID) throws Exception;
/**
* 创建任务项。注意其中的 CurrentSever和RequestServer不会起作用
* @param taskItems
* @throws Exception
*/
public void createScheduleTaskItem(ScheduleTaskItem[] taskItems) throws Exception;
/**
* 更新任务的状态和处理信息
* @param taskType
* @param sts
* @param message
*/
public void updateScheduleTaskItemStatus(String taskType,String taskItem,ScheduleTaskItem.TaskItemSts sts,String message)throws Exception;
/**
* 删除任务项
* @param taskType
* @param taskItem
*/
public void deleteScheduleTaskItem(String taskType,String taskItem) throws Exception;
/**
* 初始化任务调度的域信息和静态任务信息
* @param baseTaskType
* @param ownSign
* @param serverUUID
* @throws Exception
*/
public void initialRunningInfo4Static(String baseTaskType, String ownSign,String uuid)throws Exception;
public void initialRunningInfo4Dynamic(String baseTaskType, String ownSign)throws Exception;
/**
* 运行期信息是否初始化成功
* @param baseTaskType
* @param ownSign
* @param serverUUID
* @return
* @throws Exception
*/
public boolean isInitialRunningInfoSucuss(String baseTaskType, String ownSign) throws Exception;
public void setInitialRunningInfoSucuss(String baseTaskType, String taskType,String uuid) throws Exception;
public String getLeader(List<String> serverList);
public long updateReloadTaskItemFlag(String taskType) throws Exception;
public long getReloadTaskItemFlag(String taskType) throws Exception;
/**
* 通过taskType获取当前运行的serverList信息。
* @param taskType
* @return
* @throws Exception
*/
public Map<String ,Stat> getCurrentServerStatList(String taskType) throws Exception;
}