Giter Club home page Giter Club logo

Comments (5)

krokodylowy avatar krokodylowy commented on July 26, 2024

According to old "Multithreaded Programming with JAVA™ Technology" avoid interruption and cancellation if at all possible.
But sometimes we can override Future.cancel(), Therad.interrupt() or SecurityManager methods and do some things in transaction manager before thread exit.
So the question is what we can do before interruption and closed channel occur?
Does TransactionManagerServices.getTransactionManager().rollback(); or something else is correct way to stop permanent fail of transaction log?

from btm.

lorban avatar lorban commented on July 26, 2024

There is an ugly workaround that would work: when you get such ClosedChannelException - which can be done by checking the root cause of the exception - clearing the interrupt flag then closing and reopening the disk journal will make BTM resume where it left, ie:

    try {
      ...
    } catch (org.hibernate.TransactionException e) {
      Throwable rootCause = null;
      while (rootCause != e.getCause()) {
        rootCause = e.getCause();
      }
      if (rootCause instanceof ClosedChannelException) {
        if (Thread.interrupted()) { // will also clear interrupted flag
          TransactionManagerServices.getJournal().close();
          TransactionManagerServices.getJournal().open();
        }
      }
      throw e;
    }

You'll get some error in the logs complaining that the journal couldn't be properly closed but all aborted transactions should be recovered and new ones should start flowing again happily.

This is not ideal, but should safely work around the problem.

from btm.

krokodylowy avatar krokodylowy commented on July 26, 2024

Thanks. We will try.

from btm.

 avatar commented on July 26, 2024

We had the same issue. @lorban , thank you for the solution.
But as for me it is not an ideal solution. It would be great if some kind of fix can be added into Bitronix code (somewhere into bitronix.tm.journal.DiskJournal or another place).

from btm.

lorban avatar lorban commented on July 26, 2024

The team behind BTM moved off to other horizons, BTM has been unmaintained for a few years now and is still looking for someone to take over its maintenance.

For as long as this will be the case, no bug fixes nor new features will be made.

from btm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.