@@ -62,10 +62,13 @@ public void init(Connection connection) {
62
62
* Resubscribe automatically after reconnected.
63
63
*/
64
64
public void reSubscribe (){
65
- int ownerLen = this .connection .address .length ();
66
65
for (String key : mapTableCache .keySet ()){
67
- String name = key .substring (0 ,key .length () - ownerLen );
68
- String owner = key .substring (key .length () - ownerLen );
66
+ String [] keys = key .split (";" );
67
+ if (keys .length != 2 ){
68
+ continue ;
69
+ }
70
+ String name = keys [0 ];
71
+ String owner = keys [1 ];
69
72
70
73
JSONObject messageTx = new JSONObject ();
71
74
messageTx .put ("command" , "subscribe" );
@@ -101,7 +104,7 @@ private void onChainsqlSubRet() {
101
104
@ Override
102
105
public void called (JSONObject args ) {
103
106
if (args .has ("owner" ) && args .has ("tablename" )) {
104
- String key = args .getString ("tablename" ) + args .getString ("owner" );
107
+ String key = args .getString ("tablename" ) + ";" + args .getString ("owner" );
105
108
makeCallback (key ,args .getJSONObject ("result" ));
106
109
}
107
110
if (args .has ("transaction" )) {
@@ -138,7 +141,7 @@ public void called(JSONObject args) {
138
141
onChainsqlSubRet ();
139
142
this .onSubRet = true ;
140
143
}
141
- this .mapTableCache .put (name + owner ,cb );
144
+ this .mapTableCache .put (name +";" + owner ,cb );
142
145
}
143
146
144
147
/**
@@ -226,7 +229,7 @@ public void unsubscribeTable(String name, String owner,Callback<JSONObject> cb)
226
229
messageTx .put ("tablename" , name );
227
230
this .connection .client .subscriptions .addMessage (messageTx );
228
231
229
- String key = name + owner ;
232
+ String key = name +";" + owner ;
230
233
231
234
JSONObject obj = new JSONObject ();
232
235
if (this .mapTableCache .containsKey (key )) {
0 commit comments