Codota Logo
TaskState.equals
Code IndexAdd Codota to your IDE (free)

How to use
equals
method
in
org.sonatype.scheduling.TaskState

Best Java code snippets using org.sonatype.scheduling.TaskState.equals (Showing top 20 results out of 315)

  • Common ways to obtain TaskState
private void myMethod () {
TaskState t =
  • Codota IconScheduledTask scheduledTask;scheduledTask.getTaskState()
  • Smart code suggestions by Codota
}
origin: org.sonatype.nexus/nexus-scheduler

public boolean isEndingState() {
   /* I don't think BROKEN should apply, broken simply means an exception was thrown.
    * So what?  let the user attempt to do it again, maybe an fs perm problem that they resolved */
 return this.equals(FINISHED) || this.equals(CANCELLED);
}
origin: org.sonatype.nexus/nexus-scheduler

public boolean isActiveOrSubmitted() {
 return this.equals(SUBMITTED) || this.equals(RUNNING) || this.equals(SLEEPING) || this.equals(WAITING)
   || this.equals(CANCELLING);
}
origin: org.sonatype.nexus/nexus-scheduler

public boolean isRunnable() {
 return this.equals(SUBMITTED) || this.equals(RUNNING) || this.equals(SLEEPING) || this.equals(WAITING) ||
   this.equals(BROKEN);
}
origin: org.sonatype.nexus/nexus-scheduler

public boolean isExecuting() {
 return this.equals(RUNNING) || this.equals(CANCELLING);
}
origin: org.sonatype.sisu/sisu-task-scheduler

public boolean isActiveOrSubmitted()
{
  return this.equals( SUBMITTED ) || this.equals( RUNNING ) || this.equals( SLEEPING ) || this.equals( WAITING )
    || this.equals( CANCELLING );
}

origin: org.sonatype.sisu/sisu-task-scheduler

public boolean isEndingState()
{
  /* I don't think BROKEN should apply, broken simply means an exception was thrown.
   * So what?  let the user attempt to do it again, maybe an fs perm problem that they resolved */
  return this.equals( FINISHED ) || this.equals( CANCELLED );
}
origin: org.sonatype.sisu/sisu-task-scheduler

public boolean isRunnable()
{
  return this.equals( SUBMITTED ) || this.equals( RUNNING ) || this.equals( SLEEPING ) || this.equals( WAITING ) || this.equals( BROKEN );
}

origin: org.sonatype.sisu/sisu-task-scheduler

public boolean isExecuting()
{
  return this.equals( RUNNING ) || this.equals( CANCELLING );
}
origin: org.sonatype.nexus/nexus-scheduler

public boolean isActive() {
 return this.equals(RUNNING) || this.equals(SLEEPING) || this.equals(WAITING) || this.equals(CANCELLING);
}
origin: org.sonatype.sisu/sisu-task-scheduler

public boolean isActive()
{
  return this.equals( RUNNING ) || this.equals( SLEEPING ) || this.equals( WAITING ) || this.equals( CANCELLING );
}
origin: org.sonatype.nexus.plugins/nexus-yum-repository-plugin

private boolean isSubmitted(ScheduledTask<?> scheduledTask) {
 return SUBMITTED.equals(scheduledTask.getTaskState()) || SLEEPING.equals(scheduledTask.getTaskState());
}
origin: org.sonatype.nexus/nexus-app

public boolean allowConcurrentExecution( Map<String, List<ScheduledTask<?>>> activeTasks )
{
  // most basic check: simply not allowing multiple execution of instances of this class
  // override if needed
  if ( activeTasks.containsKey( this.getClass().getSimpleName() ) )
  {
    for ( ScheduledTask<?> task : activeTasks.get( this.getClass().getSimpleName() ) )
    {
      if ( TaskState.RUNNING.equals( task.getTaskState() ) )
      {
        return false;
      }
    }
    return true;
  }
  else
  {
    return true;
  }
}
origin: org.sonatype.nexus/nexus-scheduler

 public Map<String, List<ScheduledTask<?>>> getRunningTasks() {
  Map<String, List<ScheduledTask<?>>> result = getAllTasks();
  List<ScheduledTask<?>> tasks = null;

  // filter for RUNNING
  for (Iterator<String> c = result.keySet().iterator(); c.hasNext(); ) {
   String cls = c.next();
   tasks = result.get(cls);

   for (Iterator<ScheduledTask<?>> i = tasks.iterator(); i.hasNext(); ) {
    ScheduledTask<?> task = i.next();

    if (!TaskState.RUNNING.equals(task.getTaskState())) {
     i.remove();
    }
   }

   if (tasks.isEmpty()) {
    c.remove();
   }
  }

  return result;
 }
}
origin: org.sonatype.sisu/sisu-task-scheduler

  public Map<String, List<ScheduledTask<?>>> getRunningTasks()
  {
    Map<String, List<ScheduledTask<?>>> result = getAllTasks();
    List<ScheduledTask<?>> tasks = null;

    // filter for RUNNING
    for ( Iterator<String> c = result.keySet().iterator(); c.hasNext(); )
    {
      String cls = c.next();
      tasks = result.get( cls );

      for ( Iterator<ScheduledTask<?>> i = tasks.iterator(); i.hasNext(); )
      {
        ScheduledTask<?> task = i.next();

        if ( !TaskState.RUNNING.equals( task.getTaskState() ) )
        {
          i.remove();
        }
      }

      if ( tasks.isEmpty() )
      {
        c.remove();
      }
    }

    return result;
  }
}
origin: org.sonatype.nexus.plugins/nexus-yum-repository-plugin

