Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
change4weixin
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
shenjinzhu
change4weixin
Commits
79f5b9b3
Commit
79f5b9b3
authored
May 22, 2018
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户端部分修改
parent
0230aed5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
48 deletions
+1
-48
src/main/java/com/zhiwei/readWechat/Client.java
+1
-1
src/main/java/com/zhiwei/util/ESClient.java
+0
-47
No files found.
src/main/java/com/zhiwei/readWechat/Client.java
View file @
79f5b9b3
...
@@ -10,7 +10,7 @@ public class Client {
...
@@ -10,7 +10,7 @@ public class Client {
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
try
{
try
{
Socket
socket
=
new
Socket
(
"192.168.0.
245
"
,
22222
);
Socket
socket
=
new
Socket
(
"192.168.0.
36
"
,
22222
);
System
.
out
.
println
(
"客户端启动成功"
);
System
.
out
.
println
(
"客户端启动成功"
);
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
PrintWriter
write
=
new
PrintWriter
(
socket
.
getOutputStream
());
PrintWriter
write
=
new
PrintWriter
(
socket
.
getOutputStream
());
...
...
src/main/java/com/zhiwei/util/ESClient.java
deleted
100644 → 0
View file @
0230aed5
package
com
.
zhiwei
.
util
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
org.elasticsearch.client.transport.TransportClient
;
import
org.elasticsearch.common.settings.Settings
;
import
org.elasticsearch.common.transport.InetSocketTransportAddress
;
import
org.elasticsearch.transport.client.PreBuiltTransportClient
;
/**
* es连接类
*
* @author shenjinzhu
*
*/
public
class
ESClient
{
private
static
String
esIp
;
private
static
int
esPort
;
private
static
String
clusterName
;
private
static
class
ESClientHolder
{
static
TransportClient
client
=
initESClient
();
private
static
TransportClient
initESClient
()
{
esIp
=
Config
.
getVal
(
"esIp"
);
clusterName
=
Config
.
getVal
(
"clusterName"
);
esPort
=
Integer
.
valueOf
(
Config
.
getVal
(
"esPort"
));
Settings
esSettings
=
Settings
.
builder
().
put
(
"cluster.name"
,
clusterName
)
// 设置ES实例的名称
// 自动嗅探整个集群的状态,把集群中其他ES节点的ip添加到本地的客户端列表中
.
put
(
"client.transport.sniff"
,
false
).
build
();
TransportClient
client
=
new
PreBuiltTransportClient
(
esSettings
);
try
{
client
.
addTransportAddress
(
new
InetSocketTransportAddress
(
InetAddress
.
getByName
(
esIp
),
esPort
));
}
catch
(
UnknownHostException
e
)
{
e
.
printStackTrace
();
}
return
client
;
}
}
public
static
TransportClient
getInstance
()
{
return
ESClientHolder
.
client
;
}
}
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