Code Monkey home page Code Monkey logo

magnolia-context-annotations's Introduction

magnolia-context-annotations

Build Status Maven Central javadoc

Provides java annotation for executing in system context

Usage

After installing this module in your magnolia deployment (taking the maven dependency is enough), you can do in stead of

@Override
public String stuff() {
   return MgnlContext.doInSystemContext((MgnlContext.Op<String, Throwable>)
        () -> actualStuff());
}
@Override
@MgnlSystemContext
public String stuff() {
   return actualStuff();
}

It’s a bit like javax.transaction.Transactional

The annotation can also be used at class level, so you can quite easily mark all methods of a complete utility class to be executed in system context.

Installation

<dependency>
  <groupId>nl.vpro</groupId>
  <artifactId>magnolia-context-annotations</artifactId>
  <version>1.3.0</version>
</dependency>

magnolia-context-annotations's People

Contributors

mihxil avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magnolia-context-annotations's Issues

release system contextes remains a horrible exercise.

We'll typicallly set use do in system contex in some service. We don't know beforehand if is is called via web request.

But If you do, and use 'releaseContext=true' it seems that to every thread a system context is associated, and that is released then.

It seems that we should not release it then, but well, we can't know if the system context is going to be used further in the request. We probably have to plugin something on the request which can be run when the http requests finished, so we can release the associated system context.

Or we have to unrelase the system context if we find one on the thread-local.

I'm not sure yet, but the current situation is a bit too simple.

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.