This commit is contained in:
ZZ 2022-03-16 16:00:59 +08:00
parent 1d07519ccb
commit a59d48615b
2 changed files with 9 additions and 7 deletions

View File

@ -179,7 +179,7 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString())); ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString()));
cachePile.put("rateModelId", cacheStation.getRateModelId()); cachePile.put("rateModelId", cacheStation.getRateModelId());
REDIS.setCacheMap(pilekey, cachePile); REDIS.setCacheMap(pilekey, cachePile);
log.debug("rate model responds success√"); log.debug("[{}] rate model[{}] responds success√", pilekey, cacheStation.getRateModelId());
} }
private List<byte[]> parseDataList(byte[] data) { private List<byte[]> parseDataList(byte[] data) {

View File

@ -112,17 +112,19 @@ public class ChargingPileServer {
public static void removeHandler(String pileNo) { public static void removeHandler(String pileNo) {
ClientHandler handler = handlerMap.remove(pileNo); ClientHandler handler = handlerMap.remove(pileNo);
// handler.closeConnection();
// log.debug("handler [{}] for ({}) close connection", handler.getName(), pileNo);
String pkey = "pile:".concat(pileNo); String pkey = "pile:".concat(pileNo);
Map<String, Object> cachePile = REDIS.getCacheMap(pkey); Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
cachePile.put("status", DISCONNECTED); cachePile.put("status", DISCONNECTED);
REDIS.setCacheMap(pkey, cachePile); REDIS.setCacheMap(pkey, cachePile);
putemDisconn(pileNo, cachePile); putemDisconn(pileNo, cachePile);
log.debug("remove handler [{}] for ({}), now try to close conn..", handler.getName(), pileNo); if (handler != null) {
handler.closeConnection(); // handler.closeConnection();
pileMap.remove(handler.getName()); // log.debug("handler [{}] for ({}) close connection", handler.getName(), pileNo);
versionMapper.remove(handler.getName()); log.debug("remove handler [{}] for ({}), now try to close conn..", handler.getName(), pileNo);
handler.closeConnection();
pileMap.remove(handler.getName());
versionMapper.remove(handler.getName());
}
} }
public static void sendClientMsg(String pileNo, byte[] msg) { public static void sendClientMsg(String pileNo, byte[] msg) {