Code Monkey home page Code Monkey logo

Comments (3)

andot avatar andot commented on August 11, 2024

在创建客户端时,并不会创建连接,连接是在调用时才创建的,同步调用本来就不应该在主线程中使用,所以这应该不是个问题。

from hprose-java.

zhangchn avatar zhangchn commented on August 11, 2024

目前看到的状况是,在主线程调用TCP Client的subscribe就会造成同步调用Connector的create方法。

不太明白为什么这里没有被schedule到线程池。

from hprose-java.

andot avatar andot commented on August 11, 2024

subscribe 方法在调用时,如果没有指定客户端 id 参数,它会自动调用 autoId 方法来获取客户端 id,而如果客户端 id 没有初始化的情况下,它会首先同步调用 invoke 方法来获取客户端 id,使用同步调用而不是异步调用,是为了防止多个订阅重复获取 id,保证先获取到 id,再进行订阅。

所以,如果你没有指定客户端 id,就进行订阅的话,在 android 中需要单独开一个线程来进行该操作。

from hprose-java.

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.