Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-448

Include curator framework state in error messages

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.1.0
    • None
    • None

    Description

      While looking into Apache Fluo #1004 I am seeing error messages like the following.  

       

      2018-01-22 02:57:23,383 [leader.LeaderSelector] ERROR: The leader threw an exception
      java.lang.IllegalStateException: instance must be started before calling this method
      at com.google.common.base.Preconditions.checkState(Preconditions.java:149)
      at org.apache.curator.framework.imps.CuratorFrameworkImpl.getData(CuratorFrameworkImpl.java:363)
      at org.apache.fluo.core.oracle.OracleServer.takeLeadership(OracleServer.java:426)
      TRUNCATED

       

      When I see this error message I know the  CuratorFrameworkState is not STARTED.  However I don't know if its LATENT or STOPPED.  From a debugging standpoint this information would be very useful.  An example of the code that generates this error messages is at CuratorFrameworkImpl.java line 408.  This code could be changed to call an internal method like the following :

       

      private void checkState() {
        CuratorFrameworkState state = getState(); //store state in local var to avoid race conditions since it may be read twice
        Preconditions.checkState(state == CuratorFrameworkState.STARTED, "instance state must be %s before calling this method, however its %s", CuratorFrameworkState.STARTED, state);
      }
      

       

       

      Attachments

        Issue Links

          Activity

            People

              randgalt Jordan Zimmerman
              kturner Keith Turner
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: