You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Attila Doroszlai (Jira)" <ji...@apache.org> on 2019/11/08 21:40:00 UTC

[jira] [Created] (RATIS-749) Create constant for set of "not running" states

Attila Doroszlai created RATIS-749:
--------------------------------------

             Summary: Create constant for set of "not running" states
                 Key: RATIS-749
                 URL: https://issues.apache.org/jira/browse/RATIS-749
             Project: Ratis
          Issue Type: Improvement
          Components: server
            Reporter: Attila Doroszlai


{{LogAppender$AppenderDaemon#isRunning}} creates a new array for varargs of {{LifeCycle$State#isOneOf}} upon each call:

{code:title=https://github.com/apache/incubator-ratis/blob/005aa6ab0f7a9051bb4c4a47660bca29ec70aa20/ratis-server/src/main/java/org/apache/ratis/server/impl/LogAppender.java#L98-L100}
    boolean isRunning() {
      return !lifeCycle.getCurrentState().isOneOf(CLOSING, CLOSED, EXCEPTION);
    }
{code}

This is frequently called (indirectly) from the main loop:

{code:title=https://github.com/apache/incubator-ratis/blob/005aa6ab0f7a9051bb4c4a47660bca29ec70aa20/ratis-server/src/main/java/org/apache/ratis/server/impl/LogAppender.java#L450-L451}
  protected void runAppenderImpl() throws InterruptedException, IOException {
    while (isAppenderRunning()) {
{code}

There should be a constant array defined with these states to reduce GC.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)