??????????????????????????Plumbr??????????????????????????????????“Hi??????д?ò????????????????????????????????????????????????????????”
?????????????????м??????????????????????????????????????????У???????????????????????????????????????????????????????????????????????????????????????????????????С??????????
??????????????????
???????????????????????????????????????????????????????“???”???????????????????????????????????????????????????????????????????????????????????????????Щ????????BUG??
????????????????????????????????????б??????????????????????????????????е?????????????????????????????????????????????????????????????鰱???????????monitor???????????????????????????????????????????????
??????????JVM?е???????????????????????????????????????????????????????????????????????κζ????????????????????????????????????ù????????????????????? ???????????????????????????????????????
??????????????????
???????????????????????????????????????????????????????????????????????????????????????

 

class GameServer {
public Map<<String?? List<Player>> tables = new HashMap<String?? List<Player>>();
public synchronized void join(Player player?? Table table) {
if (player.getAccountBalance() > table.getLimit()) {
List<Player> tablePlayers = tables.get(table.getId());
if (tablePlayers.size() < 9) {
tablePlayers.add(player);
}
}
}
public synchronized void leave(Player player?? Table table) {/*body skipped for brevity*/}
public synchronized void createTable() {/*body skipped for brevity*/}
public synchronized void destroyTable(Table table) {/*body skipped for brevity*/}
}

???????????????——????μ??????????????????????????????????????9????
??????????????????????????????????????????????????——?????????????????????????????????????????????????????????????????????????????????????????????????????????????飬???????????????Щ??????????????????????????????????????t???????????
????????????????????????????????????????????????????????????????????????????????????????У?????????????????????????????????????????GameServer??????????????join()??????

 

class GameServer {
public Map<String?? List<Player>> tables = new HashMap<String?? List<Player>>();
public void join(Player player?? Table table) {
synchronized (tables) {
if (player.getAccountBalance() > table.getLimit()) {
List<Player> tablePlayers = tables.get(table.getId());
if (tablePlayers.size() < 9) {
tablePlayers.add(player);
}
}
}
}
public void leave(Player player?? Table table) {/* body skipped for brevity */}
public void createTable() {/* body skipped for brevity */}
public void destroyTable(Table table) {/* body skipped for brevity */}
}