accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Elser (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ACCUMULO-3875) Unnecessary synchronization and conditionals in MiniAccumuloClusterControl
Date Sun, 31 May 2015 18:12:17 GMT
Josh Elser created ACCUMULO-3875:
------------------------------------

             Summary: Unnecessary synchronization and conditionals in MiniAccumuloClusterControl

                 Key: ACCUMULO-3875
                 URL: https://issues.apache.org/jira/browse/ACCUMULO-3875
             Project: Accumulo
          Issue Type: Bug
          Components: mini
    Affects Versions: 1.7.0
            Reporter: Josh Elser
            Assignee: Josh Elser
             Fix For: 1.6.3, 1.7.1, 1.8.0


MiniAccumuloClusterControl has a few areas that could be cleaned up

The following null check on {{tabletServerProcesses}} is unnecessary.
{code}
      case TABLET_SERVER:
        if (tabletServerProcesses != null) {
          synchronized (tabletServerProcesses) {
            try {
              for (Process tserver : tabletServerProcesses) {
                try {
                  cluster.stopProcessWithTimeout(tserver, 30, TimeUnit.SECONDS);
                } catch (ExecutionException e) {
                  log.warn("TabletServer did not fully stop after 30 seconds", e);
                } catch (TimeoutException e) {
                  log.warn("TabletServer did not fully stop after 30 seconds", e);
                } catch (InterruptedException e) {
                  Thread.currentThread().interrupt();
                }
              }
            } finally {
              tabletServerProcesses.clear();
            }
          }
        }
        break;
{code}

{{tabletServerProcesses}} should probably be {{final}} and likely does not need to be a {{synchronizedList}}
because the data structure is used for synchronization before each access anyways.
{code}
  List<Process> tabletServerProcesses = Collections.synchronizedList(new ArrayList<Process>());
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message