Giter Club home page Giter Club logo

Comments (7)

marktowin1984 avatar marktowin1984 commented on September 18, 2024 1

好的,明白了,感谢

from iogame.

iohao avatar iohao commented on September 18, 2024

是的

#77

from iogame.

marktowin1984 avatar marktowin1984 commented on September 18, 2024

文档中:
this.requestMessageClientProcessorHook.processLogic 的默认实现是线程安全的;注意,这个线程安全指的是 userId 与线程做了关联绑定,同一个玩家执行业务是线程安全的

同一个用户是的业务逻辑是同一个线程处理的,是线程安全的。 其他的用户是不同的业务线程吗?
或者说一个逻辑服业务线程就只有一个,还是有多个?

from iogame.

iohao avatar iohao commented on September 18, 2024

文档中: this.requestMessageClientProcessorHook.processLogic 的默认实现是线程安全的;注意,这个线程安全指的是 userId 与线程做了关联绑定,同一个玩家执行业务是线程安全的

同一个用户是的业务逻辑是同一个线程处理的,是线程安全的。 其他的用户是不同的业务线程吗? 或者说一个逻辑服业务线程就只有一个,还是有多个?

默认的实现中有多个 Executor[],具体数量是不大于Runtime.getRuntime().availableProcessors() 的 2 次幂。假设 availableProcessors 的值分别为 4、8、12、16、32 时,对应的数量则是 4、8、8、16、32。

通过 userId 从 Executor[] 中取得对应的线程来处理业务逻辑,来避免并发问题;

可以先阅读相关文档 https://www.yuque.com/iohao/game/eixd6x#KA814

from iogame.

marktowin1984 avatar marktowin1984 commented on September 18, 2024

好的,多谢

from iogame.

marktowin1984 avatar marktowin1984 commented on September 18, 2024

再追加问一个问题:
客户端连接断开,逻辑服处理用户下线钩子的函数,和客户端业务线程是同一个线程吗?

是否会出现,在连接断开前的业务报文还在处理中,但用户下线钩子函数已经在处理甚至说处理完成了。

from iogame.

iohao avatar iohao commented on September 18, 2024

再追加问一个问题: 客户端连接断开,逻辑服处理用户下线钩子的函数,和客户端业务线程是同一个线程吗?

是否会出现,在连接断开前的业务报文还在处理中,但用户下线钩子函数已经在处理甚至说处理完成了。

是同一个线程,因为是 通过 userId 从 Executor[] 中取得对应的线程来处理业务逻辑,来避免并发问题;

from iogame.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.