Skip to content

Commit 1a2ff92

Browse files
author
jean.deruelle@gmail.com
committedOct 8, 2009
Fix For Issue 989 : Race condition in B2BUA when responses are delivered too fast (http://code.google.com/p/mobicents/issues/detail?id=989)
git-svn-id: https://mobicents.googlecode.com/svn/trunk/servers/sip-servlets@7886 bf0df8d0-2c1f-0410-b170-bd30377b63dc
1 parent b7cbf16 commit 1a2ff92

File tree

8 files changed

+11
-5
lines changed

8 files changed

+11
-5
lines changed
 

‎jopr-plugin-as-5/src/main/resources/META-INF/rhq-plugin.xml

+1
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@
771771
<c:simple-property name="concurrencyControlMode" defaultValue="SipSession">
772772
<c:property-options>
773773
<c:option value="None"/>
774+
<c:option value="Transaction"/>
774775
<c:option value="SipSession" default="true"/>
775776
<c:option value="SipApplicationSession"/>
776777
</c:property-options>

‎sip-servlets-annotations/src/main/java/org/mobicents/servlet/sip/annotation/ConcurrencyControlMode.java

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*
2323
*/
2424
public enum ConcurrencyControlMode {
25+
Transaction,
2526
SipSession,
2627
SipApplicationSession,
2728
None

‎sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/InitialRequestDispatcher.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import org.mobicents.servlet.sip.address.RFC2396UrlDecoder;
5757
import org.mobicents.servlet.sip.address.SipURIImpl;
5858
import org.mobicents.servlet.sip.address.TelURLImpl;
59+
import org.mobicents.servlet.sip.annotation.ConcurrencyControlMode;
5960
import org.mobicents.servlet.sip.core.SipSessionRoutingType;
6061
import org.mobicents.servlet.sip.core.session.MobicentsSipApplicationSession;
6162
import org.mobicents.servlet.sip.core.session.MobicentsSipSession;
@@ -392,7 +393,7 @@ private void dispatchInsideContainer(final SipProvider sipProvider, final SipApp
392393

393394
final InitialDispatchTask dispatchTask = new InitialDispatchTask(sipServletRequest, sipProvider);
394395
// if the flag is set we bypass the executor
395-
if(sipApplicationDispatcher.isBypassRequestExecutor()) {
396+
if(sipApplicationDispatcher.isBypassRequestExecutor() || ConcurrencyControlMode.Transaction.equals((sipContext.getConcurrencyControlMode()))) {
396397
dispatchTask.dispatchAndHandleExceptions();
397398
} else {
398399
getConcurrencyModelExecutorService(sipContext, sipServletRequest).execute(dispatchTask);

‎sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/ResponseDispatcher.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
import org.apache.log4j.Logger;
3737
import org.mobicents.servlet.sip.JainSipUtils;
38+
import org.mobicents.servlet.sip.annotation.ConcurrencyControlMode;
3839
import org.mobicents.servlet.sip.core.session.MobicentsSipSession;
3940
import org.mobicents.servlet.sip.core.session.SessionManagerUtil;
4041
import org.mobicents.servlet.sip.core.session.SipManager;
@@ -276,7 +277,7 @@ public void dispatch() throws DispatcherException {
276277
}
277278
};
278279
// if the flag is set we bypass the executor
279-
if(sipApplicationDispatcher.isBypassResponseExecutor()) {
280+
if(sipApplicationDispatcher.isBypassResponseExecutor() || ConcurrencyControlMode.Transaction.equals((sipContext.getConcurrencyControlMode()))) {
280281
dispatchTask.dispatchAndHandleExceptions();
281282
} else {
282283
getConcurrencyModelExecutorService(sipContext, sipServletMessage).execute(dispatchTask);

‎sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/SubsequentRequestDispatcher.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import org.apache.log4j.Logger;
4040
import org.mobicents.servlet.sip.JainSipUtils;
41+
import org.mobicents.servlet.sip.annotation.ConcurrencyControlMode;
4142
import org.mobicents.servlet.sip.core.ApplicationRoutingHeaderComposer;
4243
import org.mobicents.servlet.sip.core.session.MobicentsSipApplicationSession;
4344
import org.mobicents.servlet.sip.core.session.MobicentsSipSession;
@@ -257,7 +258,7 @@ public void dispatchMessage(final SipProvider sipProvider, SipServletMessageImpl
257258

258259
final SubsequentDispatchTask dispatchTask = new SubsequentDispatchTask(sipServletRequest, sipProvider);
259260
// if the flag is set we bypass the executor
260-
if(sipApplicationDispatcher.isBypassRequestExecutor()) {
261+
if(sipApplicationDispatcher.isBypassRequestExecutor() || ConcurrencyControlMode.Transaction.equals((sipContext.getConcurrencyControlMode()))) {
261262
dispatchTask.dispatchAndHandleExceptions();
262263
} else {
263264
getConcurrencyModelExecutorService(sipContext, sipServletMessage).execute(dispatchTask);

‎sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ protected Map<String,Object> getAttributeMap() {
175175

176176
protected SipApplicationSessionImpl(SipApplicationSessionKey key, SipContext sipContext) {
177177
sipSessions = new ConcurrentHashMap<String,SipSessionKey>();
178-
if(sipContext != null && !ConcurrencyControlMode.None.equals(sipContext.getConcurrencyControlMode())) {
178+
if(sipContext != null && ConcurrencyControlMode.SipApplicationSession.equals(sipContext.getConcurrencyControlMode())) {
179179
semaphore = new Semaphore(1);
180180
}
181181
this.key = key;

‎sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ protected SipSessionImpl (SipSessionKey key, SipFactoryImpl sipFactoryImpl, Mobi
252252
this.state = State.INITIAL;
253253
this.isValid = true;
254254
this.ongoingTransactions = new CopyOnWriteArraySet<Transaction>();
255-
if(mobicentsSipApplicationSession.getSipContext() != null && !ConcurrencyControlMode.None.equals(mobicentsSipApplicationSession.getSipContext().getConcurrencyControlMode())) {
255+
if(mobicentsSipApplicationSession.getSipContext() != null && ConcurrencyControlMode.SipSession.equals(mobicentsSipApplicationSession.getSipContext().getConcurrencyControlMode())) {
256256
semaphore = new Semaphore(1);
257257
}
258258
// the sip context can be null if the AR returned an application that was not deployed

‎sip-servlets-management/src/main/java/org/mobicents/servlet/management/client/configuration/ConfiguationPage.java

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
public class ConfiguationPage extends Panel {
2121
private static Object[][] concurrencyControlModes = new Object[][]{
2222
new Object[]{"None"},
23+
new Object[]{"Transaction"},
2324
new Object[]{"SipSession"},
2425
new Object[]{"SipApplicationSession"}
2526
};

0 commit comments

Comments
 (0)