@Override public String getMessage() { return super.getMessage() + ": " + failedKeys; } }
/** {@inheritDoc} */ @Override public String toString() { return getClass() + ": " + getMessage(); } }
/** * @param e Error if occurred. */ public void error(GridException e) { err = e.getMessage(); errCode = errorCode(e); }
/** * @param e Error if occurred. */ public void error(GridException e) { err = e.getMessage(); errCode = errorCode(e); }
/** {@inheritDoc} */ @Override public synchronized void transferFrom(DataInput in, int len) throws IOException { checkClosed(in, len); long startTime = System.nanoTime(); // Send all IPC data from the local buffer before streaming. if (buf != null && buf.position() > 0) sendData(true); try { storeDataBlocks(in, len); } catch (GridException e) { throw new IOException(e.getMessage(), e); } time += System.nanoTime() - startTime; }
@Override public boolean apply(InetSocketAddress addr) { Boolean res = pingResMap.get(addr); if (res == null) try { res = pingNode(addr) != null; } catch (GridException e) { if (log.isDebugEnabled()) log.debug("Failed to ping node [addr=" + addr + ", err=" + e.getMessage() + ']'); res = false; } finally { pingResMap.put(addr, res); } return !res; } }
/** {@inheritDoc} */ @Override public synchronized void transferFrom(DataInput in, int len) throws IOException { checkClosed(in, len); long startTime = System.nanoTime(); // Send all IPC data from the local buffer before streaming. if (buf != null && buf.position() > 0) sendData(true); try { storeDataBlocks(in, len); } catch (GridException e) { throw new IOException(e.getMessage(), e); } time += System.nanoTime() - startTime; }
/** {@inheritDoc} */ @Override public void drResume() { checkDrEnabled(); try { ctx.dr().resume(); } catch (GridException e) { throw new IllegalStateException(e.getMessage()); } }
/** {@inheritDoc} */ @Override public void drPause() { checkDrEnabled(); try { ctx.dr().pause(); } catch (GridException e) { throw new IllegalStateException(e.getMessage()); } }
@Override public void apply(GridFuture<GridCacheTxEx<K, V>> f) { try { f.get(); // Check for errors of a parent future. } catch (GridException e) { log.debug("Failed to prepare transaction during rollback (will ignore) [tx=" + this + ", msg=" + e.getMessage() + ']'); } fut.finish(); } });
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ private Object readResolve() throws ObjectStreamException { try { GridBiTuple<GridCacheContext, String> t = stash.get(); return t.get1().dataStructures().atomicLong(t.get2(), 0L, false); } catch (GridException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { GridBiTuple<GridCacheContext, String> t = stash.get(); return t.get1().dataStructures().set(t.get2(), false, false); } catch (GridException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ protected Object readResolve() throws ObjectStreamException { try { GridBiTuple<GridCacheContext, String> t = stash.get(); return t.get1().dataStructures().queue(t.get2(), 0, false, false); } catch (GridException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ private Object readResolve() throws ObjectStreamException { try { GridBiTuple<GridCacheContext, String> t = stash.get(); return t.get1().dataStructures().sequence(t.get2(), 0L, false); } catch (GridException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Reconstructs object on unmarshalling. * * @return Reconstructed object. * @throws ObjectStreamException Thrown in case of unmarshalling error. */ @SuppressWarnings({"ConstantConditions"}) private Object readResolve() throws ObjectStreamException { try { GridBiTuple<GridCacheContext, String> t = stash.get(); return t.get1().dataStructures().countDownLatch(t.get2(), 0, false, false); } catch (GridException e) { throw U.withCause(new InvalidObjectException(e.getMessage()), e); } finally { stash.remove(); } }
/** * Checks entry for empty value. * * @param entry Entry to check. * @return {@code True} if entry is empty. */ private boolean empty(GridCacheEntry<K, V> entry) { try { return entry.peek(F.asList(GLOBAL)) == null; } catch (GridException e) { U.error(null, e.getMessage(), e); assert false : "Should never happen: " + e; return false; } }
/** * Checks entry for empty value. * * @param entry Entry to check. * @return {@code True} if entry is empty. */ private boolean empty(GridCacheEntry<K, V> entry) { try { return entry.peek(F.asList(GLOBAL)) == null; } catch (GridException e) { U.error(null, e.getMessage(), e); assert false : "Should never happen: " + e; return false; } }
/** {@inheritDoc} */ @Override public byte[] reduce(List<GridComputeJobResult> results) throws GridException { byte status; byte[] bytes; GridComputeJobResult res = F.first(results); if (res.getException() == null) { status = 0; bytes = MARSHALLER.marshal(res.getData()); } else { status = 1; bytes = MARSHALLER.marshal(new SQLException(res.getException().getMessage())); } byte[] packet = new byte[bytes.length + 1]; packet[0] = status; U.arrayCopy(bytes, 0, packet, 1, bytes.length); return packet; }
/** * Send delete message to all meta cache nodes in the grid. * * @param msg Message to send. */ private void sendDeleteMessage(GridGgfsDeleteMessage msg) { assert msg != null; Collection<GridNode> nodes = meta.metaCacheNodes(); boolean first = true; for (GridNode node : nodes) { GridGgfsCommunicationMessage msg0 = first ? msg : (GridGgfsCommunicationMessage)msg.clone(); first = false; try { ggfsCtx.send(node, topic, msg0, GridIoPolicy.SYSTEM_POOL); } catch (GridException e) { U.warn(log, "Failed to send GGFS delete message to node [nodeId=" + node.id() + ", msg=" + msg + ", err=" + e.getMessage() + ']'); } } } }
/** * Send delete message to all meta cache nodes in the grid. * * @param msg Message to send. */ private void sendDeleteMessage(GridGgfsDeleteMessage msg) { assert msg != null; Collection<GridNode> nodes = meta.metaCacheNodes(); boolean first = true; for (GridNode node : nodes) { GridGgfsCommunicationMessage msg0 = first ? msg : (GridGgfsCommunicationMessage)msg.clone(); first = false; try { ggfsCtx.send(node, topic, msg0, GridIoPolicy.SYSTEM_POOL); } catch (GridException e) { U.warn(log, "Failed to send GGFS delete message to node [nodeId=" + node.id() + ", msg=" + msg + ", err=" + e.getMessage() + ']'); } } } }