Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
searchhotcrawler
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhiwei
searchhotcrawler
Commits
86535a87
Commit
86535a87
authored
Jan 09, 2023
by
chenweitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加httpboot桥接健壮性
parent
c884eb1c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
26 deletions
+30
-26
src/main/java/com/zhiwei/searchhotcrawler/util/HttpClientUtils.java
+30
-26
No files found.
src/main/java/com/zhiwei/searchhotcrawler/util/HttpClientUtils.java
View file @
86535a87
...
@@ -36,43 +36,47 @@ public class HttpClientUtils {
...
@@ -36,43 +36,47 @@ public class HttpClientUtils {
static
boolean
isInit
=
false
;
static
boolean
isInit
=
false
;
static
{
static
{
init
();
init
();
isInit
=
true
;
}
}
public
static
HttpBoot
getHttpBoot
(){
public
static
HttpBoot
getHttpBoot
(){
if
(!
isInit
){
if
(!
isInit
){
init
();
init
();
isInit
=
true
;
}
}
return
httpBoot
;
return
httpBoot
;
}
}
public
static
synchronized
void
init
(){
public
static
synchronized
void
init
(){
ApplicationConfig
applicationConfig
=
new
ApplicationConfig
();
try
{
applicationConfig
.
setName
(
"hot_search-project"
);
LOGGER
.
info
(
"http-boot桥接 开始..."
);
RegistryConfig
registryConfig
=
new
RegistryConfig
();
ApplicationConfig
applicationConfig
=
new
ApplicationConfig
();
ConsumerConfig
consumerConfig
=
new
ConsumerConfig
();
applicationConfig
.
setName
(
"hot_search-project"
);
String
username
=
null
;
RegistryConfig
registryConfig
=
new
RegistryConfig
();
String
password
=
null
;
ConsumerConfig
consumerConfig
=
new
ConsumerConfig
();
if
(
ProxyConfig
.
isLocal
)
{
String
username
=
null
;
registryConfig
.
setAddress
(
ProxyConfig
.
localRegistry
);
String
password
=
null
;
// 设置分组
if
(
ProxyConfig
.
isLocal
)
{
consumerConfig
.
setGroup
(
ProxyConfig
.
localGroup
);
registryConfig
.
setAddress
(
ProxyConfig
.
localRegistry
);
username
=
ProxyConfig
.
localUsername
;
// 设置分组
password
=
ProxyConfig
.
localPassword
;
consumerConfig
.
setGroup
(
ProxyConfig
.
localGroup
);
}
else
{
username
=
ProxyConfig
.
localUsername
;
registryConfig
.
setAddress
(
ProxyConfig
.
hangzhouRegistry
);
password
=
ProxyConfig
.
localPassword
;
// 设置分组
}
else
{
consumerConfig
.
setGroup
(
ProxyConfig
.
hangzhouGroup
);
registryConfig
.
setAddress
(
ProxyConfig
.
hangzhouRegistry
);
username
=
ProxyConfig
.
hangzhouUsername
;
// 设置分组
password
=
ProxyConfig
.
hangzhouPassword
;
consumerConfig
.
setGroup
(
ProxyConfig
.
hangzhouGroup
);
}
username
=
ProxyConfig
.
hangzhouUsername
;
// 创建 consumer,applicationConfig 非必需参数
password
=
ProxyConfig
.
hangzhouPassword
;
CynomysConsumer
consumer
=
CynomysConsumerFactory
.
create
(
applicationConfig
,
registryConfig
,
consumerConfig
,
username
,
password
);
}
// 创建 consumer,applicationConfig 非必需参数
CynomysConsumer
consumer
=
CynomysConsumerFactory
.
create
(
applicationConfig
,
registryConfig
,
consumerConfig
,
username
,
password
);
// 初始化 http-boot 桥接
// 初始化 http-boot 桥接
CynomysFactory
.
init
(
consumer
);
CynomysFactory
.
init
(
consumer
);
LOGGER
.
info
(
"http-boot 桥接 成功"
);
isInit
=
true
;
}
catch
(
Exception
e
){
LOGGER
.
error
(
"http-boot桥接 出错:"
,
e
);
}
LOGGER
.
info
(
"http-boot桥接 成功"
);
}
}
public
static
String
sendPost
(
String
url
,
String
jsonParam
){
public
static
String
sendPost
(
String
url
,
String
jsonParam
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment