断开连接但不修改充电桩状态和handler对应关系
This commit is contained in:
parent
bf3ee19374
commit
79686e62d2
@ -7,11 +7,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
|
||||||
import static com.xhpc.pp.logic.RegisterLogic.DISCONNECTED;
|
|
||||||
|
|
||||||
@Lazy(false)
|
@Lazy(false)
|
||||||
@Component
|
@Component
|
||||||
public class ChargingPileEventHandler implements ClientEventHandler {
|
public class ChargingPileEventHandler implements ClientEventHandler {
|
||||||
@ -43,11 +38,11 @@ public class ChargingPileEventHandler implements ClientEventHandler {
|
|||||||
public void closingConnection(ClientHandler handler) {
|
public void closingConnection(ClientHandler handler) {
|
||||||
|
|
||||||
String pileNo = ChargingPileServer.getPileNo(handler);
|
String pileNo = ChargingPileServer.getPileNo(handler);
|
||||||
ChargingPileServer.removeHandler(pileNo);
|
// ChargingPileServer.removeHandler(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);
|
||||||
handler.closeConnection();
|
handler.closeConnection();
|
||||||
log.info("-> ({}) - [{}] <- {}", pileNo, handler.getName(), handler.getSocket().getRemoteSocketAddress().toString());
|
log.info("-> ({}) - [{}] <- {}", pileNo, handler.getName(), handler.getSocket().getRemoteSocketAddress().toString());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user