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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:15:26+00:00 2026-05-22T19:15:26+00:00

In a specific scenario here, I have a manger called UserManger used to handle

  • 0

In a specific scenario here,

I have a manger called UserManger used to handle CRUD for user

This manager is “Singleton” and correct by design.

But in update method I have logic

public User update (User u) 
{

    // This line is problematic?
    User u1 = new User();

    copy(u,u1);
    //Some logic
    dao.update(u);

}

Will creating any new objects in singleton manager problematic? Especially for a very concurrent system.

Will

public User update (User u, User u1)
{

    copy(u,u1);
    //Some logic
    dao.update(u);
}

Solve my problem?

  • 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-22T19:15:27+00:00Added an answer on May 22, 2026 at 7:15 pm

    Just creating an object within a singleton method won’t cause any problems. You’re not sharing any state between threads, after all.

    You would have potential problems if you had state within the singleton itself – but all you’ve shown is creating a local variable, not changing an instance variable. Each invocation of a method has its own entirely separate set of local variables. Two threads can both be executing the same method, but they won’t see each other’s local variables.

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

Sidebar

Related Questions

I have seen a lot of shared hashmap implementations. Here is the specific scenario
Here's the scenario I have a page lets say login.aspx having a button called
Here's my scenario: I have a simple stored procedure that removes a specific set
Here is the scenario: We have multiple clients,dealers and staff in our application. this
Here is my specific scenario. I have a class QueryQueue that wraps the QueryTask
I am planning on developing my specific voip app for android. Here's the scenario:
How to run javascript/Jquery functions on user specific time scenario its so simple when
I have a scenario where i want to match specific word and then match
Skip to the specific question as needed. Some background: The scenario: I have a
I am new to design patterns and I have a scenario here. I am

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.