Skip to content

Commit bea7987

Browse files
committed
release version 1.1.7
1 parent 5857a71 commit bea7987

File tree

7 files changed

+44
-13
lines changed

7 files changed

+44
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ java client for ezyfox server
88
<dependency>
99
<groupId>com.tvd12</groupId>
1010
<artifactId>ezyfox-server-java-client</artifactId>
11-
<version>1.1.5</version>
11+
<version>1.1.7</version>
1212
</dependency>
1313
```
1414

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
<parent>
77
<groupId>com.tvd12</groupId>
88
<artifactId>ezyfox</artifactId>
9-
<version>1.0.1</version>
9+
<version>1.0.2</version>
1010
</parent>
1111

1212
<artifactId>ezyfox-server-java-client</artifactId>
1313

14-
<version>1.1.6</version>
14+
<version>1.1.7</version>
1515
<name>ezyfox-server-java-client</name>
1616
<url>https://youngmonkeys.org/</url>
1717

1818
<properties>
19-
<ezy.version>1.2.0</ezy.version>
19+
<ezy.version>1.2.1</ezy.version>
2020
</properties>
2121

2222
<dependencies>

src/main/java/com/tvd12/ezyfoxserver/client/EzyClients.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public void addClient(EzyClient client) {
7676

7777
protected void addClient0(EzyClient client) {
7878
this.clients.put(client.getName(), client);
79+
if (defaultClientName == null) {
80+
defaultClientName = client.getName();
81+
}
7982
}
8083

8184
public EzyClient getClient(String name) {
@@ -106,5 +109,16 @@ public void getClients(List<EzyClient> cachedClients) {
106109
cachedClients.addAll(clients.values());
107110
}
108111
}
112+
113+
public void removeClient(String name) {
114+
synchronized (clients) {
115+
clients.remove(name);
116+
}
117+
}
109118

119+
public void clear() {
120+
synchronized (clients) {
121+
this.clients.clear();
122+
}
123+
}
110124
}

src/main/java/com/tvd12/ezyfoxserver/client/entity/EzyApp.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.tvd12.ezyfoxserver.client.entity;
22

3+
import com.tvd12.ezyfox.entity.EzyArray;
34
import com.tvd12.ezyfox.entity.EzyData;
45
import com.tvd12.ezyfoxserver.client.EzyClient;
56
import com.tvd12.ezyfoxserver.client.handler.EzyAppDataHandler;
@@ -27,6 +28,10 @@ public interface EzyApp {
2728

2829
void send(String cmd, EzyData data, boolean encrypted);
2930

31+
void send(EzyArray request);
32+
33+
void send(EzyArray request, boolean encrypted);
34+
3035
void udpSend(EzyRequest request);
3136

3237
void udpSend(String cmd);

src/main/java/com/tvd12/ezyfoxserver/client/entity/EzySimpleApp.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ public void send(String cmd, EzyData data, boolean encrypted) {
5050
send(commandData, encrypted);
5151
}
5252

53-
private void send(EzyArray request, boolean encrypted) {
53+
@Override
54+
public void send(EzyArray request) {
55+
send(request, false);
56+
}
57+
58+
@Override
59+
public void send(EzyArray request, boolean encrypted) {
5460
EzyArray requestData = EzyEntityFactory.newArray();
5561
requestData.add(id, request);
5662
client.send(EzyCommand.APP_REQUEST, requestData, encrypted);

src/main/java/com/tvd12/ezyfoxserver/client/manager/EzySimpleHandlerManager.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ public class EzySimpleHandlerManager implements EzyHandlerManager {
4040
private final EzyEventHandlers eventHandlers;
4141
@Getter
4242
private final EzyDataHandlers dataHandlers;
43-
private final Map<String, EzyAppDataHandlers> appDataHandlerss;
44-
private final Map<String, EzyPluginDataHandlers> pluginDataHandlerss;
43+
private final Map<String, EzyAppDataHandlers> appDataHandlersByName;
44+
private final Map<String, EzyPluginDataHandlers> pluginDataHandlersByName;
4545

4646
public EzySimpleHandlerManager(EzyClient client) {
4747
this.client = client;
4848
this.pingSchedule = client.getPingSchedule();
4949
this.eventHandlers = newEventHandlers();
5050
this.dataHandlers = newDataHandlers();
51-
this.appDataHandlerss = new HashMap<>();
52-
this.pluginDataHandlerss = new HashMap<>();
51+
this.appDataHandlersByName = new HashMap<>();
52+
this.pluginDataHandlersByName = new HashMap<>();
5353
}
5454

5555
private EzyEventHandlers newEventHandlers() {
@@ -84,20 +84,20 @@ public EzyEventHandler getEventHandler(EzyConstant eventType) {
8484

8585
@Override
8686
public EzyAppDataHandlers getAppDataHandlers(String appName) {
87-
EzyAppDataHandlers answer = appDataHandlerss.get(appName);
87+
EzyAppDataHandlers answer = appDataHandlersByName.get(appName);
8888
if(answer == null) {
8989
answer = new EzyAppDataHandlers();
90-
appDataHandlerss.put(appName, answer);
90+
appDataHandlersByName.put(appName, answer);
9191
}
9292
return answer;
9393
}
9494

9595
@Override
9696
public EzyPluginDataHandlers getPluginDataHandlers(String pluginName) {
97-
EzyPluginDataHandlers answer = pluginDataHandlerss.get(pluginName);
97+
EzyPluginDataHandlers answer = pluginDataHandlersByName.get(pluginName);
9898
if(answer == null) {
9999
answer = new EzyPluginDataHandlers();
100-
pluginDataHandlerss.put(pluginName, answer);
100+
pluginDataHandlersByName.put(pluginName, answer);
101101
}
102102
return answer;
103103
}

src/test/java/com/tvd12/ezyfoxserver/client/testing/EzyClientsTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6+
import org.testng.annotations.BeforeMethod;
67
import org.testng.annotations.Test;
78

89
import com.tvd12.ezyfoxserver.client.EzyClient;
@@ -13,6 +14,11 @@
1314
import com.tvd12.ezyfoxserver.client.constant.EzyTransportType;
1415

1516
public class EzyClientsTest {
17+
18+
@BeforeMethod
19+
public void before() {
20+
EzyClients.getInstance().clear();
21+
}
1622

1723
@Test
1824
public void getDefaultClientReturnNull() {

0 commit comments

Comments
 (0)