From 1651c63d8057c50461b6b8fc8f8c4a2aaf8034ed Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Thu, 27 Jul 2017 21:50:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0RM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/java/com/xxl/job/dao/impl/AdminApiTest.java | 4 +++- .../src/main/java/com/xxl/job/core/util/AdminApiUtil.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/AdminApiTest.java b/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/AdminApiTest.java index fcb6ecbd..2a29a9d5 100644 --- a/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/AdminApiTest.java +++ b/xxl-job-admin/src/test/java/com/xxl/job/dao/impl/AdminApiTest.java @@ -13,7 +13,9 @@ public class AdminApiTest { public static void main(String[] args) { try { RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), "aaa", "112312312312"); - ReturnT registryResult = AdminApiUtil.callApi("http://localhost:8080/xxl-job-admin"+AdminApiUtil.REGISTRY, registryParam); + + AdminApiUtil.init("http://localhost:8080/xxl-job-admin"); + ReturnT registryResult = AdminApiUtil.callApiFailover(AdminApiUtil.REGISTRY, registryParam); System.out.println(registryResult); } catch (Exception e) { e.printStackTrace(); diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/util/AdminApiUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/AdminApiUtil.java index eddb1018..5359b4a3 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/util/AdminApiUtil.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/AdminApiUtil.java @@ -66,7 +66,7 @@ public class AdminApiUtil { return ReturnT.FAIL; } - public static ReturnT callApi(String finalUrl, Object requestObj) throws Exception { + private static ReturnT callApi(String finalUrl, Object requestObj) throws Exception { HttpPost httpPost = new HttpPost(finalUrl); CloseableHttpClient httpClient = HttpClients.createDefault(); try {