0 Replies Latest reply on Mar 23, 2009 9:13 PM by blaibu

    Force closing an external component through admin... why does component reconnect automatically?

    Bronze

      When I force close an external component that I have built using the Whack API through the Openfire admin page , the component reconnects after about a minute and is displayed on the admin client sessions list as connected again.

       

      My component uses JDBC for MySQL connectivity and on this automatic reconnect, I get

       

      SQLExceptions like MySQLNonTransientConnectionException: No operations allowed after statement closed

       

      when I get requests to do queries since the component's processPacket() is online again but seems like statements are not being prepared correctly again.

       

      To fix this, I think I need to know what methods are being called on reconnect (does it call the components constructor again? the initialize() method?).

       

      My very typical/uninteresting main() that sets the ExternalComponentManager:

       

          public static void main(String args[]){

       

              final ExternalComponentManager manager = new ExternalComponentManager("localhost", 5275);
              manager.setSecretKey("blah", "blah");
              try {
                  // Register that this component will be serving the given subdomain of the server
                  manager.addComponent("blah", new blah_Component(args[0], args[1], args[2]));
                  // Quick trick to ensure that this application will be running for ever. To stop the
                  // application you will need to kill the process
                  while (true) {
                      try {
                          Thread.sleep(500);
                      } catch (InterruptedException e) {
                          e.printStackTrace();
                      }
                  }
              } catch (ComponentException e) {
                  e.printStackTrace();
                  manager.getLog().error(e);
              }
          }

       

       

      Best,

      Barry