File tree Expand file tree Collapse file tree
src/main/java/de/rwth/idsg/steve/ocpp/ws Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,15 +41,9 @@ public SessionContextStoreImpl(WsSessionSelectStrategy wsSessionSelectStrategy)
4141 public void add (String chargeBoxId , WebSocketSession session , ScheduledFuture pingSchedule ) {
4242 SessionContext context = new SessionContext (session , pingSchedule , DateTime .now ());
4343
44- Deque <SessionContext > endpointDeque = lookupTable .get (chargeBoxId );
45- if (endpointDeque == null ) {
46- final Deque <SessionContext > emptyDeque = new ArrayDeque <>();
47- endpointDeque = lookupTable .putIfAbsent (chargeBoxId , emptyDeque );
48- if (endpointDeque == null ) {
49- endpointDeque = emptyDeque ;
50- }
51- }
44+ Deque <SessionContext > endpointDeque = lookupTable .computeIfAbsent (chargeBoxId , str -> new ArrayDeque <>());
5245 endpointDeque .addLast (context ); // Adding at the end
46+
5347 log .debug ("A new SessionContext is stored for chargeBoxId '{}'. Store size: {}" ,
5448 chargeBoxId , endpointDeque .size ());
5549 }
You can’t perform that action at this time.
0 commit comments