use of com.hazelcast.client.spi.impl.ClientInvocation 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);
}
}
use of com.hazelcast.client.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientInvokerWrapper method invoke.
@Override
public Object invoke(Object request) {
checkNotNull(request, "request cannot be null");
ClientInvocation invocation = new ClientInvocation(getClient(), (ClientMessage) request);
ClientInvocationFuture future = invocation.invoke();
try {
Object result = future.get();
return context.toObject(result);
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.client.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientInvokerWrapper method invokeOnTarget.
@Override
public Future invokeOnTarget(Object request, Address address) {
checkNotNull(request, "request cannot be null");
checkNotNull(address, "address cannot be null");
ClientMessage clientRequest = (ClientMessage) request;
ClientInvocation invocation = new ClientInvocation(getClient(), clientRequest, address);
return invocation.invoke();
}
use of com.hazelcast.client.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientCacheMetaDataFetcher method assignAndGetUuids.
@Override
public List<Map.Entry<Integer, UUID>> assignAndGetUuids() throws Exception {
ClientMessage request = MapAssignAndGetUuidsCodec.encodeRequest();
ClientInvocation invocation = new ClientInvocation(clientImpl, request);
CacheAssignAndGetUuidsCodec.ResponseParameters responseParameters = CacheAssignAndGetUuidsCodec.decodeResponse(invocation.invoke().get());
return responseParameters.partitionUuidList;
}
use of com.hazelcast.client.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientCacheMetaDataFetcher method scanMembers.
@Override
protected List<InternalCompletableFuture> scanMembers(List<String> names) {
Collection<Member> members = clusterService.getMembers(DATA_MEMBER_SELECTOR);
List<InternalCompletableFuture> futures = new ArrayList<InternalCompletableFuture>(members.size());
for (Member member : members) {
Address address = member.getAddress();
ClientMessage message = encodeRequest(names, address);
ClientInvocation invocation = new ClientInvocation(clientImpl, message, address);
try {
futures.add(invocation.invoke());
} catch (Exception e) {
if (logger.isWarningEnabled()) {
logger.warning("Cant fetch invalidation meta-data from address + " + address + " + [" + e.getMessage() + "]");
}
}
}
return futures;
}
Aggregations