Revision: 86ede7a3a8b6
Author: Jean Deruelle <[email protected]>
Date: Fri Feb 1 07:32:32 2013
Log: Update Issue 55
More Javadoc
http://code.google.com/p/jain-sip/source/detail?r=86ede7a3a8b6&repo=ext
Modified:
/src/main/java/org/mobicents/ext/javax/sip/congestion/CongestionControlMessageValve.java
/src/main/java/org/mobicents/ext/javax/sip/congestion/CongestionControlTimerTask.java
=======================================
---
/src/main/java/org/mobicents/ext/javax/sip/congestion/CongestionControlMessageValve.java
Fri Feb 1 06:03:52 2013
+++
/src/main/java/org/mobicents/ext/javax/sip/congestion/CongestionControlMessageValve.java
Fri Feb 1 07:32:32 2013
@@ -21,17 +21,21 @@
import org.mobicents.ext.javax.sip.SipStackExtension;
/**
- * This is just a simple reusable congestion control valve JSIP apps can
use to stop traffic when the number of
- * server transactions reaches the limit specified in
gov.nist.javax.sip.MAX_SERVER_TRANSACTIONS without breaking
- * existing dialogs.
+ * This is a congestion control valve that JSIP apps can use to stop
traffic without breaking
+ * existing dialogs when the number of
+ * server transactions or dialogs or the memory or CPU reaches a given
limit. <br>
+ * See {@link CongestionControlTimerTask} for the list of properties
*
- * The drop policy is specified in DROP_RESPONSE_STATUS where "0" means
silent drop and any positive number will be
+ * The drop policy is specified in
org.mobicents.ext.javax.sip.congestion.DROP_RESPONSE_STATUS
+ * where "0" or negative value means silent drop and any positive number
will be
* interpreted as the status code of the error response that will be
generated.
*
* To enable this in your application you must specify this property:
- *
gov.nist.javax.sip.SIP_MESSAGE_VALVE=gov.nist.javax.sip.stack.CongestionControlMessageValve
+ *
gov.nist.javax.sip.SIP_MESSAGE_VALVE=org.mobicents.ext.javax.sip.congestion.CongestionControlMessageValve
*
- * It is advised to extend this class to add your application-specific
control conditions
+ * It is advised to extend this class to add your application-specific
control conditions or
+ * if you need to add any header to the response generated back (like
Retry-After Header)
+ * by overriding the modifyCongestionResponse(SIPResponse response).
*
* @author vladimirralev
* @author [email protected]
@@ -68,6 +72,7 @@
}
if(dropResponseStatus > 0) {
SIPResponse response =
request.createResponse(dropResponseStatus);
+ modifyCongestionResponse(response);
try {
messageChannel.sendMessage(response);
} catch (IOException e) {
@@ -79,6 +84,11 @@
}
return true; // OK, the processing of the request can continue
}
+
+ protected void modifyCongestionResponse(SIPResponse response) {
+ //Default does nothing
+
+ }
public boolean processResponse(Response response,
MessageChannel messageChannel) {
=======================================
---
/src/main/java/org/mobicents/ext/javax/sip/congestion/CongestionControlTimerTask.java
Fri Feb 1 06:03:52 2013
+++
/src/main/java/org/mobicents/ext/javax/sip/congestion/CongestionControlTimerTask.java
Fri Feb 1 07:32:32 2013
@@ -30,6 +30,21 @@
import org.mobicents.ext.javax.sip.SipStackExtension;
/**
+ * Task responsible for monitoring at regular intervals whether or not the
configured congestion control mechanisms have switched on or off.
+ * The following congestion control mechanisms are available :
+ * <ul>
+ * <li>Memory : Monitor if the JVM Used Memory has crossed the
org.mobicents.ext.javax.sip.congestion.MEMORY_THRESHOLD threshold
+ * or went back under
org.mobicents.ext.javax.sip.congestion.BACK_TO_NORMAL_MEMORY_THRESHOLD
threshold</li>
+ * <li>CPU : Monitor if the Process Used CPU has crossed the
org.mobicents.ext.javax.sip.congestion.CPU_THRESHOLD threshold
+ * or went back under
org.mobicents.ext.javax.sip.congestion.BACK_TO_NORMAL_CPU_THRESHOLD
threshold</li>
+ * <li>Server Transactions: Monitor if the number of active Server
Transactions has crossed the
org.mobicents.ext.javax.sip.congestion.SERVER_TRANSACTIONS_THRESHOLD
threshold
+ * or went back under
org.mobicents.ext.javax.sip.congestion.BACK_TO_NORMAL_SERVER_TRANSACTIONS_THRESHOLD
threshold</li>
+ * <li>Server Transactions: Monitor if the number of active Dialogs has
crossed the org.mobicents.ext.javax.sip.congestion.DIALOS_THRESHOLD
threshold
+ * or went back under
org.mobicents.ext.javax.sip.congestion.BACK_TO_NORMAL_DIALOGS_THRESHOLD
threshold</li>
+ * </ul>
+ *
+ * <i>Note: Any congestion control mechanism can be disabled by setting
their threshold properties to a negative value</i>
+ *
* @author [email protected]
*
*/
--
---
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.