/** * Checks for user cancellation or thread interruption. In any of those both cases, {@link TaskInterruptedException} * is thrown that might be caught and handled by caller. If not handled, thread will die-off. If handled, caller * must ensure and handle interrupt flag of current thread. */ public static void checkInterruption() throws TaskInterruptedException { Thread.yield(); if ( getCurrentProgressListener().isCanceled() ) { throw new TaskInterruptedException( "Thread \"" + Thread.currentThread().getName() + "\" is canceled!", true ); } if ( Thread.interrupted() ) { throw new TaskInterruptedException( "Thread \"" + Thread.currentThread().getName() + "\" is interrupted!", false ); } } }
/** * Checks for user cancellation or thread interruption. In any of those both cases, {@link * TaskInterruptedException} * is thrown that might be caught and handled by caller. If not handled, thread will die-off. If handled, caller * must ensure and handle interrupt flag of current thread. */ public static void checkInterruption() throws TaskInterruptedException { Thread.yield(); if (getCurrentProgressListener().isCanceled()) { throw new TaskInterruptedException("Thread \"" + Thread.currentThread().getName() + "\" is canceled!", true); } if (Thread.interrupted()) { throw new TaskInterruptedException("Thread \"" + Thread.currentThread().getName() + "\" is interrupted!", false); } } }
TaskUtil.getCurrentProgressListener().beginTask( "Recreating Maven Metadata on all Maven repositories", reposes.size() ); TaskUtil.getCurrentProgressListener().working( RepositoryStringUtils.getFormattedMessage( "Recreating Maven Metadata on %s", repo ), 1 ); repo.recreateMavenMetadata( req ); TaskUtil.getCurrentProgressListener().endTask( "Done" ); TaskUtil.getCurrentProgressListener().beginTask( RepositoryStringUtils.getFormattedMessage( "Recreating Maven Metadata on %s", mavenRepository ) ); TaskUtil.getCurrentProgressListener().endTask( "Done" );
if ( TaskUtil.getCurrentProgressListener().isCanceled() )