Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
It looks like AcceptorImpl gets the number of connections, then creates a connection, then increments the count, then handles errors.
This logic is a bit confusing. It could cause real problems if {{AcceptorImpl}}s were running in multiple threads.
This code would be much cleaner if it did an incrementAndGet() on the server count, checked the value, and incremented if it had gotten a valid number in the count.
if (communicationMode != CLIENT_TO_SERVER_FOR_QUEUE) { int curCnt = this.getClientServerCnxCount(); if (curCnt >= this.maxConnections) { <snip -- error handling, early exit> } } ServerConnection serverConn = new ServerConnection(s, this.cache, this.crHelper, this.stats, AcceptorImpl.handShakeTimeout, this.socketBufferSize, communicationModeStr, communicationMode, this, this.securityService); synchronized (this.allSCsLock) { this.allSCs.add(serverConn); ServerConnection snap[] = this.allSCList; // avoid volatile read this.allSCList = (ServerConnection[]) ArrayUtils.insert(snap, snap.length, serverConn); } if (communicationMode != CLIENT_TO_SERVER_FOR_QUEUE) { incClientServerCnxCount(); } if (isSelector()) { serverConn.registerWithSelector(); } else { try { pool.execute(serverConn); } catch (RejectedExecutionException rejected) { <snip -- error handling, cleanup and exit> }
Attachments
Issue Links
- is related to
-
GEODE-3077 Client connection counts should be accurate
- Closed