Ivan Andika created HDDS-17378:
----------------------------------

             Summary: DatanodeStateMachine is not properly constructed
                 Key: HDDS-17378
                 URL: https://issues.apache.org/jira/browse/HDDS-17378
             Project: Apache Ozone
          Issue Type: Bug
            Reporter: Ivan Andika
            Assignee: Ivan Andika


DatanodeStateMachine "this" reference escapes during its construction. See the 
following implementation below
{code:java}
context = new StateContext(this.conf, DatanodeStates.getInitState(), this,
        threadNamePrefix);
{code}
>From "Java Concurrency in Practice", this means the DatanodeStateMachine is 
>{_}not properly constructed{_}.

See the excerpt: "An object is in a predictable, consistent state only after 
its constructor returns, so publishing an object from within its constructor 
can publish an incompletely constructed object"

And the exact imperative "Do not allow the `this` reference to escape during 
construction"

This issue seems to cause the workaround of having constructionLock in 
HDDS-3116.

This can be improved.

 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to