@Override public void run() { Thread currentThread = Thread.currentThread(); if (!currentJoinThread.compareAndSet(null, currentThread)) { return; } while (running.get() && joinThreadActive(currentThread)) { try { innerJoinCluster(); return; } catch (Exception e) { logger.error("unexpected error while joining cluster, trying again", e); // Because we catch any exception here, we want to know in // tests if an uncaught exception got to this point and the test infra uncaught exception // leak detection can catch this. In practise no uncaught exception should leak assert ExceptionsHelper.reThrowIfNotNull(e); } } // cleaning the current thread from currentJoinThread is done by explicit calls. } });
@Override public void validateSearchContext(SearchContext context, TransportRequest request) { Exception exception = null; for (SearchOperationListener listener : listeners) { try { listener.validateSearchContext(context, request); } catch (Exception e) { exception = ExceptionsHelper.useOrSuppress(exception, e); } } ExceptionsHelper.reThrowIfNotNull(exception); } }
@Override public void run() { Thread currentThread = Thread.currentThread(); if (!currentJoinThread.compareAndSet(null, currentThread)) { return; } while (running.get() && joinThreadActive(currentThread)) { try { innerJoinCluster(); return; } catch (Exception e) { logger.error("unexpected error while joining cluster, trying again", e); // Because we catch any exception here, we want to know in // tests if an uncaught exception got to this point and the test infra uncaught exception // leak detection can catch this. In practise no uncaught exception should leak assert ExceptionsHelper.reThrowIfNotNull(e); } } // cleaning the current thread from currentJoinThread is done by explicit calls. } });
@Override public void run() { Thread currentThread = Thread.currentThread(); if (!currentJoinThread.compareAndSet(null, currentThread)) { return; } while (running.get() && joinThreadActive(currentThread)) { try { innerJoinCluster(); return; } catch (Exception e) { logger.error("unexpected error while joining cluster, trying again", e); // Because we catch any exception here, we want to know in // tests if an uncaught exception got to this point and the test infra uncaught exception // leak detection can catch this. In practise no uncaught exception should leak assert ExceptionsHelper.reThrowIfNotNull(e); } } // cleaning the current thread from currentJoinThread is done by explicit calls. } });
@Override public void run() { Thread currentThread = Thread.currentThread(); if (!currentJoinThread.compareAndSet(null, currentThread)) { return; } while (running.get() && joinThreadActive(currentThread)) { try { innerJoinCluster(); return; } catch (Exception e) { logger.error("unexpected error while joining cluster, trying again", e); // Because we catch any exception here, we want to know in // tests if an uncaught exception got to this point and the test infra uncaught exception // leak detection can catch this. In practise no uncaught exception should leak assert ExceptionsHelper.reThrowIfNotNull(e); } } // cleaning the current thread from currentJoinThread is done by explicit calls. } });
ExceptionsHelper.reThrowIfNotNull(result.getFailure());
@Override public void validateSearchContext(SearchContext context, TransportRequest request) { Exception exception = null; for (SearchOperationListener listener : listeners) { try { listener.validateSearchContext(context, request); } catch (Exception e) { exception = ExceptionsHelper.useOrSuppress(exception, e); } } ExceptionsHelper.reThrowIfNotNull(exception); } }
@Override public void validateSearchContext(SearchContext context, TransportRequest request) { Exception exception = null; for (SearchOperationListener listener : listeners) { try { listener.validateSearchContext(context, request); } catch (Exception e) { exception = ExceptionsHelper.useOrSuppress(exception, e); } } ExceptionsHelper.reThrowIfNotNull(exception); } }
@Override public void validateSearchContext(SearchContext context, TransportRequest request) { Exception exception = null; for (SearchOperationListener listener : listeners) { try { listener.validateSearchContext(context, request); } catch (Exception e) { exception = ExceptionsHelper.useOrSuppress(exception, e); } } ExceptionsHelper.reThrowIfNotNull(exception); } }
@Override public void run() { Thread currentThread = Thread.currentThread(); if (!currentJoinThread.compareAndSet(null, currentThread)) { return; } while (running.get() && joinThreadActive(currentThread)) { try { innerJoinCluster(); return; } catch (Exception e) { logger.error("unexpected error while joining cluster, trying again", e); // Because we catch any exception here, we want to know in // tests if an uncaught exception got to this point and the test infra uncaught exception // leak detection can catch this. In practise no uncaught exception should leak assert ExceptionsHelper.reThrowIfNotNull(e); } } // cleaning the current thread from currentJoinThread is done by explicit calls. } });
ExceptionsHelper.reThrowIfNotNull(e);
protected Consumer<Mapping> getMappingUpdater(IndexShard shard, String type) { return update -> { try { updateMappings(shard, IndexMetaData.builder(shard.indexSettings().getIndexMetaData()) .putMapping(type, update.toString()).build()); } catch (IOException e) { ExceptionsHelper.reThrowIfNotNull(e); } }; }
@Override public long indexTranslogOperations(List<Translog.Operation> operations, int totalTranslogOps) throws IOException { final RecoveryState.Translog translog = state().getTranslog(); translog.totalOperations(totalTranslogOps); assert indexShard().recoveryState() == state(); if (indexShard().state() != IndexShardState.RECOVERING) { throw new IndexShardNotRecoveringException(shardId, indexShard().state()); } for (Translog.Operation operation : operations) { Engine.Result result = indexShard().applyTranslogOperation(operation, Engine.Operation.Origin.PEER_RECOVERY); if (result.getResultType() == Engine.Result.Type.MAPPING_UPDATE_REQUIRED) { throw new MapperException("mapping updates are not allowed [" + operation + "]"); } assert result.getFailure() == null: "unexpected failure while replicating translog entry: " + result.getFailure(); ExceptionsHelper.reThrowIfNotNull(result.getFailure()); } // update stats only after all operations completed (to ensure that mapping updates don't mess with stats) translog.incrementRecoveredOperations(operations.size()); indexShard().sync(); // roll over / flush / trim if needed indexShard().afterWriteOperation(); return indexShard().getLocalCheckpoint(); }
ExceptionsHelper.reThrowIfNotNull(result.getFailure());