4 new revisions:

Revision: 8d8b12f21942
Author:   brainslog <brainslog@bf0df8d0-2c1f-0410-b170-bd30377b63dc>
Date:     Wed May 23 05:32:50 2012
Log: Fixing "Diameter Ro/Rf RAs: MmsInformationImpl::getRecipientAddresses(...
http://code.google.com/p/jain-slee/source/detail?r=8d8b12f21942

Revision: 2230a1c1d3d0
Author: [email protected] <[email protected]@bf0df8d0-2c1f-0410-b170-bd30377b63dc>
Date:     Thu May 24 01:15:59 2012
Log:      Fixes Issue 3209...
http://code.google.com/p/jain-slee/source/detail?r=2230a1c1d3d0

Revision: 3893a8a6a7e8
Author: [email protected] <[email protected]@bf0df8d0-2c1f-0410-b170-bd30377b63dc>
Date:     Thu May 24 01:18:53 2012
Log:      Fixes Issue 3206...
http://code.google.com/p/jain-slee/source/detail?r=3893a8a6a7e8

Revision: 9cb68a03d3b2
Author:   emmartins <emmartins@bf0df8d0-2c1f-0410-b170-bd30377b63dc>
Date:     Thu May 24 01:34:17 2012
Log:      Fixes Issue 3210...
http://code.google.com/p/jain-slee/source/detail?r=9cb68a03d3b2

==============================================================================
Revision: 8d8b12f21942
Author:   brainslog <brainslog@bf0df8d0-2c1f-0410-b170-bd30377b63dc>
Date:     Wed May 23 05:32:50 2012
Log: Fixing "Diameter Ro/Rf RAs: MmsInformationImpl::getRecipientAddresses() causes ClassCastException"

Fixes Issue 3198

git-svn-id: https://mobicents.googlecode.com/svn/trunk/servers/jain-slee@22515 bf0df8d0-2c1f-0410-b170-bd30377b63dc

http://code.google.com/p/jain-slee/source/detail?r=8d8b12f21942

Modified:
/resources/diameter-rf/events/src/main/java/org/mobicents/slee/resource/diameter/rf/events/avp/MmsInformationImpl.java /resources/diameter-ro/events/src/main/java/org/mobicents/slee/resource/diameter/ro/events/avp/MmsInformationImpl.java

=======================================
--- /resources/diameter-rf/events/src/main/java/org/mobicents/slee/resource/diameter/rf/events/avp/MmsInformationImpl.java Wed Apr 27 06:13:57 2011 +++ /resources/diameter-rf/events/src/main/java/org/mobicents/slee/resource/diameter/rf/events/avp/MmsInformationImpl.java Wed May 23 05:32:50 2012
@@ -166,7 +166,7 @@
* @see net.java.slee.resource.diameter.rf.events.avp.MmsInformation#getRecipientAddresses()
    */
   public RecipientAddress[] getRecipientAddresses() {
- return (RecipientAddress[]) getAvpAsCustom(DiameterRfAvpCodes.RECIPIENT_ADDRESS, DiameterRfAvpCodes.TGPP_VENDOR_ID, RecipientAddressImpl.class); + return (RecipientAddress[]) getAvpsAsCustom(DiameterRfAvpCodes.RECIPIENT_ADDRESS, DiameterRfAvpCodes.TGPP_VENDOR_ID, RecipientAddressImpl.class);
   }

   /* (non-Javadoc)
=======================================
--- /resources/diameter-ro/events/src/main/java/org/mobicents/slee/resource/diameter/ro/events/avp/MmsInformationImpl.java Wed Apr 27 06:13:57 2011 +++ /resources/diameter-ro/events/src/main/java/org/mobicents/slee/resource/diameter/ro/events/avp/MmsInformationImpl.java Wed May 23 05:32:50 2012
@@ -166,7 +166,7 @@
* @see net.java.slee.resource.diameter.ro.events.avp.MmsInformation#getRecipientAddresses()
    */
   public RecipientAddress[] getRecipientAddresses() {
- return (RecipientAddress[]) getAvpAsCustom(DiameterRoAvpCodes.RECIPIENT_ADDRESS, DiameterRoAvpCodes.TGPP_VENDOR_ID, RecipientAddressImpl.class); + return (RecipientAddress[]) getAvpsAsCustom(DiameterRoAvpCodes.RECIPIENT_ADDRESS, DiameterRoAvpCodes.TGPP_VENDOR_ID, RecipientAddressImpl.class);
   }

   /* (non-Javadoc)

==============================================================================
Revision: 2230a1c1d3d0
Author: [email protected] <[email protected]@bf0df8d0-2c1f-0410-b170-bd30377b63dc>
Date:     Thu May 24 01:15:59 2012
Log:      Fixes Issue 3209

git-svn-id: https://mobicents.googlecode.com/svn/trunk/servers/jain-slee@22530 bf0df8d0-2c1f-0410-b170-bd30377b63dc

http://code.google.com/p/jain-slee/source/detail?r=2230a1c1d3d0

Modified:
/core/common/src/main/java/org/mobicents/slee/container/management/jmx/AlarmMBeanImpl.java

=======================================
--- /core/common/src/main/java/org/mobicents/slee/container/management/jmx/AlarmMBeanImpl.java Tue Apr 19 07:36:27 2011 +++ /core/common/src/main/java/org/mobicents/slee/container/management/jmx/AlarmMBeanImpl.java Thu May 24 01:15:59 2012
@@ -36,9 +36,7 @@
  */
 package org.mobicents.slee.container.management.jmx;

