Home Help Center

Evictor question?

I want to create a servant, pass the proxy of the servant from server to client. How to do that? the code below is my implementation, but it does not work, i don't know why!

// ICE version 2.1.2
// server-side code
// server creates a servant, and pass this servant's proxy to client,
// but program blocks.

Ice::Identity fileIdentity;
fileIdentity.category = fileCategory;
fileIdentity.name = fileName;

FilePrx file;

LanE::FilePtr fileBase = new FileI();
file = FilePrx::uncheckedCast(c.adapter->add(fileBase,fileIdentity));

// ClientCallback::sendFile(File* file) is a Slice interface method.
// and program blocked here.

By the way, I want to create a servant, and push it into an evictor list, so that it can be automatically evicted, how to do it? i have been in a puzzle about these questions for days, badly want some help! Thank you!

thank you:)


  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Sorry, I don't really understand your problem. Your code doesn't show how the proxy is returned and I'm not sure what the client code is supposed to show. Can you please post more complete code samples demonstrating your problem? As for your evictor question, in general, the servant is added to the evictor instead of the object adapter. If you're using the Freeze evictor I recommend you to take a look at the demo/Freeze/library and demo/Freeze/phonebook for examples.

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Li,

    Your code looks correct. There can be several reasons for your call to block; the most common are:
    - you did not activate the adapter that hosts the clientCallback servant
    - you're out of threads in one of your processes. See http://www.zeroc.com/faq/hang.html

Sign In or Register to comment.