<div dir="ltr"><div class="gmail_default" style="font-size:large">I'm just wondering if we are making this graceful shutdown more complicated than necessary.<br><br></div><div class="gmail_default" style="font-size:large">Why wouldn't we just cancel and force a rollback on any active transactions when shutting down? Having experienced what a graceful shutdown can look like with a different architecture (BEA Tuxedo), I can tell you that it can take a very long time for the server to get to the point of shutting down, and appear to be hung by the administrator, depending on what was going on at the time the command was entered.<br><br></div><div class="gmail_default" style="font-size:large">We used to get administrators killing Tuxedo while it was "gracefully" shutting down, and messing lots of stuff up.<br><br></div><div class="gmail_default" style="font-size:large">Andy<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 5, 2016 at 12:34 PM, Flavia Rainone <span dir="ltr"><<a href="mailto:frainone@redhat.com" target="_blank">frainone@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
I think we can keep open transaction tracking only inside
transactions subsystem while we are not shutting down, and then we
can enroll for notification of open active transactions only on
suspend if needed... IMHO that's as clean as we can get regarding
shutdown code when the server is in running state.<br>
<br>
I would go with some sort of ActiveTransactionListener, that would
be notified of no more active transactions only if the listener is
set?<br>
<br>
Something along the lines below at ejb side:<br>
<br>
ServerActivityCallback callback = null;<br>
<br>
public void suspend(ServerActivityCallback callback) {<br>
if ( transactionSubsystem.<wbr>getActiveTransactions() > 0) {<br>
transactionSubsystem.<wbr>setActiveTransactionsListener(<wbr>this);<br>
}<br>
else {<br>
callback.done(); // done suspending<br>
}<br>
}<br>
<br>
// listener method<br>
public void noMoreActiveTransactions() {<br>
callback.done(); // done suspending<br>
// then we let control point notify clients that this node is no
longer available<br>
...<br>
}<br>
<br>
At transactions side:<br>
ActiveTransactionListener listener = null;<br>
<br>
private void incrementTxnCount() {<br>
...<br>
}<br>
<br>
private void decrementTxnCount() {<br>
if (txnCountUpdater.<wbr>decrementAndGet() == 0 && listener !=
null)<br>
listener.<wbr>noMoreActiveTransactions(); <br>
}<br>
<br>
public int getActiveTransactions() {<br>
return txnCountUpdater.get();<div><div class="h5"><br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div class="m_-1625616884403642138moz-cite-prefix">On 04-12-2016 20:39, Stuart Douglas
wrote:<br>
</div>
<blockquote type="cite">
<pre>On Sat, Dec 3, 2016 at 3:40 AM, Flavia Rainone <a class="m_-1625616884403642138moz-txt-link-rfc2396E" href="mailto:frainone@redhat.com" target="_blank"><frainone@redhat.com></a> wrote:
</pre>
<blockquote type="cite">
<pre>Hi,
I'm creating this thread to discuss the remaining details of graceful
shutdown for ejb transactions.
This is more or less what I've done so far:
<a class="m_-1625616884403642138moz-txt-link-freetext" href="https://github.com/fl4via/wildfly/commit/7017146522af9a979a8a8e0c92039e6a5fb18760" target="_blank">https://github.com/fl4via/<wbr>wildfly/commit/<wbr>7017146522af9a979a8a8e0c92039e<wbr>6a5fb18760</a>
While discussing this in the hip chat yesterday, Stuart mentioned that maybe
we could have the transactions subsystem responsible for keeping track of
how many active transactions we have, instead of putting that code in
EjbRemoteTransactionsRepositor<wbr>y.
Stuart, does that include having the suspend callback being done at
transactions subsystem as well? I'm thinking maybe not, because there are
two points in the ejb subsystem we need to know if transactions suspension
is over:
</pre>
</blockquote>
<pre>No, that still has to be handled at an EJB subsystem level.
Conceptually this is similar to what was done for the XTS subsytem, so
it should probably use a similar design. Ideally while the server is
in the running state the only graceful related code that is run is the
control point request tracking, however this may not be possible.
One other thing that came up on our hipchat discussion yesterday is TX
level graceful shutdown actually has some significant drawbacks, as
you cannot send out the module unavailability message until all the
transactions have been closed. This means that while we are waiting
for transactions to complete the node will still be part of a cluster,
and clients will send it requests that will be immediately rejected.
Stuart
</pre>
<blockquote type="cite">
<pre>- at EjbSuspendInterceptor if it is over, no request is allowed, if it is
not over, we need to check if current invocation contains a reference to an
active transaction
- at some point, we need to let control point notify that the ejb module is
not longer available to ejb client after transaction suspension is over,
i.e., we need to do that when suspend has been requested and there are no
remaining active transactions available.
On the other hand, it is hard to draw the line between what should be in the
transactions subsystem and what shouldn't. If the callback is done at
transactions subsystem, we need a way of having ejb3 notified that it is
done. If it is not done at transactions subsystem, ejb3 has to be notified
of the active transactions going to zero, which seems a lot of overhead, so
from this point of view maybe the callback should be in the transactions
system after all.
Stuart and Gytis, any thoughts?
--
Flavia Rainone
Principal Software Engineer
JBoss EAP/WildFly Team
M: (+55) 11 981-225-466
Red Hat.
Better technology.
Faster innovation.
Powered by community collaboration.
</pre>
</blockquote>
</blockquote>
<br>
<pre class="m_-1625616884403642138moz-signature" cols="72">--
Flavia Rainone
Principal Software Engineer
JBoss EAP/WildFly Team
M: (+55) 11 981-225-466
Red Hat.
Better technology.
Faster innovation.
Powered by community collaboration.
</pre>
</div></div></div>
<br>______________________________<wbr>_________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/wildfly-dev</a><br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><font size="4">Andrig (Andy) T. Miller<br></font></div><font size="4">Global Platform Director, Middleware<br></font></div><font size="4">Red Hat, Inc.</font><br></div></div></div></div>
</div>