Revision: 16195
Author: emmartins
Date: Thu Jan 6 02:14:35 2011
Log: small fixes and optimizations for local mode or no early dialog
failover
http://code.google.com/p/mobicents/source/detail?r=16195
Modified:
/trunk/servers/jain-sip-ha/core/src/main/java/org/mobicents/ha/javax/sip/ClusteredSipStackImpl.java
/trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/DialogDataRemovalListener.java
/trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/MobicentsSipCache.java
=======================================
---
/trunk/servers/jain-sip-ha/core/src/main/java/org/mobicents/ha/javax/sip/ClusteredSipStackImpl.java
Wed Dec 8 12:32:49 2010
+++
/trunk/servers/jain-sip-ha/core/src/main/java/org/mobicents/ha/javax/sip/ClusteredSipStackImpl.java
Thu Jan 6 02:14:35 2011
@@ -437,9 +437,12 @@
*/
@Override
public SIPTransaction findTransaction(String transactionId, boolean
isServer) {
+ if(sipCache.inLocalMode() || replicationStrategy !=
ReplicationStrategy.EarlyDialog) {
+ return super.findTransaction(transactionId,isServer);
+ }
final String txId = transactionId.toLowerCase();
SIPTransaction sipTransaction = super.findTransaction(txId,
isServer);
- if(sipTransaction == null && transactionFactory != null &&
replicationStrategy == ReplicationStrategy.EarlyDialog) {
+ if(sipTransaction == null && transactionFactory != null) {
if(getStackLogger().isLoggingEnabled(StackLogger.TRACE_DEBUG)) {
getStackLogger().logDebug("local transaction " + txId + " server = " +
isServer + " is null, checking in the distributed cache");
}
@@ -498,6 +501,9 @@
@Override
public void removeTransaction(SIPTransaction sipTransaction) {
super.removeTransaction(sipTransaction);
+ if(sipCache.inLocalMode()) {
+ return;
+ }
if(transactionFactory != null && sipTransaction != null &&
replicationStrategy == ReplicationStrategy.EarlyDialog &&
sipTransaction.getMethod().equalsIgnoreCase(Request.INVITE)) {
if(sipTransaction instanceof ServerTransaction) {
// remove the corresponding server transaction
from the cache instance
@@ -520,6 +526,9 @@
@Override
protected void removeTransactionHash(SIPTransaction sipTransaction) {
super.removeTransactionHash(sipTransaction);
+ if(sipCache.inLocalMode()) {
+ return;
+ }
if(transactionFactory != null && sipTransaction != null &&
replicationStrategy == ReplicationStrategy.EarlyDialog &&
sipTransaction.getMethod().equalsIgnoreCase(Request.INVITE)) {
if(sipTransaction instanceof ServerTransaction) {
// remove the corresponding server transaction
from the cache instance
@@ -582,8 +591,7 @@
@Override
public SIPClientTransaction createClientTransaction(SIPRequest
sipRequest,
MessageChannel encapsulatedMessageChannel) {
-
- if(transactionFactory == null) {
+ if(sipCache.inLocalMode() || transactionFactory == null) {
return super.createClientTransaction(sipRequest,
encapsulatedMessageChannel);
}
return transactionFactory.createClientTransaction(sipRequest,
encapsulatedMessageChannel);
@@ -591,7 +599,7 @@
@Override
public SIPServerTransaction createServerTransaction(MessageChannel
encapsulatedMessageChannel) {
- if(transactionFactory == null) {
+ if(sipCache.inLocalMode() || transactionFactory == null) {
return
super.createServerTransaction(encapsulatedMessageChannel);
}
return
transactionFactory.createServerTransaction(encapsulatedMessageChannel);
=======================================
---
/trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/DialogDataRemovalListener.java
Wed Dec 1 10:25:06 2010
+++
/trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/DialogDataRemovalListener.java
Thu Jan 6 02:14:35 2011
@@ -41,7 +41,7 @@
*/
@SuppressWarnings("unchecked")
public void dataRemoved(Fqn fqn) {
- clusteredSipStack.remoteServerTransactionRemoval((String)
fqn.getLastElement());
+ clusteredSipStack.remoteDialogRemoval((String)
fqn.getLastElement());
}
/*
=======================================
---
/trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/MobicentsSipCache.java
Mon Dec 6 10:09:13 2010
+++
/trunk/servers/jain-sip-ha/jboss-5/src/main/java/org/mobicents/ha/javax/sip/cache/MobicentsSipCache.java
Thu Jan 6 02:14:35 2011
@@ -187,6 +187,8 @@
if(clusteredSipStack.getReplicationStrategy() ==
ReplicationStrategy.EarlyDialog) {
serverTransactionCacheData.remove();
cluster.removeDataRemovalListener(serverTransactionDataRemovalListener);
+ clientTransactionCacheData.remove();
+
cluster.removeDataRemovalListener(clientTransactionDataRemovalListener);
}
}