Timeline for Global Variables State Management
Current License: CC BY-SA 4.0
22 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 26 at 3:23 | answer | added | user448926 | timeline score: 1 | |
Jul 8 at 6:36 | comment | added | procrastinator1771 | I cannot change the state to scoped or transient. | |
Jul 7 at 11:08 | comment | added | Rik D | The problem is the use of singletons with shared mutable state. Change the lifetime of these services to transient or scoped and you don’t have to add additional complexity like ThreadLocal constructs. | |
Jul 6 at 19:24 | comment | added | candied_orange | The problem with widely shared class level variables is shared mutable state. If you have some automatic fix for that please explain. Because that is a tall order. It’s not just “cleaning up”. | |
Jul 6 at 17:50 | review | Close votes | |||
Jul 11 at 3:01 | |||||
Jul 6 at 16:06 | comment | added | Philip Kendall | @MuhammadHaris Please edit your question to say what you actually mean, at the moment it's very confusing for a reader when you refer to "global variables" when you don't actually mean global variables. | |
Jul 6 at 7:31 | comment | added | procrastinator1771 | By global variables I meant class-level variable, and those class-level variables that's inside the singleton class. | |
Jul 6 at 5:25 | comment | added | Ben Cottrell | Useful SO thread on the topic of using ThreadLocal with Spring Boot: stackoverflow.com/questions/2218282/… | |
Jul 5 at 19:32 | comment | added | Ewan | sounds like aspect orientated programming en.wikipedia.org/wiki/Aspect-oriented_programming | |
Jul 5 at 19:30 | comment | added | Greg Burghardt |
Can you edit your question to clarify something that might be ambiguous? Java doesn't have the concept of a literal global variable, at least not like some other languages where you declare an identifier as global . Global can mean an object passed around by dependency injection from object to object, where "global" is more of a concept that a language feature.
|
|
Jul 5 at 19:19 | comment | added | JimmyJames | @candied_orange I'm just trying to understand. If these are single-use resources, I'm not sure what point there is in making them global. | |
Jul 5 at 19:12 | comment | added | candied_orange | @JimmyJames I'm just worried that this would encourage the casual use of globals. The biggest argument against them isn't technical. It's what they do to us humans. | |
Jul 5 at 18:54 | comment | added | JimmyJames | I'm not sure, in your scenario, how you know when to cleanup a global resource. Are you planning to create and destroy these resources on every use? | |
Jul 5 at 18:15 | history | edited | Doc Brown | CC BY-SA 4.0 |
Tags added
|
Jul 5 at 17:06 | history | reopened |
Doc Brown candied_orange Greg Burghardt |
||
Jul 5 at 12:41 | history | edited | procrastinator1771 | CC BY-SA 4.0 |
added 400 characters in body; edited title
|
S Jul 5 at 12:30 | review | Reopen votes | |||
Jul 5 at 17:11 | |||||
S Jul 5 at 12:30 | history | edited | procrastinator1771 | CC BY-SA 4.0 |
added 11 characters in body
Added to review
|
Jul 5 at 12:27 | history | edited | procrastinator1771 | CC BY-SA 4.0 |
added 219 characters in body
|
Jul 5 at 12:25 | history | closed |
Philip Kendall Greg Burghardt Doc Brown |
Needs details or clarity | |
S Jul 5 at 12:20 | review | First questions | |||
Jul 5 at 12:33 | |||||
S Jul 5 at 12:20 | history | asked | procrastinator1771 | CC BY-SA 4.0 |