Skip to content

Commit

Permalink
refactor: 세션 동시성 대비
Browse files Browse the repository at this point in the history
  • Loading branch information
shb03323 committed Sep 9, 2023
1 parent e06854c commit e135fd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.apache.coyote.http11.session;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

public class Session {

private final String id;
private final Map<String, Object> values = new HashMap<>();
private final Map<String, Object> values = new ConcurrentHashMap<>();

public Session(final String id) {
this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class SessionManager {

private static SessionManager instance;
private static final Map<String, Session> SESSIONS = new HashMap<>();
private static final Map<String, Session> SESSIONS = new ConcurrentHashMap<>();

private SessionManager() {}

Expand Down

0 comments on commit e135fd3

Please sign in to comment.