tools awaiting common changeable information bugs java


i have infinite leave component maintain. codebase uses threads over place those threads share lot changeable data. i know, sounds bad. anyway, don't answer "rewrite whole concentration scratch" i'll opinion down :-) i have attempted run stationary research collection codebase, nonetheless zero those seem locate box occurs lot the source code: churned threads reading minute variables noted flighty synchronized during all. typically occurs "runflag"-type variables. an instance effective java 2nd book page 260:



public category stopthread
{
private stationary boolean stoprequested;
open stationary vacant main(string[] args) throws interruptedexception
{
thread backgroundthread = new thread(new runnable()
{
open vacant run()
{
int i = 0;
while (!stoprequested)
{
i++;
}
}
});
backgroundthread.start();
thread.sleep(1000);
stoprequested = true;
}
}


this instance never finishes windows/linux "-server" startup parameter given object jvm. so, there any (semi-)automatic proceed issues, i have rest totally formula reviews?



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members