com.path.android.jobqueue
Class BaseJob

java.lang.Object
  extended by com.path.android.jobqueue.BaseJob
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Job

Deprecated.

@Deprecated
public abstract class BaseJob
extends java.lang.Object
implements java.io.Serializable

This class has been deprecated and will soon be removed from public api. Please use Job instead which provider a cleaner constructor API. Deprecated. Use Job

See Also:
Serialized Form

Field Summary
static int DEFAULT_RETRY_LIMIT
          Deprecated.  
 
Constructor Summary
protected BaseJob(boolean requiresNetwork)
          Deprecated.  
  BaseJob(boolean requiresNetwork, boolean persistent)
          Deprecated.  
protected BaseJob(boolean requiresNetwork, boolean persistent, java.lang.String groupId)
          Deprecated.  
protected BaseJob(boolean requiresNetwork, java.lang.String groupId)
          Deprecated.  
protected BaseJob(java.lang.String groupId)
          Deprecated.  
 
Method Summary
protected  int getCurrentRunCount()
          Deprecated. before each run, JobManager sets this number.
protected  int getRetryLimit()
          Deprecated. By default, jobs will be retried DEFAULT_RETRY_LIMIT times.
 java.lang.String getRunGroupId()
          Deprecated. Some jobs may require being run synchronously.
 boolean isPersistent()
          Deprecated. defines if we should add this job to disk or non-persistent queue
abstract  void onAdded()
          Deprecated. called when the job is added to disk and committed.
protected abstract  void onCancel()
          Deprecated. called when a job is cancelled.
abstract  void onRun()
          Deprecated. The actual method that should to the work It should finish w/o any exception.
 boolean requiresNetwork()
          Deprecated. if job is set to require network, it will not be called unless NetworkUtil reports that there is a network connection
 boolean safeRun(int currentRunCount)
          Deprecated. Runs the job and catches any exception
protected abstract  boolean shouldReRunOnThrowable(java.lang.Throwable throwable)
          Deprecated. if onRun method throws an exception, this method is called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RETRY_LIMIT

public static final int DEFAULT_RETRY_LIMIT
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

BaseJob

protected BaseJob(boolean requiresNetwork)
Deprecated. 

BaseJob

protected BaseJob(java.lang.String groupId)
Deprecated. 

BaseJob

protected BaseJob(boolean requiresNetwork,
                  java.lang.String groupId)
Deprecated. 

BaseJob

public BaseJob(boolean requiresNetwork,
               boolean persistent)
Deprecated. 

BaseJob

protected BaseJob(boolean requiresNetwork,
                  boolean persistent,
                  java.lang.String groupId)
Deprecated. 
Method Detail

isPersistent

public final boolean isPersistent()
Deprecated. 
defines if we should add this job to disk or non-persistent queue

Returns:

onAdded

public abstract void onAdded()
Deprecated. 
called when the job is added to disk and committed. this means job will eventually run. this is a good time to update local database and dispatch events Changes to this class will not be preserved if your job is persistent !!! Also, if your app crashes right after adding the job, onRun might be called without an onAdded call


onRun

public abstract void onRun()
                    throws java.lang.Throwable
Deprecated. 
The actual method that should to the work It should finish w/o any exception. If it throws any exception, shouldReRunOnThrowable will be called to decide either to dismiss the job or re-run it.

Throws:
java.lang.Throwable

onCancel

protected abstract void onCancel()
Deprecated. 
called when a job is cancelled.


shouldReRunOnThrowable

protected abstract boolean shouldReRunOnThrowable(java.lang.Throwable throwable)
Deprecated. 
if onRun method throws an exception, this method is called. return true if you want to run your job again, return false if you want to dismiss it. If you return false, onCancel will be called.


safeRun

public final boolean safeRun(int currentRunCount)
Deprecated. 
Runs the job and catches any exception

Parameters:
currentRunCount -
Returns:

getCurrentRunCount

protected int getCurrentRunCount()
Deprecated. 
before each run, JobManager sets this number. Might be useful for the onRun() method

Returns:

requiresNetwork

public final boolean requiresNetwork()
Deprecated. 
if job is set to require network, it will not be called unless NetworkUtil reports that there is a network connection

Returns:

getRunGroupId

public final java.lang.String getRunGroupId()
Deprecated. 
Some jobs may require being run synchronously. For instance, if it is a job like sending a comment, we should never run them in parallel (unless they are being sent to different conversations). By assigning same groupId to jobs, you can ensure that that type of jobs will be run in the order they were given (if their priority is the same).

Returns:

getRetryLimit

protected int getRetryLimit()
Deprecated. 
By default, jobs will be retried DEFAULT_RETRY_LIMIT times. If job fails this many times, onCancel will be called w/o calling shouldReRunOnThrowable

Returns: