|
@@ -13,6 +13,7 @@ import com.xxl.rpc.registry.ServiceRegistry;
|
13
|
13
|
import com.xxl.rpc.remoting.invoker.XxlRpcInvokerFactory;
|
14
|
14
|
import com.xxl.rpc.remoting.invoker.call.CallType;
|
15
|
15
|
import com.xxl.rpc.remoting.invoker.reference.XxlRpcReferenceBean;
|
|
16
|
+import com.xxl.rpc.remoting.invoker.route.LoadBalance;
|
16
|
17
|
import com.xxl.rpc.remoting.net.NetEnum;
|
17
|
18
|
import com.xxl.rpc.remoting.provider.XxlRpcProviderFactory;
|
18
|
19
|
import com.xxl.rpc.serialize.Serializer;
|
|
@@ -113,8 +114,19 @@ public class XxlJobExecutor {
|
113
|
114
|
|
114
|
115
|
String addressUrl = address.concat(AdminBiz.MAPPING);
|
115
|
116
|
|
116
|
|
- AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(NetEnum.JETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), CallType.SYNC,
|
117
|
|
- AdminBiz.class, null, 10000, addressUrl, accessToken, null).getObject();
|
|
117
|
+ AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(
|
|
118
|
+ NetEnum.JETTY,
|
|
119
|
+ Serializer.SerializeEnum.HESSIAN.getSerializer(),
|
|
120
|
+ CallType.SYNC,
|
|
121
|
+ LoadBalance.ROUND,
|
|
122
|
+ AdminBiz.class,
|
|
123
|
+ null,
|
|
124
|
+ 10000,
|
|
125
|
+ addressUrl,
|
|
126
|
+ accessToken,
|
|
127
|
+ null,
|
|
128
|
+ null
|
|
129
|
+ ).getObject();
|
118
|
130
|
|
119
|
131
|
if (adminBizList == null) {
|
120
|
132
|
adminBizList = new ArrayList<AdminBiz>();
|
|
@@ -130,12 +142,9 @@ public class XxlJobExecutor {
|
130
|
142
|
|
131
|
143
|
|
132
|
144
|
// ---------------------- executor-server (rpc provider) ----------------------
|
133
|
|
- private XxlRpcInvokerFactory xxlRpcInvokerFactory = null;
|
134
|
145
|
private XxlRpcProviderFactory xxlRpcProviderFactory = null;
|
135
|
146
|
|
136
|
147
|
private void initRpcProvider(String ip, int port, String appName, String accessToken) throws Exception {
|
137
|
|
- // init invoker factory
|
138
|
|
- xxlRpcInvokerFactory = new XxlRpcInvokerFactory();
|
139
|
148
|
|
140
|
149
|
// init, provider factory
|
141
|
150
|
String address = IpUtil.getIpPort(ip, port);
|
|
@@ -150,7 +159,7 @@ public class XxlJobExecutor {
|
150
|
159
|
xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());
|
151
|
160
|
|
152
|
161
|
// start
|
153
|
|
- xxlRpcProviderFactory.start();
|
|
162
|
+ xxlRpcProviderFactory.start();
|
154
|
163
|
|
155
|
164
|
}
|
156
|
165
|
|
|
@@ -168,14 +177,18 @@ public class XxlJobExecutor {
|
168
|
177
|
}
|
169
|
178
|
|
170
|
179
|
@Override
|
171
|
|
- public boolean registry(String key, String value) {
|
|
180
|
+ public boolean registry(Set<String> keys, String value) {
|
172
|
181
|
return false;
|
173
|
182
|
}
|
174
|
183
|
@Override
|
175
|
|
- public boolean remove(String key, String value) {
|
|
184
|
+ public boolean remove(Set<String> keys, String value) {
|
176
|
185
|
return false;
|
177
|
186
|
}
|
178
|
187
|
@Override
|
|
188
|
+ public Map<String, TreeSet<String>> discovery(Set<String> keys) {
|
|
189
|
+ return null;
|
|
190
|
+ }
|
|
191
|
+ @Override
|
179
|
192
|
public TreeSet<String> discovery(String key) {
|
180
|
193
|
return null;
|
181
|
194
|
}
|
|
@@ -185,7 +198,7 @@ public class XxlJobExecutor {
|
185
|
198
|
private void stopRpcProvider() {
|
186
|
199
|
// stop invoker factory
|
187
|
200
|
try {
|
188
|
|
- xxlRpcInvokerFactory.stop();
|
|
201
|
+ XxlRpcInvokerFactory.getInstance().stop();
|
189
|
202
|
} catch (Exception e) {
|
190
|
203
|
logger.error(e.getMessage(), e);
|
191
|
204
|
}
|