com.octo.android.robospice.request
Class DefaultRequestRunner

java.lang.Object
  extended by com.octo.android.robospice.request.DefaultRequestRunner
All Implemented Interfaces:
RequestRunner

public class DefaultRequestRunner
extends Object
implements RequestRunner

Default implementation of RequestRunner. Processes requests. This class is massively multi-threaded and offers good performances when processing multiple requests simulaneously.

Author:
SNI, Andrew Clark

Constructor Summary
DefaultRequestRunner(android.content.Context context, CacheManager cacheManager, ExecutorService executorService, RequestProgressManager requestProgressBroadcaster, NetworkStateChecker networkStateChecker)
           
 
Method Summary
 void executeRequest(CachedSpiceRequest<?> request)
          Executes a request asynchronously.
 boolean isFailOnCacheError()
           
 boolean isStopped()
           
protected  void planRequestExecution(CachedSpiceRequest<?> request)
           
protected
<T> void
processRequest(CachedSpiceRequest<T> request)
           
 void setFailOnCacheError(boolean failOnCacheError)
           
 void shouldStop()
          Will be called to notify implementations that no further request processing is needed anymore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRequestRunner

public DefaultRequestRunner(android.content.Context context,
                            CacheManager cacheManager,
                            ExecutorService executorService,
                            RequestProgressManager requestProgressBroadcaster,
                            NetworkStateChecker networkStateChecker)
Method Detail

executeRequest

public void executeRequest(CachedSpiceRequest<?> request)
Description copied from interface: RequestRunner
Executes a request asynchronously.

Specified by:
executeRequest in interface RequestRunner
Parameters:
request - the request to execute.

processRequest

protected <T> void processRequest(CachedSpiceRequest<T> request)

planRequestExecution

protected void planRequestExecution(CachedSpiceRequest<?> request)

isFailOnCacheError

public boolean isFailOnCacheError()
Specified by:
isFailOnCacheError in interface RequestRunner
Returns:
whether or not the runner has to fail on cache errors.

setFailOnCacheError

public void setFailOnCacheError(boolean failOnCacheError)
Specified by:
setFailOnCacheError in interface RequestRunner

shouldStop

public void shouldStop()
Description copied from interface: RequestRunner
Will be called to notify implementations that no further request processing is needed anymore. Use this method to clean up resources.

Specified by:
shouldStop in interface RequestRunner

isStopped

public boolean isStopped()


Copyright © 2012-2014. All Rights Reserved.