Menu

DataSourceDatabase.isActive() always returns false in HA-JDBC 3.0

Help
2014-02-25
2014-02-27
  • Justin Cranford

    Justin Cranford - 2014-02-25

    During programmatic initialization, I have to create DataSourceDatabase objects. I end up saving those objects because I have code later on that polls isActive() and logs messages about HA-JDBC node state. Anyway, I noticed DataSourceDatabase.isActive() always returns false during my testing.

    While looking for a workaround, I tried switching from cached DataSourceDatabase objects to getting them everytime from DatabaseClusterImpl.getDatabase("dbid"). However, I get the same result from those instances too.

    To verify there is a problem, I set a watch point on AbstractDatabase.setActive(). It never gets called with value true. The only time I see it called at all is when I simulate a database loss. However, that just sets the value from false to false, so no change.

    This is not a blocking issue for me, but I thought you would like to know if you are tracking issues.

    My workaround is to call getActiveDatabases().contains("mydbid") on my cached DatabaseClusterImpl object, instead of calling getDatabase("mydbid").isActive() on the same cached DatabaseClusterImpl object. I get the cached DatabaseClusterImpl object during initialization by calling ProxyFactory.getDatabaseCluster(), and all it well.

     

    Last edit: Justin Cranford 2014-02-25
  • Paul Ferraro

    Paul Ferraro - 2014-02-25

    Database.setActive(true) is called by net.sf.hajdbc.DatabaseCluster#activate(net.sf.hajdbc.Database, net.sf.hajdbc.state.StateManager). However, it may be that the value is never initially set correctly during cluster startup. I'll look into it.

     
  • Justin Cranford

    Justin Cranford - 2014-02-26

    Moving h2-1.3.175.jar from my webapp to tomcat/common/lib resolved the isActive=false problem too. I am not sure why this is a symptom of jar file misplacement though.

     

Log in to post a comment.