From 1e5b85a2cb459873b5e7b1ded145b05fd3889ace Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Wed, 28 Sep 2011 17:25:46 +0200 Subject: [PATCH] 359255: Allow HttpExchange state change from START to EXPIRED --- .../eclipse/jetty/client/HttpExchange.java | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java index 9f431e51e74..e3e07a187b5 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java @@ -208,6 +208,9 @@ public class HttpExchange case STATUS_EXCEPTED: set = _status.compareAndSet(oldStatus,newStatus); break; + case STATUS_EXPIRED: + set = setStatusExpired(newStatus,oldStatus); + break; } break; case STATUS_WAITING_FOR_CONNECTION: @@ -219,8 +222,7 @@ public class HttpExchange set = _status.compareAndSet(oldStatus,newStatus); break; case STATUS_EXPIRED: - if (set = _status.compareAndSet(oldStatus,newStatus)) - getEventListener().onExpire(); + set = setStatusExpired(newStatus,oldStatus); break; } break; @@ -233,8 +235,7 @@ public class HttpExchange set = _status.compareAndSet(oldStatus,newStatus); break; case STATUS_EXPIRED: - if (set = _status.compareAndSet(oldStatus,newStatus)) - getEventListener().onExpire(); + set = setStatusExpired(newStatus,oldStatus); break; } break; @@ -250,8 +251,7 @@ public class HttpExchange set = _status.compareAndSet(oldStatus,newStatus); break; case STATUS_EXPIRED: - if (set = _status.compareAndSet(oldStatus,newStatus)) - getEventListener().onExpire(); + set = setStatusExpired(newStatus,oldStatus); break; } break; @@ -264,8 +264,7 @@ public class HttpExchange set = _status.compareAndSet(oldStatus,newStatus); break; case STATUS_EXPIRED: - if (set = _status.compareAndSet(oldStatus,newStatus)) - getEventListener().onExpire(); + set = setStatusExpired(newStatus,oldStatus); break; } break; @@ -281,8 +280,7 @@ public class HttpExchange set = _status.compareAndSet(oldStatus,newStatus); break; case STATUS_EXPIRED: - if (set = _status.compareAndSet(oldStatus,newStatus)) - getEventListener().onExpire(); + set = setStatusExpired(newStatus,oldStatus); break; } break; @@ -298,8 +296,7 @@ public class HttpExchange set = _status.compareAndSet(oldStatus,newStatus); break; case STATUS_EXPIRED: - if (set = _status.compareAndSet(oldStatus,newStatus)) - getEventListener().onExpire(); + set = setStatusExpired(newStatus,oldStatus); break; } break; @@ -359,6 +356,14 @@ public class HttpExchange } } + private boolean setStatusExpired(int newStatus, int oldStatus) + { + boolean set; + if (set = _status.compareAndSet(oldStatus,newStatus)) + getEventListener().onExpire(); + return set; + } + public boolean isDone() { synchronized (this)