src/java/org/apache/cassandra/service/AntiEntropyService.java
// we don't care about the return value but care about it throwing exception
we don't care about the return value but care about it throwing exception
we don ' t care about the return value but care about it throwing exception
public void runMayThrow() throws Exception
        {
            logger.info(String.format("[repair #%s] new session: will sync %s on range %s for %s.%s", getName(), repairedNodes(), range, tablename, Arrays.toString(cfnames)));
            if (endpoints.isEmpty())
            {
                differencingDone.signalAll();
                logger.info("[repair #%s] No neighbors to repair with on range %s: session completed", getName(), range);
                return;
            }
            for (InetAddress endpoint : endpoints)
            {
                if (!FailureDetector.instance.isAlive(endpoint))
                {
                    differencingDone.signalAll();
                    logger.info(String.format("[repair #%s] Cannot proceed on repair because a neighbor (%s) is dead: session failed", getName(), endpoint));
                    return;
                }
            }
            AntiEntropyService.instance.sessions.put(getName(), this);
            Gossiper.instance.register(this);
            FailureDetector.instance.registerFailureDetectionEventListener(this);
            try
            {
                for (String cfname : cfnames)
                {
                    RepairJob job = new RepairJob(cfname);
                    jobs.offer(job);
                    activeJobs.put(cfname, job);
                }
                jobs.peek().sendTreeRequests();
                completed.await();
                if (exception == null)
                {
                    logger.info(String.format("[repair #%s] session completed successfully", getName()));
                }
                else
                {
                    logger.error(String.format("[repair #%s] session completed with the following error", getName()), exception);
                    throw exception;
                }
            }
            catch (InterruptedException e)
            {
                throw new RuntimeException("Interrupted while waiting for repair.");
            }
            finally
            {
                terminate();
                FailureDetector.instance.unregisterFailureDetectionEventListener(this);
                Gossiper.instance.unregister(this);
                AntiEntropyService.instance.sessions.remove(getName());
            }
        }
public void runMayThrow ( ) throws Exception { logger . info ( String . format ( "[repair #%s] new session: will sync %s on range %s for %s.%s" , getName ( ) , repairedNodes ( ) , range , tablename , Arrays . toString ( cfnames ) ) ) ; if ( endpoints . isEmpty ( ) ) { differencingDone . signalAll ( ) ; logger . info ( "[repair #%s] No neighbors to repair with on range %s: session completed" , getName ( ) , range ) ; return ; } for ( InetAddress endpoint : endpoints ) { if ( ! FailureDetector . instance . isAlive ( endpoint ) ) { differencingDone . signalAll ( ) ; logger . info ( String . format ( "[repair #%s] Cannot proceed on repair because a neighbor (%s) is dead: session failed" , getName ( ) , endpoint ) ) ; return ; } } AntiEntropyService . instance . sessions . put ( getName ( ) , this ) ; Gossiper . instance . register ( this ) ; FailureDetector . instance . registerFailureDetectionEventListener ( this ) ; try { for ( String cfname : cfnames ) { RepairJob job = new RepairJob ( cfname ) ; jobs . offer ( job ) ; activeJobs . put ( cfname , job ) ; } jobs . peek ( ) . sendTreeRequests ( ) ; completed . await ( ) ; if ( exception == null ) { logger . info ( String . format ( "[repair #%s] session completed successfully" , getName ( ) ) ) ; } else { logger . error ( String . format ( "[repair #%s] session completed with the following error" , getName ( ) ) , exception ) ; throw exception ; } } catch ( InterruptedException e ) { throw new RuntimeException ( "Interrupted while waiting for repair." ) ; } finally { terminate ( ) ; FailureDetector . instance . unregisterFailureDetectionEventListener ( this ) ; Gossiper . instance . unregister ( this ) ; AntiEntropyService . instance . sessions . remove ( getName ( ) ) ; } }
we don't care about the return value but care about it throwing exception
we don ' t care about the return value but care about it throwing exception
// Checking all nodes are live // Create and queue a RepairJob for each column family // block whatever thread started this session until all requests have been returned: // if this thread dies, the session will still complete in the background // mark this session as terminated