Hi,

Originally Posted by
aozarov
Thanks benoit.
It is good to know that when I return a callback of a replicated service the callback is pinned to the called service but I think I am going to avoid such solution for now (unless I have to) for the following reasons:
1. Current implementation is delegated asynchronously via AMI which I think will be more efficient (resources/speed) than passing a client callback to get the results (and emulate AMI) and a service callback to enable cancel.
Hmm, I didn't suggest to use a client callback. I suggested to split your service interface in two distinct interfaces, one with replicated operations and another one with non-replicated operations. For example if your interface was:
Code:
interface Service
{
void doWork();
void cancelWork();
};
You could replace it with:
Code:
interface Service
{
void doWork();
void cancelWork();
};
interface ReplicatedService
{
Service* getService();
};
Your service implements both interfaces. Your client first obtains the service interface by invoking getService on a replicated proxy and it can then invoke the doWork/cancelWork methods on the returned proxy and be sure that requests will be sent to the same server instance.
If the doWork/cancelWork invocations fail, your client can obtain a new service object by invoking getService again.
2. I would like to avoid managing the returned callbacks from the servant in the server side (and releasing them if clients has not done so after certain timeout - or maybe use IceFreeze).
Also, I did read both references (thanks) but still have the following question:
I think I understand how proxies with timeouts or with connection id are
using their connections when the connection is cached, but I am not sure
what happens when connection is not cached by the proxy. Will a new
connection (associated with a connection-id or timeout) be created for every
picked endpoint if one does not already exists?
If the endpoint selection type is "Random", yes, a connection will eventually be created for each endpoint if it doesn't already exist. If the endpoint selection type is "Ordered", only a connection for the first endpoint will be created if it doesn't already exist (and for the second endpoint if connecting to the first endpoint fails, etc).
The main problem that I have with cached connection is that AFAK clients only consider the current available services/end-points and will not consider services that were added after they cached the connection (and re-distribute the load, unless their current connection is broken or was removed by ACM).
Correct. There's currently no way to specify for how long the connection is cached with the proxy.
Is there a way for me to force end point selection after the endpoint set has changed? should/can I do it myself by polling the proxy for its set of endpoints (calling ice_getEndpoints) and upon change (locatorChatTimeout set to X minutes) call ice_connectionCached(false).ice_connectionCached(t rue)?
Are this methods (or any other ObjectPrx methods) thread-safe?
Yes, these methods are thread-safe, see also this FAQ. You can indeed create a new proxy to clear the cached connection and force Ice to pick a new connection and consider the new set of endpoints retrieved from the locator.
I recommend considering changing your interfaces though. With the two interfaces mentioned above, you could simply configure the proxy to the ReplicatedService object to cache the connection and with a given locator cache timeout to ensure that invocations on the replicated service are distributed on all the replicas.
For the proxy returned by the getService method, you can just use the default proxy (it doesn't really matter if you cache or not the connection, this proxy points to a single service instance).
With this design, you don't have to rely on Ice connection management to make sure the doWork/cancelWork invocations are sent to the same service instance.
Are there any plans to delegate EndPoint selection to the user (via callbacks). Doing that will enable request based partitioning and even more selective end point selection (e.g. filter endpoint that represent and older version of a service - assuming more binding based information will be exposed via the endpoint).
No, there's no plans to add this at this point. We could consider this if you have a commercial interest in such a feature.
Cheers,
Benoit.