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 6230293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:43:13+00:00 2026-05-24T09:43:13+00:00

I am using a Python module ( PyCLIPS ) and Django 1.3. I want

  • 0

I am using a Python module (PyCLIPS) and Django 1.3.

I want develop a thread-safety class which realizes the Object Pool and the Singleton patterns and also that have to be shared between requests in Django.

For example, I want to do the following:

  • A request gets the object with some ID from the pool, do
    something with it and push it back to the pool, then send response
    with the object’s ID.
  • Another request, that has the object’s ID, gets
    the object with the given ID from the pool and repeats the steps from the above request.
  • But the state of the object will has to be kept while it’ll be at the pool while the server is running.

It should be like a Singleton Session Bean in Java EE

How I should do it? Is there something I’ll should read?

Update:
I can’t store objects from the pool in a database, because these objects are wrappers under a library written on C-language which is API for the Expert System Engine CLIPS.

Thanks!

  • 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-24T09:43:14+00:00Added an answer on May 24, 2026 at 9:43 am

    Well, I think a different angle is necessary here. Django is not like Java, the solution should be tailored for a multi-process environment, not a multi-threaded one.

    Django has no immediate equivalent of a singleton session bean.

    That said, I see no reason your description does not fit a classic database model. You want to save per object data, which should always go in the DB layer.

    Otherwise, you can always save stuff on the session, which Django provides for both logged-in users as well as for anonymous ones – see the docs on Django sessions.

    Usage of any other pattern you might be familiar with from a Java environment will ultimately fail, considering the vast difference between running a Java web container, and the Python/Django multi-process environment.


    Edit: well, considering these objects are not native to your app rather accessed via a third-party library, it does complicate things. My gut feeling is that these objects should not be handled by the web layer but rather by some sort of external service which you can access from a multi-process environment. As Daniel mentioned, you can always throw them in the cache (if said objects are pickle-able). But it feels as if these objects do not belong in the web tier.

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

Sidebar

Related Questions

Using Python module re, how to get the equivalent of the \w (which matches
Simple enough question: I'm using python random module to generate random integers. I want
I have a python logger set up, using python's logging module. I want to
I'm trying to configure logging for a Django app using the Python logging module.
I have a config.cfg which I parse using the python-module ConfigParser. In one section
I'm accessing a C struct which contains some time_t fields using python ctypes module.
I'm using the python dateutil module for a calendaring application which supports repeating events.
I want to import a class from python module. The module contains multiple classes
I'm using boost python. I've exported some function which takes class CL_DomElement in arguments.
Using the python module xlwt, writing to the same cell twice throws an error:

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.