protected final ConcurrentHashMap<InetSocketAddress, Queue<Session>> sessionMap = new ConcurrentHashMap<InetSocketAddress, Queue<Session>>();
public synchronized void addSession(Session session) {
MemcachedSession tcpSession = (MemcachedSession) session;
InetSocketAddressWrapper addrWrapper = tcpSession
.getInetSocketAddressWrapper();
// Remember the first time address resolved and use it in all
// application lifecycle.
if (addrWrapper.getRemoteAddressStr() == null) {
addrWrapper.setRemoteAddressStr(String.valueOf(session
.getRemoteSocketAddress()));
}
InetSocketAddress mainNodeAddress = addrWrapper.getMainNodeAddress();
if (mainNodeAddress != null) {
// It is a standby session
this.addStandbySession(session, mainNodeAddress);
} else {
// It is a main session