Areo
Areo

Reputation: 938

Object publication to ensure thread-safety

I am reading about publication objects to ensure thread-safety. (This is described in book Concurrency in Practice - Brian Goetz. But I feel that I don't understand publication of object correctly.

I think that: if object is correctly published then is ready to be used by multiple thread.

How do you understand publication of object ?

Any easy/short explanation is appreciated. Thanks

Upvotes: 1

Views: 61

Answers (1)

Publication simply means making the object visible/available to other objects in the system. By the time your object's constructor returns, all of its state should be correctly initialized so that it's ready for use.

(Note that some frameworks will apply post-construction processing to managed objects; in this case, the object's state should be stable before returning from @PostConstruct.)

Upvotes: 1

Related Questions