geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Galen O'Sullivan (JIRA)" <>
Subject [jira] [Created] (GEODE-3076) Simplify connection count logic in AcceptorImpl
Date Wed, 14 Jun 2017 22:58:00 GMT
Galen O'Sullivan created GEODE-3076:

             Summary: Simplify connection count logic in AcceptorImpl
                 Key: GEODE-3076
             Project: Geode
          Issue Type: Improvement
          Components: client/server
            Reporter: Galen O'Sullivan

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) {
        ServerConnection snap[] = this.allSCList; // avoid volatile read
        this.allSCList = (ServerConnection[]) ArrayUtils.insert(snap, snap.length, serverConn);
      if (communicationMode != CLIENT_TO_SERVER_FOR_QUEUE) {
      if (isSelector()) {
      } else {
        try {
        } catch (RejectedExecutionException rejected) {
  <snip -- error handling, cleanup and exit>

This message was sent by Atlassian JIRA

View raw message