use of com.hazelcast.client.impl.client.DistributedObjectInfo in project hazelcast by hazelcast.
the class GetDistributedObjectsMessageTask method call.
@Override
protected Object call() throws Exception {
Collection<DistributedObject> distributedObjects = clientEngine.getProxyService().getAllDistributedObjects();
List<DistributedObjectInfo> coll = new ArrayList<DistributedObjectInfo>(distributedObjects.size());
for (DistributedObject distributedObject : distributedObjects) {
String name = DistributedObjectUtil.getName(distributedObject);
coll.add(new DistributedObjectInfo(distributedObject.getServiceName(), name));
}
return coll;
}
use of com.hazelcast.client.impl.client.DistributedObjectInfo in project hazelcast by hazelcast.
the class HazelcastClientInstanceImpl method getDistributedObjects.
@Override
public Collection<DistributedObject> getDistributedObjects() {
try {
ClientMessage request = ClientGetDistributedObjectsCodec.encodeRequest();
final Future<ClientMessage> future = new ClientInvocation(this, request).invoke();
ClientMessage response = future.get();
ClientGetDistributedObjectsCodec.ResponseParameters resultParameters = ClientGetDistributedObjectsCodec.decodeResponse(response);
Collection<? extends DistributedObject> distributedObjects = proxyManager.getDistributedObjects();
Set<DistributedObjectInfo> localDistributedObjects = new HashSet<DistributedObjectInfo>();
for (DistributedObject localInfo : distributedObjects) {
localDistributedObjects.add(new DistributedObjectInfo(localInfo.getServiceName(), localInfo.getName()));
}
Collection<DistributedObjectInfo> newDistributedObjectInfo = resultParameters.response;
for (DistributedObjectInfo distributedObjectInfo : newDistributedObjectInfo) {
localDistributedObjects.remove(distributedObjectInfo);
getDistributedObject(distributedObjectInfo.getServiceName(), distributedObjectInfo.getName());
}
for (DistributedObjectInfo distributedObjectInfo : localDistributedObjects) {
proxyManager.removeProxy(distributedObjectInfo.getServiceName(), distributedObjectInfo.getName());
}
return (Collection<DistributedObject>) proxyManager.getDistributedObjects();
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
Aggregations