Home Help Center

One proxy one thread?

levellevel Member ✭✭
All proxy that maked by the same adapter in the server side does share the same thread?
How can I make the proxy with a thread not the only same thread?
Once call once a thread?

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    No, proxies do not share any thread. Proxies are fully thread safe, and you can use them in whatever thread you like.
  • levellevel Member ✭✭
    Could you write a example that show all proxy in their own self thread?

    .ice like

    #ifndef HELLO_ICE
    #define HELLO_ICE


    class Hello
    {
    nonmutating void sayHello(long i);
    idempotent void shutdown();
    };

    class MyServer
    {
    Hello* Create(string one);
    };


    #endif


    the HelloI 's sayHello like


    void
    HelloI::sayHello(::Ice::Long i,
    const Ice::Current& current) const
    {
    if(i==0)
    {
    Sleep(5000);
    cout << "Sleep(5000);" << endl;
    return ;
    }
    cout << "Hello World!" << endl;
    }
    That is , run two clients ,one call sayHello(0) first ,then one call sayHello(1) ,why the consol could not show one proxy one thread .
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    In the default configuration, Ice has only one thread in its server thread pool, which means there can be at most one operation dispatched at a time. If you want to allow multiple operations to be dispatched simultaneously, change the property Ice.ThreadPool.Server.Size to a value greater than one.

    Take care,
    - Mark
  • levellevel Member ✭✭
    I have already set Ice.ThreadPool.Server.Size =10
    but they run like in order? not parallel!

    the example like this attach file,
    Could you help me ?

    You should run two client ,one type key "t" that run long ,one type key "o" that run soon,I want to the tow client run paralle.

    Coule you test?
Sign In or Register to comment.