@Override
public boolean allowConcurrentExecution(Map<String, List<ScheduledTask<?>>> activeTasks) {
 if (activeTasks.containsKey(ID)) {
  for (ScheduledTask<?> scheduledTask : activeTasks.get(ID)) {
   if (RUNNING.equals(scheduledTask.getTaskState())) {
    if (conflictsWith((MergeMetadataTask) scheduledTask.getTask())) {
     return false;
    }
   }
  }
 }
 return true;
}
origin: org.sonatype.nexus/nexus-scheduler

public T getIfDone() {
 if (TaskState.FINISHED.equals(getTaskState())) {
  try {
   return getFuture().get();
  }
  catch (ExecutionException e) {
   return null;
  }
  catch (InterruptedException e) {
   return null;
  }
 }
 else {
  return null;
 }
}
origin: org.sonatype.nexus.plugins/nexus-yum-repository-plugin

@Override
public boolean allowConcurrentExecution(Map<String, List<ScheduledTask<?>>> activeTasks) {
 if (activeTasks.containsKey(ID)) {
  int activeRunningTasks = 0;
  for (ScheduledTask<?> scheduledTask : activeTasks.get(ID)) {
   if (RUNNING.equals(scheduledTask.getTaskState())) {
    if (conflictsWith((GenerateMetadataTask) scheduledTask.getTask())) {
     return false;
    }
    activeRunningTasks++;
   }
  }
  return activeRunningTasks < yumRegistry.maxNumberOfParallelThreads();
 }
 return true;
}
origin: org.sonatype.nexus/nexus-scheduler

public void runNow() {
 // if we are not RUNNING
 if (!TaskState.RUNNING.equals(getTaskState()) && !manualRun) {
  manualRun = true;
  if (getFuture() != null) {
   //as bentmann mentioned, there is potential for the future to have started running between the check on our if above and now
   //so we force interrupt it
   getFuture().cancel(true);
  }
  setFuture(doSchedule(-1, true));
 }
}
origin: org.sonatype.sisu/sisu-task-scheduler

public void runNow()
{
  // if we are not RUNNING
  if ( !TaskState.RUNNING.equals( getTaskState() ) && !manualRun )
  {
    manualRun = true;
    
    if ( getFuture() != null )
    {
      //as bentmann mentioned, there is potential for the future to have started running between the check on our if above and now
      //so we force interrupt it
      getFuture().cancel( true );
    }
    
    setFuture( doSchedule( 0 ) );
  }
}
origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

protected String getLastRunResult(ScheduledTask<?> task) {
 String lastRunResult = "n/a";
 if (task.getLastStatus() != null) {
  lastRunResult = TaskState.BROKEN.equals(task.getLastStatus()) ? "Error" : "Ok";
  if (task.getDuration() != 0) {
   long milliseconds = task.getDuration();
   int hours = (int) ((milliseconds / 1000) / 3600);
   int minutes = (int) ((milliseconds / 1000) / 60 - hours * 60);
   int seconds = (int) ((milliseconds / 1000) % 60);
   lastRunResult += " [";
   if (hours != 0) {
    lastRunResult += hours;
    lastRunResult += "h";
   }
   if (minutes != 0 || hours != 0) {
    lastRunResult += minutes;
    lastRunResult += "m";
   }
   lastRunResult += seconds;
   lastRunResult += "s";
   lastRunResult += "]";
  }
 }
 return lastRunResult;
}
org.sonatype.schedulingTaskStateequals

Popular methods of TaskState

  • isExecuting
  • isActiveOrSubmitted
  • isEndingState
  • isRunnable
  • toString
  • name

Popular in Java

  • Running tasks concurrently on multiple threads
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • findViewById (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now