Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8504789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:08:02+00:00 2026-06-11T02:08:02+00:00

I have installed Quartz plugin in my Grails 2.1 application. Every 5 minutes one

  • 0

I have installed Quartz plugin in my Grails 2.1 application. Every 5 minutes one job is triggered that will calculate some numbers. The numbers are being shown on the side bar of every page. The calculated results will change frequently and my goal is when users refresh their screen they can see the new result on their sidebar.
Right now my approach is to send ajax call to a controller and grab the result from the database and render it on the screen.

Is there any way to store (cache) the calculated result from the JOB somewhere other than database so that my views can use them without executing query each time users click on a link or refresh the screen?

I thought about session but not sure its even possible outside of normal web request or its a good solution at all. Is there any solution or alternative approach?
Thanks

class MonitoringJob {
    def calculatorService
    def name  = 'Monitoring'
    def group = 'ApplicationGroup'
    static triggers = {
        simple name: 'mySimpleTrigger', startDelay: 60000, repeatInterval: 30000
    }

    def execute() {
        def results = calculatorService.runCalculators()
            //something like this:   session.results  =result
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:08:04+00:00Added an answer on June 11, 2026 at 2:08 am

    Services in Grails are by default singletons, so the calculatorService accessed in the Quartz job will be the same calculatorService accessed in other classes in which it is wired (e.g., controllers).

    Just store the values at the class level within your calculatorService and add an accessor method for the controllers to retrieve the data.

    class CalculatorService {
    
        ConcurrentHashMap cache = [:]
    
        def runCalculators() {
            // Do calculations
            cache.result1 = calculatedResult1
            // etc...
        }
    
        def retrieveCalculation(String key) {
            cache[(key)]
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed a library that has some functions with the same name as
I have installed the acts_as_versioned plugin from github.com in my rails application, and there
I have installed C++SDK that have Qt but when I try compiling a code
I have installed Eclipse & CDT plugin on newly installed Ubuntu. The indexing is
I have been working Quartz framework in my grails project with lib called quartz-all-1.7.3.
I have installed the HerzultFourmBundle into my Symfony2 application, added the calls in the
I have installed cURB library for my rails 2 application and I am able
I have installed gitorious ruby application, configured apache passenger and vhost. Everything works fine
I have installed NppExecute plugin in notepad++. I am not able to figure out
I'm using Quartz 2.1.1 and have a JAR application (Note, not a web so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.