protected void checkInterruption() throws TaskInterruptedException { TaskUtil.checkInterruption(); } }
/** * 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 ); } } }
this.progressListener = new LoggingProgressListener(getCallable().getClass().getSimpleName()); TaskUtil.setCurrent(this.progressListener); TaskUtil.setCurrent(null);
/** * 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.setCurrent( this.progressListener ); TaskUtil.setCurrent( null );
protected void checkInterruption() throws TaskInterruptedException { TaskUtil.checkInterruption(); } }
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" );
@Override public boolean isStopped() { try { TaskUtil.checkInterruption(); } catch ( TaskInterruptedException e ) { if ( stopCause == null ) { stopCause = e; } running = false; } return !running; }
if ( TaskUtil.getCurrentProgressListener().isCanceled() )
public void working(final String message) { TaskUtil.checkInterruption(); if (wrapped != null) { wrapped.working(message); } }
public void working( final int workDone ) { TaskUtil.checkInterruption(); if ( wrapped != null ) { wrapped.working( workDone ); } }
public void working( final String message, final int work ) { TaskUtil.checkInterruption(); if ( wrapped != null ) { wrapped.working( message, work ); } }
public void beginTask( final String name, final int toDo ) { TaskUtil.checkInterruption(); if ( wrapped != null ) { wrapped.beginTask( name, toDo ); } }
public void working( final String message ) { TaskUtil.checkInterruption(); if ( wrapped != null ) { wrapped.working( message ); } }
public void beginTask(final String name) { TaskUtil.checkInterruption(); if (wrapped != null) { wrapped.beginTask(name); } }
public void working(final String message, final int work) { TaskUtil.checkInterruption(); if (wrapped != null) { wrapped.working(message, work); } }
public void beginTask( final String name ) { TaskUtil.checkInterruption(); if ( wrapped != null ) { wrapped.beginTask( name ); } }
public void endTask( final String message ) { TaskUtil.checkInterruption(); if ( wrapped != null ) { wrapped.endTask( message ); } }
public void beginTask(final String name, final int toDo) { TaskUtil.checkInterruption(); if (wrapped != null) { wrapped.beginTask(name, toDo); } }
public void working(final int workDone) { TaskUtil.checkInterruption(); if (wrapped != null) { wrapped.working(workDone); } }