curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-448) Include curator framework state in error messages
Date Sun, 24 Jun 2018 14:37:00 GMT

    [ https://issues.apache.org/jira/browse/CURATOR-448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16521508#comment-16521508
] 

ASF GitHub Bot commented on CURATOR-448:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/curator/pull/267


> Include curator framework state in error messages
> -------------------------------------------------
>
>                 Key: CURATOR-448
>                 URL: https://issues.apache.org/jira/browse/CURATOR-448
>             Project: Apache Curator
>          Issue Type: Improvement
>            Reporter: Keith Turner
>            Assignee: Jordan Zimmerman
>            Priority: Major
>             Fix For: 4.0.2
>
>
> While looking into [Apache Fluo #1004|https://github.com/apache/fluo/pull/1004] I am
seeing error messages like the following.  
>  
> {noformat}
> 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{noformat}
>  
> When I see this error message I know the  [CuratorFrameworkState|https://curator.apache.org/apidocs/org/apache/curator/framework/imps/CuratorFrameworkState.html] 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|https://github.com/apache/curator/blob/3f7b610ad5c5a0c6a7b0331f02294bd433a54554/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L408]. 
This code could be changed to call an internal method like the following :
>  
> {code:java}
> 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);
> }
> {code}
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message