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

  • Home
  • SEARCH
  • 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 619165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:37:31+00:00 2026-05-13T18:37:31+00:00

I have a core JAR that provides some functionality and hence used in lots

  • 0

I have a core JAR that provides some functionality and hence used in lots of other apps as well – desktop apps, web apps etc. Now this core JAR maintains an object pool containing objects that are computationally expensive to create. The object pool is of fixed size and hence I create all of the objects at once and populate the pool.
What I want to do is that whenever the app using my JAR is loaded, the object pool is created without the application knowing about the details of such a pool. And that even though the app load time will take a hit because of the pool population, but once the app is past this stage, there shouldn’t be any more performance hit in creation of such heavy objects later.

Is there a way to achieve this?

  • 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-05-13T18:37:31+00:00Added an answer on May 13, 2026 at 6:37 pm

    The only way to do something like this, outside of adding explicit hooks in the client apps to invoke your startup logic is to add static initializers to your classes to construct your pool.

    A static initializer is run when your class is first loaded by the JVM (prior to any code in your class being invoked), which is not quite deterministic but is usually when a code path referencing your class is first hit.

    I would recommend providing some sort of hooks into your startup logic for the client applications to invoke, this way they can precisely control this type of thing rather than having your startup logic run at an unpredictable time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a core file generated on a remote system that I don't have
I have a quad core machine and would like to write some code to
I have a set of core, complicated JavaScript data structures/classes that I'd like to
I have a relationship in a Core Data model that feels like it wants
I have a delete statement that's going against one of my core application tables.
I have some questions about multi-threaded programming and multi-core usage. In particular I'm wondering
If I have the core of a class defined in one file as public
Fedora Core 9 seems to have FCGID instead of FastCGI as a pre-built, YUM-managed
I have just installed VMWare Server 2.0 on a fresh Fedora Core 8 install.
I have a Zend Framework application structure as below: /application /library /Zend /Core /Filter

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.