<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>I agree, and my intention when starting this thread was to find
      the best place to move that call to. I'll try registering similar
      listener as in your commit. That should free-up a service boot-up
      thread.</p>
    <p>Gytis<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 14/12/2016 23:21, Stuart Douglas
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAAoo=c6cMcj2cnTLRCnYfkRdq=4uoeq2wKmbxX6AF0QeaYoaDQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>In that case you should probably move the rest call out of
          the service start, and have it processed by a separate thread.<br>
          <br>
        </div>
        <div>Its probably not great having server start dependent on an
          external service being up anyway. <br>
        </div>
        <div><br>
        </div>
        Stuart<br>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Dec 15, 2016 at 7:10 AM, Gytis
          Trikleris <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:gtrikler@redhat.com" target="_blank">gtrikler@redhat.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes it
            does get processed. But because at the moment call is made
            from service's start method, the service isn't started until
            the request is processed. As a result Arquillian test fails
            because app server doesn't start fast enough.
            <div class="HOEnZb">
              <div class="h5"><br>
                <br>
                <br>
                On 14/12/2016 20:49, Brian Stansberry wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  OK. I should probably shut up and defer to Stuart
                  anyway. :)<br>
                  <br>
                  I say that because looking at his commit you linked,
                  it looks like what it does is it starts queuing up
                  requests during boot and then when it gets the
                  ControlledProcessStateService RUNNING notification it
                  opens the gate and the queued requests get handled (as
                  do new ones of course.)<br>
                  <br>
                  So that means you shouldn’t have a problematic race if
                  you also use the ControlledProcessStateService RUNNING
                  notification. Your request will either get there
                  before the gate opens and be queued momentarily before
                  being processed, or it will get there after the gate
                  opens and be processed. Either way it gets processed
                  and the client is none the wiser.<br>
                  <br>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    On Dec 14, 2016, at 1:33 PM, Gytis Trikleris &lt;<a
                      moz-do-not-send="true"
                      href="mailto:gtrikler@redhat.com" target="_blank">gtrikler@redhat.com</a>&gt;
                    wrote:<br>
                    <br>
                    In this particular test case both coordinator and
                    participants are on the same server. But they can
                    also be running on different servers. Participant
                    just contacts coordinator via URL provided wherever
                    it is located.<br>
                    <br>
                    <br>
                    On 14/12/2016 18:19, Brian Stansberry wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      This can’t be done internally? Using an HTTP to
                      communicate between aspects of the server seems
                      yuck.<br>
                      <br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        On Dec 14, 2016, at 2:58 AM, Gytis Trikleris
                        &lt;<a moz-do-not-send="true"
                          href="mailto:gtrikler@redhat.com"
                          target="_blank">gtrikler@redhat.com</a>&gt;
                        wrote:<br>
                        <br>
                        I need to load REST-AT participants from the
                        crash recovery store and notify REST-AT
                        coordinator (via REST API) of their URLs. This
                        doesn't have to be done on the server start, but
                        until it's done REST-AT coordinator recovery
                        will be printing warnings because it won't be
                        able to contact participants. So the sooner it's
                        done the better, hence my question about a
                        listener which could be invoked once the server
                        completed boot-up.<br>
                        <br>
                        Gytis<br>
                        <br>
                        On 13/12/2016 23:45, Stuart Douglas wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">
                          Why do you need to make a rest call while
                          startup is taking place?<br>
                          <br>
                          Stuart<br>
                          <br>
                          On Wed, Dec 14, 2016 at 9:22 AM, Gytis
                          Trikleris &lt;<a moz-do-not-send="true"
                            href="mailto:gtrikler@redhat.com"
                            target="_blank">gtrikler@redhat.com</a>&gt;
                          wrote:<br>
                          Is there a way to make sure I'm making the
                          service call not too early?<br>
                          <br>
                          Also, ControlledProcessStateService methods
                          which are used in that<br>
                          commit are deprecated. That's why I wasn't
                          sure if it's OK for me to use<br>
                          them.<br>
                          <br>
                          <br>
                          On 13/12/2016 22:34, Brian Stansberry wrote:<br>
                          <blockquote class="gmail_quote"
                            style="margin:0 0 0 .8ex;border-left:1px
                            #ccc solid;padding-left:1ex">
                            That commit you linked shows the mechanism
                            for getting a notification of process state
                            changes (inject
                            ControlledProcessStateService and register a
                            property change listener.)<br>
                            <br>
                            But, that commit is opening up the listener
                            when it gets the notification, so if you
                            listen for the same notification and make a
                            call it’s going to be racy.<br>
                            <br>
                            <blockquote class="gmail_quote"
                              style="margin:0 0 0 .8ex;border-left:1px
                              #ccc solid;padding-left:1ex">
                              On Dec 13, 2016, at 3:26 PM, Gytis
                              Trikleris &lt;<a moz-do-not-send="true"
                                href="mailto:gtrikler@redhat.com"
                                target="_blank">gtrikler@redhat.com</a>&gt;
                              wrote:<br>
                              <br>
                              Hello,<br>
                              <br>
                              I'm wondering if there is a way to
                              register a listener which would be<br>
                              invoked when server status has changed.
                              More specifically when<br>
                              application server completed start-up.<br>
                              <br>
                              The reason for that is that after [1]
                              commit was introduced our rest<br>
                              transaction tests started to fail. The
                              cause seems to be rest service<br>
                              call during the start of one of our
                              services. That call doesn't<br>
                              necessarily have to be executed during the
                              service start. However, the<br>
                              sooner it's done the better and if it
                              would be possible to register some<br>
                              sort of callback to be invoked once
                              start-up was done, that would be great.<br>
                              <br>
                              Thanks,<br>
                              <br>
                              Gytis<br>
                              <br>
                              <br>
                              [1]<br>
                              <a moz-do-not-send="true"
href="https://github.com/wildfly/wildfly/commit/d56cd18137d3acbcb5027744d5ce57f3ebc46d8e"
                                rel="noreferrer" target="_blank">https://github.com/wildfly/wil<wbr>dfly/commit/d56cd18137d3acbcb5<wbr>027744d5ce57f3ebc46d8e</a><br>
                              <br>
                              ______________________________<wbr>_________________<br>
                              wildfly-dev mailing list<br>
                              <a moz-do-not-send="true"
                                href="mailto:wildfly-dev@lists.jboss.org"
                                target="_blank">wildfly-dev@lists.jboss.org</a><br>
                              <a moz-do-not-send="true"
                                href="https://lists.jboss.org/mailman/listinfo/wildfly-dev"
                                rel="noreferrer" target="_blank">https://lists.jboss.org/mailma<wbr>n/listinfo/wildfly-dev</a><br>
                            </blockquote>
                          </blockquote>
                          ______________________________<wbr>_________________<br>
                          wildfly-dev mailing list<br>
                          <a moz-do-not-send="true"
                            href="mailto:wildfly-dev@lists.jboss.org"
                            target="_blank">wildfly-dev@lists.jboss.org</a><br>
                          <a moz-do-not-send="true"
                            href="https://lists.jboss.org/mailman/listinfo/wildfly-dev"
                            rel="noreferrer" target="_blank">https://lists.jboss.org/mailma<wbr>n/listinfo/wildfly-dev</a><br>
                          <br>
                        </blockquote>
                      </blockquote>
                    </blockquote>
                  </blockquote>
                </blockquote>
                <br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>