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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:09:02+00:00 2026-06-05T19:09:02+00:00

In Brian Goetz’s article about safe construction techniques you could read: […] often when

  • 0

In Brian Goetz’s article about safe construction techniques you could read:

[…] often when an object owns a thread, either that thread is an inner class or we pass the this reference to its constructor (or the class itself extends the Thread class). If an object is going to own a thread, it is best if the object provides a start() method, just like Thread does, and starts the thread from the start() method instead of from the constructor. While this does expose some implementation details (such as the possible existence of an owned thread) of the class via the interface, which is often not desirable, in this case the risks of starting the thread from the constructor outweigh the benefit of implementation hiding.

I guess that with the following code there shouldn’t be any problem. Since it is not an inner class nor I am passing a reference of this. But I want to be sure.

private Controller controller;
private View view;

public Facade() {
    view = new View();
    controller = new Controller(view);
    controller.start();
}

I keep getting NetBeans warnings though… So is this code safe or unsafe?

  • 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-05T19:09:03+00:00Added an answer on June 5, 2026 at 7:09 pm

    The main reason do not start thread in constructor – do not expose “this” before “this” is created (after constructor executed). In your code I do not see such code like:

    new Thread(this);
    

    So it should be fine.

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

Sidebar

Related Questions

Referring to Brian Goetz's article Are all stateful Web applications broken? for IBM developerWorks,
In this article: http://www.ibm.com/developerworks/java/library/j-jtp1029/index.html Brian Goetz states: Just because class X is compiled against
I've read plenty of articles about tuning GC in Java and have often wondered
In this SO thread, Brian Postow suggested a solution involving fake anonymous functions: make
According to Brian Goetz's Java Concurrency in Practice JVM can't exit until all the
In Brian Goetz's book, Java Concurrency in Practice, his example of a Reentrant lock
In code listing 5.19 of the Brian Goetz book Concurrency In Practice, he presents
I was reading some of the concurrency patterns in Brian Goetze's Java Concurrency in
Using Brian's suggestion below: foreach($qs as $value){ echo <tr>.$value['qnum']. is the questions number and
I'm learning MVVM in a course from Brian Lagunas in PluralSight. At the beginning,

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.