-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
@@ -83,8 +81,8 @@
        public static String JNDI_NAME = "alarm";
        private static Logger log = Logger.getLogger(AlarmMBeanImpl.class);

- private Map<AlarmPlaceHolder, NotificationSource> placeHolderToNotificationSource = new HashMap<AlarmPlaceHolder, NotificationSource>(); - private Map<String, AlarmPlaceHolder> alarmIdToAlarm = new HashMap<String, AlarmPlaceHolder>(); + private Map<AlarmPlaceHolder, NotificationSource> placeHolderToNotificationSource = new ConcurrentHashMap<AlarmPlaceHolder, NotificationSource>(); + private Map<String, AlarmPlaceHolder> alarmIdToAlarm = new ConcurrentHashMap<String, AlarmPlaceHolder>();

        private final SleeTransactionManager sleeTransactionManager;
        private final TraceMBeanImpl traceMBean;
@@ -153,9 +151,7 @@
                int count = 0;
                try {

- Map<AlarmPlaceHolder, NotificationSource> copy = new HashMap<AlarmPlaceHolder, NotificationSource>();
-                       copy.putAll(this.placeHolderToNotificationSource);
- for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : copy.entrySet()) { + for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : placeHolderToNotificationSource.entrySet()) {
                                if (e.getValue().equals(notificationSource)) {
                                        if 
(clearAlarm(e.getKey().getAlarm().getAlarmID())) {
                                                count++;
@@ -188,10 +184,8 @@
                int count = 0;
                try {

- Map<AlarmPlaceHolder, NotificationSource> copy = new HashMap<AlarmPlaceHolder, NotificationSource>();
-                       copy.putAll(this.placeHolderToNotificationSource);
- for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : copy.entrySet()) { - if (e.getValue().equals(notificationSource) && e.getKey().getAlarmType().compareTo(alarmType) == 0) { + for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : placeHolderToNotificationSource.entrySet()) { + if (e.getValue().equals(notificationSource) && e.getKey().getAlarmType().equals(alarmType)) {
                                        if 
(clearAlarm(e.getKey().getAlarm().getAlarmID())) {
                                                count++;
                                        }
@@ -211,8 +205,8 @@
         */
        public String[] getAlarms() throws ManagementException {
                try {
-
-                       Set<String> ids = alarmIdToAlarm.keySet();
+                       Set<String> ids = new HashSet<String>();
+                       ids.addAll(alarmIdToAlarm.keySet());
                        return ids.toArray(new String[ids.size()]);
                } catch (Exception e) {
throw new ManagementException("Failed to get list of active alarms due to.", e);
@@ -231,15 +225,12 @@
                mandateSource(notificationSource);

                try {
-                       List<String> ids = new ArrayList<String>();
- Map<AlarmPlaceHolder, NotificationSource> copy = new HashMap<AlarmPlaceHolder, NotificationSource>();
-                       copy.putAll(this.placeHolderToNotificationSource);
- for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : copy.entrySet()) {
+                       Set<String> ids = new HashSet<String>();
+ for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : placeHolderToNotificationSource.entrySet()) {
                                if (e.getValue().equals(notificationSource)) {
                                        
ids.add(e.getKey().getAlarm().getAlarmID());
                                }
                        }
-
                        return ids.toArray(new String[ids.size()]);
                } catch (Exception e) {
throw new ManagementException("Failed to get alarm id list due to: ", e);
@@ -269,7 +260,7 @@
                        throw new NullPointerException("AlarmID[] must not be 
null");
                }

-               List<Alarm> alarms = new ArrayList<Alarm>();
+               Set<Alarm> alarms = new HashSet<Alarm>();

                try {
                        for (String id : alarmIDs) {

==============================================================================
Revision: 3893a8a6a7e8
Author: [email protected] <[email protected]@bf0df8d0-2c1f-0410-b170-bd30377b63dc>
Date:     Thu May 24 01:18:53 2012
Log:      Fixes Issue 3206

git-svn-id: https://mobicents.googlecode.com/svn/trunk/servers/jain-slee@22531 bf0df8d0-2c1f-0410-b170-bd30377b63dc

http://code.google.com/p/jain-slee/source/detail?r=3893a8a6a7e8

Modified:
/core/services/src/main/java/org/mobicents/slee/container/management/ServiceManagementImpl.java

=======================================
--- /core/services/src/main/java/org/mobicents/slee/container/management/ServiceManagementImpl.java Mon May 14 07:31:13 2012 +++ /core/services/src/main/java/org/mobicents/slee/container/management/ServiceManagementImpl.java Thu May 24 01:18:53 2012
@@ -407,7 +407,7 @@
                        // only end activity if slee was running and is single 
node in
                        // cluster, otherwise not needed (cluster) or
                        // slee already did it
-                       if (sleeContainer.getCluster().isSingleMember()) {
+ if (sleeContainer.getCluster().isSingleMember() && (sleeState == SleeState.RUNNING || sleeState == SleeState.STOPPING)) {
                                if (sleeState == SleeState.RUNNING) {
                                        endServiceActivity(serviceID);
                                }

==============================================================================
Revision: 9cb68a03d3b2
Author:   emmartins <emmartins@bf0df8d0-2c1f-0410-b170-bd30377b63dc>
Date:     Thu May 24 01:34:17 2012
Log:      Fixes Issue 3210

git-svn-id: https://mobicents.googlecode.com/svn/trunk/servers/jain-slee@22532 bf0df8d0-2c1f-0410-b170-bd30377b63dc

http://code.google.com/p/jain-slee/source/detail?r=9cb68a03d3b2

Added:
/core/events/src/main/java/org/mobicents/slee/container/event/ReferencesHandler.java
Deleted:
/core/spi/src/main/java/org/mobicents/slee/container/event/ReferencesHandler.java
Modified:
/core/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityContextFactoryImpl.java /core/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityContextImpl.java /core/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityEventQueueManagerImpl.java /core/events/src/main/java/org/mobicents/slee/container/event/ActivityEndEventContextImpl.java /core/events/src/main/java/org/mobicents/slee/container/event/DefaultEventContextFactoryDataSource.java /core/events/src/main/java/org/mobicents/slee/container/event/EventContextFactoryImpl.java /core/events/src/main/java/org/mobicents/slee/container/event/EventContextImpl.java /core/events/src/main/java/org/mobicents/slee/container/event/EventContextSuspensionHandler.java /core/router/src/main/java/org/mobicents/slee/runtime/eventrouter/routingtask/EventRoutingTaskImpl.java /core/services/src/main/java/org/mobicents/slee/runtime/sbb/SbbAbstractMethodHandler.java /core/spi/src/main/java/org/mobicents/slee/container/activity/ActivityContext.java /core/spi/src/main/java/org/mobicents/slee/container/event/EventContext.java /core/spi/src/main/java/org/mobicents/slee/container/event/EventContextFactory.java

=======================================
--- /dev/null
+++ /core/events/src/main/java/org/mobicents/slee/container/event/ReferencesHandler.java Thu May 24 01:34:17 2012
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+/**
+ *
+ */
+package org.mobicents.slee.container.event;
+
+import org.mobicents.slee.container.activity.ActivityContextHandle;
+
+/**
+ * @author martins
+ *
+ */
+public interface ReferencesHandler {
+
+       /**
+        *
+        * @param ach
+        */
+       public void add(ActivityContextHandle ach);
+
+       /**
+        *
+        * @param ach
+        */
+       public void remove(ActivityContextHandle ach);
+
+}
=======================================
--- /core/spi/src/main/java/org/mobicents/slee/container/event/ReferencesHandler.java Tue Apr 19 07:36:27 2011
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-/**
- *
- */
-package org.mobicents.slee.container.event;
-
-import org.mobicents.slee.container.activity.ActivityContextHandle;
-
-/**
- * @author martins
- *
- */
-public interface ReferencesHandler {
-
-       /**
-        *
-        * @param ach
-        */
-       public void add(ActivityContextHandle ach);
-
-       /**
-        *
-        * @param ach
-        */
-       public void remove(ActivityContextHandle ach);
-
-}
=======================================
--- /core/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityContextFactoryImpl.java Fri May 18 00:40:50 2012 +++ /core/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityContextFactoryImpl.java Thu May 24 01:34:17 2012
@@ -38,6 +38,8 @@
 import org.mobicents.slee.container.activity.ActivityContextHandle;
 import org.mobicents.slee.container.activity.ActivityType;
 import org.mobicents.slee.container.eventrouter.EventRouterExecutor;
+import org.mobicents.slee.container.transaction.TransactionContext;
+import org.mobicents.slee.container.transaction.TransactionalAction;

 /**
* Activity context factory -- return an activity context given an activity or
@@ -106,9 +108,34 @@
localActivityContext = localActivityContexts.putIfAbsent(ach,newLocalActivityContext);
                        if (localActivityContext == null) {
                                localActivityContext = newLocalActivityContext;
- EventRouterExecutor executor = sleeContainer.getEventRouter().getEventRouterExecutorMapper().getExecutor(ach); + final EventRouterExecutor executor = sleeContainer.getEventRouter().getEventRouterExecutorMapper().getExecutor(ach);
                                
localActivityContext.setExecutorService(executor);
                                executor.activityMapped(ach);
+ TransactionContext txContext = sleeContainer.getTransactionManager().getTransactionContext();
+                               if (txContext != null) {
+                                       TransactionalAction txAction = new 
TransactionalAction() {
+                                               @Override
+                                               public void execute() {
+                                                       try {
+                                                               Runnable r = 
new Runnable() {
+                                                                       
@Override
+                                                                       public 
void run() {
+                                                                               
if (getActivityContext(ach) == null) {
+                                                                               
        localActivityContexts.remove(ach);
+                                                                               
        executor.activityUnmapped(ach);
+                                                                               
}
+                                                                       }
+                                                               };
+                                                               
executor.execute(r);
+                                                       }
+                                                       catch (Throwable e) {
+                                                               logger.error("Failed 
to rollback removal of AC local resources",e);
+                                                       }
+
+                                               }
+                                       };
+                                       
txContext.getAfterRollbackActions().add(txAction);
+                               }
                        }
                }
                return localActivityContext;
@@ -162,7 +189,10 @@
                        catch (Throwable e) {
                                logger.error("Failed to load AC.",e);
                                // force cache data & local resources removal
-                               localActivityContexts.remove(ach);
+ final LocalActivityContextImpl localActivityContext = localActivityContexts.remove(ach);
+                               if (localActivityContext != null) {
+                                       
localActivityContext.getExecutorService().activityUnmapped(ach);
+                               }
                                activityContextCacheData.remove();
                                return null;
                        }
=======================================
--- /core/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityContextImpl.java Sun Apr 29 15:00:09 2012 +++ /core/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityContextImpl.java Thu May 24 01:34:17 2012
@@ -44,7 +44,6 @@
 import org.mobicents.slee.container.event.EventProcessingFailedCallback;
 import org.mobicents.slee.container.event.EventProcessingSucceedCallback;
 import org.mobicents.slee.container.event.EventUnreferencedCallback;
-import org.mobicents.slee.container.event.ReferencesHandler;
import org.mobicents.slee.container.facilities.ActivityContextNamingFacility;
 import org.mobicents.slee.container.facilities.TimerFacility;
import org.mobicents.slee.container.resource.ResourceAdaptorActivityContextHandle;
@@ -527,18 +526,9 @@
                                
sleeContainer.getTransactionManager().getTransactionContext());
        }

-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * org.mobicents.slee.container.activity.ActivityContext#fireEvent(javax
-        * .slee.EventTypeID, java.lang.Object, javax.slee.Address,
-        * javax.slee.ServiceID,
-        * org.mobicents.slee.container.event.ReferencesHandler)
-        */
        public void fireEvent(EventTypeID eventTypeId, Object event,
                        Address address, ServiceID serviceID,
-                       ReferencesHandler referencesHandler)
+                       EventContext reference)
                        throws ActivityIsEndingException, SLEEException {

                if (isEnding()) {
@@ -553,7 +543,7 @@
                fireEvent(
                                
sleeContainer.getEventContextFactory().createEventContext(
                                                eventTypeId, event, this, 
address, serviceID,
-                                               referencesHandler), 
sleeContainer
+                                               reference), sleeContainer
                                                
.getTransactionManager().getTransactionContext());
        }

=======================================
--- /core/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityEventQueueManagerImpl.java Tue Mar 20 12:43:59 2012 +++ /core/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityEventQueueManagerImpl.java Thu May 24 01:34:17 2012
@@ -92,9 +92,8 @@
                                        + event.getEventTypeId() + " in AC with 
handle "
                                        + event.getActivityContextHandle());
                }
-               // manage event references
-               event.getReferencesHandler().add(
-                               localAC.getActivityContextHandle());
+               // let the event know it was fired
+               event.fired();
                // add event to pending set
                Runnable r = new Runnable() {
                        @Override
@@ -124,9 +123,7 @@
                                                                + 
event.getActivityContextHandle()
                                                                + ", the activity 
end event is already committed");
                                        }
-                                       if(!event.isActivityEndEvent()) {
-                                               
event.eventProcessingFailed(FailureReason.OTHER_REASON);
-                                       }
+                                       
event.eventProcessingFailed(FailureReason.OTHER_REASON);
                                }
                        }
                };
@@ -135,8 +132,8 @@

        @Override
        public void fireNotTransacted(final EventContext event) {
-               // manage event references
-               
event.getReferencesHandler().add(localAC.getActivityContextHandle());
+               // let the event know it was fired
+               event.fired();
                // commit event
                Runnable r = new Runnable() {
                        @Override
@@ -154,9 +151,7 @@
                                                                + 
event.getActivityContextHandle()
                                                                + ", the activity 
end event is already committed");
                                        }
-                                       if(!event.isActivityEndEvent()) {
-                                               
event.eventProcessingFailed(FailureReason.OTHER_REASON);
-                                       }
+                                       
event.eventProcessingFailed(FailureReason.OTHER_REASON);
                                }
                        }
                };
@@ -228,6 +223,8 @@

        @Override
        public void rollback(final EventContext event) {
+               // let the event know it was canceled
+               event.canceled();
                Runnable r = new Runnable() {
                        @Override
                        public void run() {
=======================================
--- /core/events/src/main/java/org/mobicents/slee/container/event/ActivityEndEventContextImpl.java Tue Apr 19 07:36:27 2011 +++ /core/events/src/main/java/org/mobicents/slee/container/event/ActivityEndEventContextImpl.java Thu May 24 01:34:17 2012
@@ -22,6 +22,8 @@

 package org.mobicents.slee.container.event;

+import javax.slee.resource.FailureReason;
+
 /**
  * Useful activity end event version of the {@link EventContextImpl}.
  *
@@ -45,4 +47,16 @@
        public boolean isActivityEndEvent() {
                return true;
        }
-}
+
+       @Override
+       public void eventProcessingFailed(FailureReason reason) {
+ // TODO this should ensure AC is removed from SLEE, perhaps after some timeout (if ac exists but ending state persists)
+               super.eventProcessingFailed(reason);
+       }
+
+       @Override
+       public void canceled() {
+ // just remove event context, don't remove reference, otherwise unreferenced callback may end AC
+               remove();
+       }
+}
=======================================
--- /core/events/src/main/java/org/mobicents/slee/container/event/DefaultEventContextFactoryDataSource.java Mon May 14 07:25:49 2012 +++ /core/events/src/main/java/org/mobicents/slee/container/event/DefaultEventContextFactoryDataSource.java Thu May 24 01:34:17 2012
@@ -31,6 +31,7 @@
 import javax.slee.EventTypeID;
 import javax.slee.ServiceID;

+import org.apache.log4j.Logger;
 import org.mobicents.slee.container.activity.ActivityContext;

 /**
@@ -39,6 +40,8 @@
  */
public class DefaultEventContextFactoryDataSource implements EventContextFactoryDataSource {

+ private final static Logger logger = Logger.getLogger(DefaultEventContextFactoryDataSource.class);
+
private final ConcurrentHashMap<EventContextHandle, EventContext> dataSource = new ConcurrentHashMap<EventContextHandle, EventContext>();

        /* (non-Javadoc)
@@ -46,6 +49,9 @@
         */
        public void addEventContext(EventContextHandle handle,
                        EventContext eventContext) {
+               if(logger.isDebugEnabled()) {
+ logger.debug("Adding event context "+eventContext+" to datasource. Event context handle is "+handle);
+               }
                dataSource.put(handle, eventContext);
        }

@@ -73,6 +79,9 @@
* @see org.mobicents.slee.container.event.EventContextFactoryDataSource#removeEventContext(org.mobicents.slee.container.event.EventContextHandle)
         */
        public void removeEventContext(EventContextHandle handle) {
+               if(logger.isDebugEnabled()) {
+ logger.debug("Removing event context from datasource. Event context handle is "+handle);
+               }
                dataSource.remove(handle);
        }

=======================================
--- /core/events/src/main/java/org/mobicents/slee/container/event/EventContextFactoryImpl.java Fri Apr 20 09:19:36 2012 +++ /core/events/src/main/java/org/mobicents/slee/container/event/EventContextFactoryImpl.java Thu May 24 01:34:17 2012
@@ -103,22 +103,13 @@
                return eventContext;
        }

-       /*
-        * (non-Javadoc)
-        *
-        * @see
- * org.mobicents.slee.container.event.EventContextFactory#createEventContext
-        * (javax.slee.EventTypeID, java.lang.Object,
-        * org.mobicents.slee.container.activity.ActivityContext,
-        * javax.slee.Address, javax.slee.ServiceID,
-        * org.mobicents.slee.container.event.ReferencesHandler)
-        */
+       @Override
        public EventContext createEventContext(EventTypeID eventTypeId,
                        Object eventObject, ActivityContext ac, Address address,
-                       ServiceID serviceID, ReferencesHandler 
referencesHandler) {
+                       ServiceID serviceID, EventContext reference) {
                final EventContextData data = dataSource.newEventContextData(
                                eventTypeId, eventObject, ac, address, 
serviceID, null, null,
-                               null, referencesHandler);
+                               null, 
((EventContextImpl)reference).getReferencesHandler());
                return new EventContextImpl(data, this);
        }

=======================================
--- /core/events/src/main/java/org/mobicents/slee/container/event/EventContextImpl.java Fri Apr 20 09:19:36 2012 +++ /core/events/src/main/java/org/mobicents/slee/container/event/EventContextImpl.java Thu May 24 01:34:17 2012
@@ -174,7 +174,7 @@
                                // ignore
                        }
                }
-               eventUnreferenced();
+               canceled();
        }

        /* (non-Javadoc)
@@ -221,7 +221,6 @@
         *
         */
        protected void eventUnreferenced() {
-               super.remove();
                if (data.getUnreferencedCallback() != null) {
                        data.getUnreferencedCallback().eventUnreferenced();
                        data.unsetUnreferencedCallback();
@@ -231,7 +230,7 @@
        /* (non-Javadoc)
* @see org.mobicents.slee.container.event.EventContext#unreferencedCallbackRequiresTransaction()
         */
-       public boolean unreferencedCallbackRequiresTransaction() {
+       public boolean routedRequiresTransaction() {
final EventUnreferencedCallback unreferencedCallback = data.getUnreferencedCallback();
                if (unreferencedCallback == null) {
                        return false;
@@ -240,5 +239,27 @@
                        return unreferencedCallback.requiresTransaction();
                }
        }
+
+       @Override
+       public void fired() {
+               final ReferencesHandler handler = data.getReferencesHandler();
+               if (handler != null) {
+                       
handler.add(data.getLocalActivityContext().getActivityContextHandle());
+               }
+       }
+
+       @Override
+       public void canceled() {
+               routed();
+       }
+
+       @Override
+       public void routed() {
+               final ReferencesHandler handler = data.getReferencesHandler();
+               if (handler != null) {
+ handler.remove(data.getLocalActivityContext().getActivityContextHandle());
+               }
+               remove();
+       }

 }
=======================================
--- /core/events/src/main/java/org/mobicents/slee/container/event/EventContextSuspensionHandler.java Mon May 7 01:31:48 2012 +++ /core/events/src/main/java/org/mobicents/slee/container/event/EventContextSuspensionHandler.java Thu May 24 01:34:17 2012
@@ -187,6 +187,10 @@
                // create runnable to resume the event context
                Runnable runnable = new Runnable() {
                        public void run() {
+                               if (scheduledFuture == null) {
+                                       // already resumed
+                                       return;
+                               }
                                // cancel timer task
                                scheduledFuture.cancel(false);
                                scheduledFuture = null;
=======================================
--- /core/router/src/main/java/org/mobicents/slee/runtime/eventrouter/routingtask/EventRoutingTaskImpl.java Thu Sep 8 19:45:12 2011 +++ /core/router/src/main/java/org/mobicents/slee/runtime/eventrouter/routingtask/EventRoutingTaskImpl.java Thu May 24 01:34:17 2012
@@ -560,17 +560,17 @@
// if it has a unrefrenced callback which is tx aware try to take advantage of that // and do post processing in this tx, in the worst (and unexpected) scenario // the tx will rollback and we will do another spin, due to setting gotSbb as true
-                                                               if 
(eventContext.unreferencedCallbackRequiresTransaction()) {
+                                                               if 
(eventContext.routedRequiresTransaction()) {
                                                                        
finished = false;
                                                                        
routingPhase = RoutingPhase.DELIVERED;
- eventContext.getReferencesHandler().remove(eventContext.getActivityContextHandle());
+                                                                       
eventContext.routed();
                                                                }
                                                                break;
                                                        case DELIVERED:
-                                                               if 
(eventContext.unreferencedCallbackRequiresTransaction()) {
+                                                               if 
(eventContext.routedRequiresTransaction()) {
                                                                        // we 
had bad luck and last tx rollbacked, repeat action
                                                                        
finished = false;
- eventContext.getReferencesHandler().remove(eventContext.getActivityContextHandle());
+                                                                       
eventContext.routed();
                                                                }
                                                                break;
                                                        default:
@@ -681,10 +681,9 @@
                        // we got to the end of the event routing, remove from 
local ac
                        lac.setCurrentEventRoutingTask(null);

-                       // manage event references
-                       if 
(!eventContext.unreferencedCallbackRequiresTransaction()) {
- eventContext.getReferencesHandler().remove(eventContext.getActivityContextHandle());
-                       }
+                       if (!eventContext.routedRequiresTransaction()) {
+                               eventContext.routed();
+                       }

                } catch (Exception e) {
                        logger.error("Unhandled Exception in event router top 
try", e);
=======================================
--- /core/services/src/main/java/org/mobicents/slee/runtime/sbb/SbbAbstractMethodHandler.java Thu Jun 9 09:29:13 2011 +++ /core/services/src/main/java/org/mobicents/slee/runtime/sbb/SbbAbstractMethodHandler.java Thu May 24 01:34:17 2012
@@ -543,7 +543,7 @@
if (eventBeingDelivered != null && eventBeingDelivered.getEvent() == eventObject) { // there is an event being delivered by this tx and it matches the event being fired, lets copy the ref handler
                                // fire the event
- ac.fireEvent(eventTypeID, eventObject, (Address) address, serviceID, eventBeingDelivered.getReferencesHandler()); + ac.fireEvent(eventTypeID, eventObject, (Address) address, serviceID, eventBeingDelivered);
                                return;
                        }
                }
=======================================
--- /core/spi/src/main/java/org/mobicents/slee/container/activity/ActivityContext.java Fri Apr 27 05:03:04 2012 +++ /core/spi/src/main/java/org/mobicents/slee/container/activity/ActivityContext.java Thu May 24 01:34:17 2012
@@ -38,7 +38,6 @@
 import org.mobicents.slee.container.event.EventContext;
 import org.mobicents.slee.container.event.EventProcessingFailedCallback;
 import org.mobicents.slee.container.event.EventProcessingSucceedCallback;
-import org.mobicents.slee.container.event.ReferencesHandler;
 import org.mobicents.slee.container.event.EventUnreferencedCallback;
 import org.mobicents.slee.container.sbbentity.SbbEntityID;

@@ -130,13 +129,13 @@
         * @param event
         * @param address
         * @param serviceID
-        * @param referencesHandler
+        * @param reference
         * @throws ActivityIsEndingException
         * @throws SLEEException
         */
        public void fireEvent(EventTypeID eventTypeId, Object event,
                        Address address, ServiceID serviceID,
-                       ReferencesHandler referencesHandler)
+                       EventContext reference)
                        throws ActivityIsEndingException, SLEEException;

        /**
=======================================
--- /core/spi/src/main/java/org/mobicents/slee/container/event/EventContext.java Tue Apr 19 07:36:27 2011 +++ /core/spi/src/main/java/org/mobicents/slee/container/event/EventContext.java Thu May 24 01:34:17 2012
@@ -103,12 +103,6 @@
         */
        public LocalActivityContext getLocalActivityContext();

-       /**
-        *
-        * @return
-        */
-       public ReferencesHandler getReferencesHandler();
-
        /**
         *
         * @return
@@ -137,6 +131,12 @@
         *
         * @return
         */
-       public boolean unreferencedCallbackRequiresTransaction();
+       public boolean routedRequiresTransaction();
+
+       public void routed();
+
+       public void canceled();
+
+       public void fired();

 }
=======================================
--- /core/spi/src/main/java/org/mobicents/slee/container/event/EventContextFactory.java Tue Apr 19 07:36:27 2011 +++ /core/spi/src/main/java/org/mobicents/slee/container/event/EventContextFactory.java Thu May 24 01:34:17 2012
@@ -73,12 +73,12 @@
         * @param ac
         * @param address
         * @param serviceID
-        * @param referencesHandler
+        * @param reference
         * @return
         */
        public EventContext createEventContext(EventTypeID eventTypeId,
                        Object eventObject, ActivityContext ac, Address address,
-                       ServiceID serviceID,ReferencesHandler 
referencesHandler);
+                       ServiceID serviceID, EventContext reference);

        /**
         *

Reply via email to