Hi,
When in service grid service execution, if the local node deployment services, will directly call the local deployment service, otherwise it will find the service in the grid. The local service, and the caller will use the same thread, in this case, the two threads‘s state is different, that is to say, the same call, have different behavior in different scene, I think the design is not reasonable. For example, a thread local variable is defined, and according to the above description, the value of the same variable may be different for different scenarios. |
Why would you use a thread local in a service? What design you think is
reasonable? -Val On Mon, Mar 13, 2017 at 2:03 PM, 李玉珏@163 <[hidden email]> wrote: > Hi, > > When in service grid service execution, if the local node deployment > services, will directly call the local deployment service, otherwise it > will find the service in the grid. > > The local service, and the caller will use the same thread, in this case, > the two threads‘s state is different, that is to say, the same call, have > different behavior in different scene, I think the design is not reasonable. > > For example, a thread local variable is defined, and according to the > above description, the value of the same variable may be different for > different scenarios. > > > |
This problem occurs in a stand-alone development environment, as well as
multiple node deployment environment. I think it is reasonable to say that no matter where the service is accessed, it is a different thread, which will ensure consistent behavior. 在 2017/3/13 23:52, Valentin Kulichenko 写道: > Why would you use a thread local in a service? What design you think is > reasonable? > > -Val > > On Mon, Mar 13, 2017 at 2:03 PM, 李玉珏@163 <[hidden email]> wrote: > >> Hi, >> >> When in service grid service execution, if the local node deployment >> services, will directly call the local deployment service, otherwise it >> will find the service in the grid. >> >> The local service, and the caller will use the same thread, in this case, >> the two threads‘s state is different, that is to say, the same call, have >> different behavior in different scene, I think the design is not reasonable. >> >> For example, a thread local variable is defined, and according to the >> above description, the value of the same variable may be different for >> different scenarios. >> >> >> |
What is "consistent behavior"? Thread local in service just don't make
sense to me, it's a misuse. If you use API properly, you will not such issues. BTW, it's better to ask such questions on user list, not dev list. Please do so for further questions. -Val On Tue, Mar 14, 2017 at 1:55 PM, 李玉珏@163 <[hidden email]> wrote: > This problem occurs in a stand-alone development environment, as well as > multiple node deployment environment. > I think it is reasonable to say that no matter where the service is > accessed, it is a different thread, which will ensure consistent behavior. > > > 在 2017/3/13 23:52, Valentin Kulichenko 写道: > >> Why would you use a thread local in a service? What design you think is >> reasonable? >> >> -Val >> >> On Mon, Mar 13, 2017 at 2:03 PM, 李玉珏@163 <[hidden email]> wrote: >> >> Hi, >>> >>> When in service grid service execution, if the local node deployment >>> services, will directly call the local deployment service, otherwise it >>> will find the service in the grid. >>> >>> The local service, and the caller will use the same thread, in this case, >>> the two threads‘s state is different, that is to say, the same call, have >>> different behavior in different scene, I think the design is not >>> reasonable. >>> >>> For example, a thread local variable is defined, and according to the >>> above description, the value of the same variable may be different for >>> different scenarios. >>> >>> >>> >>> > > |
Free forum by Nabble | Edit this page |