Timeline for Thread-safe inventory system
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 13, 2015 at 3:13 | comment | added | Akansha | @Iealand: Can you provide more help for choosing right data structure for my Thread-safe inventory system? Also, If I want to change the quantity of a product, then final should not be used in 'Product' class. Only access modifier public should remain there in Product class. But the thing is if members fields are not final, how it can be made thread safe? | |
Oct 13, 2015 at 0:25 | comment | added | Akansha | Thanks @EricStein and Iealand for your inquisitive remarks.. | |
Oct 13, 2015 at 0:09 | comment | added | Eric Stein | @lealand I agree. I just wanted to call out that final by itself does not mean immutable. That's a common mistake for junior devs. | |
Oct 13, 2015 at 0:05 | comment | added | Akansha | @EricStein : If I want to change the quantity of a product, then final should not be used in 'Product' class. Only access modifier public should remain there in Product class. But the thing is if members fields are not final, how it can be made thread safe? | |
Oct 12, 2015 at 21:08 | comment | added | lealand |
@EricStein Yes that's true, but if the referenced fields are also immutable, as I've done in the Location class which is a member of the Product class, then you effectively have immutability.
|
|
Oct 12, 2015 at 21:04 | comment | added | Eric Stein |
For member variable declarations, using final != immutable. It only means the reference cannot be changed, not that values of the class being referenced cannot be changed.
|
|
Oct 12, 2015 at 19:48 | vote | accept | Akansha | ||
Oct 12, 2015 at 19:31 | history | edited | lealand | CC BY-SA 3.0 |
added 1428 characters in body
|
Oct 12, 2015 at 19:17 | history | edited | lealand | CC BY-SA 3.0 |
added 137 characters in body
|
Oct 12, 2015 at 19:11 | history | answered | lealand | CC BY-SA 3.0 |