Simplified abort logic.

This commit is contained in:
Simone Bordet 2015-02-26 23:24:44 +01:00
parent 31a0b36f3c
commit bbc2d0c29d
1 changed files with 1 additions and 30 deletions

View File

@ -492,9 +492,7 @@ public abstract class HttpSender implements AsyncContentProvider.Listener
public boolean abort(Throwable failure)
{
RequestState current = requestState.get();
boolean abortable = isBeforeCommit(current) || isSending(current);
return abortable && anyToFailure(failure);
return anyToFailure(failure);
}
private boolean updateRequestState(RequestState from, RequestState to)
@ -513,33 +511,6 @@ public abstract class HttpSender implements AsyncContentProvider.Listener
return updated;
}
private boolean isBeforeCommit(RequestState requestState)
{
switch (requestState)
{
case TRANSIENT:
case QUEUED:
case BEGIN:
case HEADERS:
return true;
default:
return false;
}
}
private boolean isSending(RequestState requestState)
{
switch (requestState)
{
case TRANSIENT_CONTENT:
case COMMIT:
case CONTENT:
return true;
default:
return false;
}
}
private RuntimeException illegalSenderState(SenderState current)
{
return new IllegalStateException("Expected " + current + " found " + senderState.get() + " instead");