public abstract class NetworkTask extends java.lang.Object implements Task
Task.TaskListener
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_CONNECT_TIMEOUT |
protected static int |
DEFAULT_READ_TIMEOUT |
protected static int |
DEFAULT_RETRY_COUNT |
static boolean |
LOG_ENABLED |
protected long |
mBackoffMillis |
protected int |
mConnectTimeout |
protected int |
mMaxRetries |
protected int |
mReadTimeout |
protected int |
mRetries |
protected boolean |
mStatus |
protected java.lang.String |
mUrl |
Constructor and Description |
---|
NetworkTask() |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
doNetworkTask() |
protected abstract java.lang.String |
getLogTag() |
boolean |
isSucceeded() |
void |
reset() |
boolean |
run() |
NetworkTask |
setBackoffMillis(long backoff) |
NetworkTask |
setConnectTimeout(int timeout)
Set the socket connection timeout
|
NetworkTask |
setReadTimeout(int timeout)
Set's the tcp socket read timeout.
|
NetworkTask |
setRetryCount(int retry) |
NetworkTask |
setUrl(java.lang.String url) |
public static boolean LOG_ENABLED
protected static final int DEFAULT_CONNECT_TIMEOUT
protected static final int DEFAULT_READ_TIMEOUT
protected static final int DEFAULT_RETRY_COUNT
protected java.lang.String mUrl
protected boolean mStatus
protected int mMaxRetries
protected int mRetries
protected int mConnectTimeout
protected int mReadTimeout
protected long mBackoffMillis
public NetworkTask setUrl(java.lang.String url)
public NetworkTask setConnectTimeout(int timeout)
timeout
- connection timeout in milliseconds. 0 means no timeoutpublic NetworkTask setReadTimeout(int timeout)
timeout
- public NetworkTask setRetryCount(int retry)
public NetworkTask setBackoffMillis(long backoff)
public boolean isSucceeded()
isSucceeded
in interface Task
protected abstract boolean doNetworkTask()
protected abstract java.lang.String getLogTag()