@Override public void onDone(GridClientFuture<GridClientDataMetrics> fut) { try { metrics = fut.get(); } catch (GridClientException ignored) { // It's just a cache, so ignore failures. } } });
/** {@inheritDoc} */ @Override public GridClientFuture<GridClientDataMetrics> metricsAsync() { GridClientFuture<GridClientDataMetrics> fut = withReconnectHandling( new ClientProjectionClosure<GridClientDataMetrics>() { @Override public GridClientFuture<GridClientDataMetrics> apply( GridClientConnection conn, UUID affinityNodeId) throws GridClientConnectionResetException, GridClientClosedException { return conn.cacheMetrics(cacheName, affinityNodeId); } }); if (cacheMetrics) fut.listen(new GridClientFutureListener<GridClientDataMetrics>() { @Override public void onDone(GridClientFuture<GridClientDataMetrics> fut) { try { metrics = fut.get(); } catch (GridClientException ignored) { // It's just a cache, so ignore failures. } } }); return fut; }
/** {@inheritDoc} */ @Override public <R> R affinityExecute(String taskName, String cacheName, Object affKey, Object taskArg) throws GridClientException { return this.<R>affinityExecuteAsync(taskName, cacheName, affKey, taskArg).get(); }
/** {@inheritDoc} */ @Override public GridClientFuture<GridClientDataMetrics> metricsAsync() { GridClientFuture<GridClientDataMetrics> fut = withReconnectHandling( new ClientProjectionClosure<GridClientDataMetrics>() { @Override public GridClientFuture<GridClientDataMetrics> apply( GridClientConnection conn, UUID affinityNodeId) throws GridClientConnectionResetException, GridClientClosedException { return conn.cacheMetrics(cacheName, affinityNodeId); } }); if (cacheMetrics) fut.listen(new GridClientFutureListener<GridClientDataMetrics>() { @Override public void onDone(GridClientFuture<GridClientDataMetrics> fut) { try { metrics = fut.get(); } catch (GridClientException ignored) { // It's just a cache, so ignore failures. } } }); return fut; }
@Override public R onComplete(GridClientFuture<GridClientTaskResultBean> fut) throws GridClientException { return fut.get().getResult(); } });
/** {@inheritDoc} */ @Override public boolean active() throws GridClientException { return withReconnectHandling(new ClientProjectionClosure<Boolean>() { @Override public GridClientFuture<Boolean> apply( GridClientConnection conn, UUID nodeId ) throws GridClientConnectionResetException, GridClientClosedException { return conn.currentState(nodeId); } }).get(); } }
@Override public V onComplete(GridClientFuture<Map<K, V>> fut) throws GridClientException { Map<K, V> map = fut.get(); return F.firstValue(map); } });
/** {@inheritDoc} */ @Nullable @Override public GridClientNode refreshNode(String ip, boolean includeAttrs, boolean inclMetrics) throws GridClientException { return refreshNodeAsync(ip, includeAttrs, inclMetrics).get(); }
/** {@inheritDoc} */ @Override public void active(final boolean active) throws GridClientException { withReconnectHandling(new ClientProjectionClosure<Void>() { @Override public GridClientFuture apply( GridClientConnection conn, UUID nodeId ) throws GridClientConnectionResetException, GridClientClosedException { return conn.changeState(active, nodeId); } }).get(); }
/** {@inheritDoc} */ @Override public <K, V> Map<K, V> getAll(Collection<K> keys) throws GridClientException { return this.<K, V>getAllAsync(keys).get(); }
/** {@inheritDoc} */ @Override public GridClientNode refreshNode(UUID id, boolean includeAttrs, boolean includeMetrics) throws GridClientException { return refreshNodeAsync(id, includeAttrs, includeMetrics).get(); }
/** {@inheritDoc} */ @Override public List<GridClientNode> refreshTopology(boolean includeAttrs, boolean includeMetrics) throws GridClientException { return refreshTopologyAsync(includeAttrs, includeMetrics).get(); }
/** {@inheritDoc} */ @Override public <K, V> V get(K key) throws GridClientException { return this.<K, V>getAsync(key).get(); }
/** {@inheritDoc} */ @Override public <K> void removeAll(Collection<K> keys) throws GridClientException { removeAllAsync(keys).get(); }
/** {@inheritDoc} */ @Override public <K, V> boolean append(K key, V val) throws GridClientException { return appendAsync(key, val).get(); }
/** {@inheritDoc} */ @Override public <K, V> boolean prepend(K key, V val) throws GridClientException { return prependAsync(key, val).get(); }
/** {@inheritDoc} */ @Override public <R> R execute(String taskName, Object taskArg) throws GridClientException { return this.<R>executeAsync(taskName, taskArg).get(); }
/** {@inheritDoc} */ @Override public <K, V> void putAll(Map<K, V> entries) throws GridClientException { putAllAsync(entries).get(); }