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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:35:33+00:00 2026-06-03T16:35:33+00:00

Possible Duplicate: What is the garbage collector in Java? Within my program, I have

  • 0

Possible Duplicate:
What is the garbage collector in Java?

Within my program, I have a function set up that calls another function after a certain amount of time (we’ll set it as 20 minutes for purposes of this example) using ScheduledThreadPoolExecutor.

The function that gets called, we’ll say is removeStat(Character char). In the method, it makes references to functions in side character (we’ll say char.getClient().getWriter()). We’ll assume that during the 20 minute wait period, the character in question logs out and their Character instance is no longer required.

Would the Java garbage collector remove the Character class in that time, causing for the char in removeStat to be null, or does it know to wait until the call has been made?

  • 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-03T16:35:36+00:00Added an answer on June 3, 2026 at 4:35 pm

    Garbage collectors (including Java’s) are smart enough that you don’t have to worry about this. The garbage collector won’t garbage collect anything until all references to it have disappeared. If the object is still accessible, it still exists.

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

Sidebar

Related Questions

Possible Duplicate: Java garbage collector - When does it collect? When people say that
Possible Duplicate: Creating a memory leak with Java There is a Garbage Collector in
Possible Duplicate: Yield In VB.NET In C#, when writing a function that returns an
Possible Duplicate: PHP get all arguments as array? Within a javascript function arguments always
Possible Duplicate: Is there garbage collection in PHP? In java there is a concept
Possible Duplicate: difference between destructor and garbage collector Recently i asked this question ,
Possible Duplicate: Forcing Garbage Collection in Java? Can I Force Garbage Collection in Java
Possible Duplicate: find which type of garbage collector is running Is there a way
Possible Duplicate: Garbage Collection: Is it necessary to set large objects to null in
Possible Duplicate: Java Thread Garbage collected or not Consider the following class: class Foo

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.