Revision: db9eb55f8492
Author: [email protected] <[email protected]>
Date: Mon Jul 8 04:40:32 2013
Log: Fixed Issue #75 : HTTP Client RA : Response event shouldn't be
fired on Activity already ended.
http://code.google.com/p/jain-slee/source/detail?r=db9eb55f8492&repo=http
Modified:
/resources/http-client/ra/src/main/java/org/mobicents/client/slee/resource/http/HttpClientActivityImpl.java
/resources/http-client/ra/src/main/java/org/mobicents/client/slee/resource/http/HttpClientResourceAdaptor.java
/resources/http-client/ratype/src/main/java/net/java/client/slee/resource/http/HttpClientActivity.java
=======================================
---
/resources/http-client/ra/src/main/java/org/mobicents/client/slee/resource/http/HttpClientActivityImpl.java
Wed Aug 15 08:42:06 2012
+++
/resources/http-client/ra/src/main/java/org/mobicents/client/slee/resource/http/HttpClientActivityImpl.java
Mon Jul 8 04:40:32 2013
@@ -42,6 +42,7 @@
private final HttpClientResourceAdaptor ra;
private final boolean endOnReceivingResponse;
private final HttpContext context;
+ private volatile boolean ended = false;
public HttpClientActivityImpl(HttpClientResourceAdaptor ra,
boolean endOnReceivingResponse, HttpContext context) {
@@ -58,7 +59,11 @@
throw new IllegalStateException(
"Activity will end automatically as soon as
Response is received");
}
- this.ra.endActivity(this);
+ try{
+ this.ra.endActivity(this);
+ }finally{
+ this.ended = true;
+ }
}
@Override
@@ -90,8 +95,16 @@
public String getSessionId() {
return sessionId;
}
+ @Override
+ public boolean isEnded() {
+ return ended;
+ }
+
+ protected void setEnded(boolean ended) {
+ this.ended = ended;
+ }
- @Override
+ @Override
public int hashCode() {
return sessionId.hashCode();
}
=======================================
---
/resources/http-client/ra/src/main/java/org/mobicents/client/slee/resource/http/HttpClientResourceAdaptor.java
Wed Aug 15 08:42:06 2012
+++
/resources/http-client/ra/src/main/java/org/mobicents/client/slee/resource/http/HttpClientResourceAdaptor.java
Mon Jul 8 04:40:32 2013
@@ -596,12 +596,24 @@
event = new ResponseEvent(e,
requestApplicationData);
}
+
+ if(this.activity.isEnded()){
+ //received response event for which activity is already ended. Just
add this in logs
+ tracer.warning(String.format("Wanted to fire ResponseEvent for
HttpClientActivity %s but activity is already ended, " +
+ "droping event",
this.activity.getSessionId()));
+ return;
+ }
+
// process event
processResponseEvent(event, this.activity);
// If EndOnReceivingResponse is set to true, end the
Activity
if (this.activity.getEndOnReceivingResponse()) {
- endActivity(this.activity);
+ try{
+ endActivity(this.activity);
+ } finally {
+
((HttpClientActivityImpl)this.activity).setEnded(true);
+ }
}
}
=======================================
---
/resources/http-client/ratype/src/main/java/net/java/client/slee/resource/http/HttpClientActivity.java
Wed Aug 15 08:42:06 2012
+++
/resources/http-client/ratype/src/main/java/net/java/client/slee/resource/http/HttpClientActivity.java
Mon Jul 8 04:40:32 2013
@@ -54,6 +54,12 @@
* has to explicitly call endActivity() method to end the Activity.
*/
public void endActivity();
+
+ /**
+ * Flag indicating if this activity is already ended
+ * @return
+ */
+ public boolean isEnded();
/**
* @return Returns true if this Activity is set to end as soon as the
--
---
You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.