Git Product home page Git Product logo

Comments (3)

awattez avatar awattez commented on June 12, 2024 1

You are right one Result, we have one ReentrantReadWriteLock _lock for all the application threads. But locks take place only during reading and writing (it is not exactly the same locks in reading as writing) not during the global processing.

from rulebook.

awattez avatar awattez commented on June 12, 2024

In com.deliveredtechnologies.rulebook.spring.RuleBean you have @Scope("prototype")
Scope prototype means that every time you ask spring (getBean or dependency injection) for an instance it will create a new instance and give a reference to that.

If you check at com.deliveredtechnologies.rulebook.model.runner.AbstractRuleBookRunner

there is a call to Object ruleInstance = getRuleInstance(rule); inside run function.
For each rule object it will create a new instance.

In com.deliveredtechnologies.rulebook.Result class you have a Map and a lock in order to deal with asynchronous problem:

  private Map<Long, T> _valueMap = new HashMap<>();
  private final ReentrantReadWriteLock _lock = new ReentrantReadWriteLock();

If you have one run per request, on each request you will have a different bean/object for each @RuleBean or @Rule POJOs.
You don't have to define Session scoped.

from rulebook.

ykorobitsin avatar ykorobitsin commented on June 12, 2024

AbstractRuleBookRunner

I see the single result that keeps results per thread. Does it mean that we have single lock in result for all the application threads? Is it really optimized for all threads to wait when a single request finishes its work?

from rulebook.

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.