java - Share Variable between specific threads -


i facing problem in java wherein program makes n independent threads (of classa) , each thread of classa makes m dependent threads (classb). in total have m.n threads (of classb). want share variable between m threads (of classb) created specific thread of classa. can't use static because m.n threads share same variable want m threads created specific thread of classa share these. there implementation can follow same?

thanks.

you can pass shared variable b using constructor

class b extends thread {     final private object shared;      b(object obj) {         shared = obj;     } } 

now have a pass same object each b creates


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -