Slide 15
Slide 15 text
ConSol* Consulting & Solutions Software GmbH
1 July 2013
Example Application
ConcurrentMap:
Thread-Safe without synchronized
public void appendEvent(String user, String msg) {
boolean success;
do {
map.putIfAbsent(user, UserEventList.emptyList());
UserEventList oldMsgList = map.get(user);
UserEventList newMsgList = UserEventList.append(oldMsgList, msg);
success = map.replace(user, oldMsgList, newMsgList);
}
while ( ! success );
}