Revision: 7296
Author: emmartins
Date: Mon Aug 3 18:55:36 2009
Log: somes fixes and optimizations uncovered on sip services migration and
testing
http://code.google.com/p/mobicents/source/detail?r=7296
Deleted:
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/jboss
Modified:
/trunk/servers/jain-slee/core/components/descriptors/src/main/java/org/mobicents/slee/container/component/SleeComponent.java
/trunk/servers/jain-slee/core/components/descriptors/src/main/java/org/mobicents/slee/container/component/deployment/DeployableUnitBuilder.java
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/container/service/Service.java
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/activity/ActivityContext.java
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/eventrouter/EventContextImpl.java
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/eventrouter/routingtask/EventRoutingTransactionData.java
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/eventrouter/routingtask/HandleRollback.java
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/facilities/TimerFacilityImpl.java
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/facilities/nullactivity/NullActivityContextInterfaceFactoryImpl.java
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/facilities/nullactivity/NullActivityFactoryImpl.java
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/sbbentity/SbbEntity.java
/trunk/servers/jain-slee/core/pom.xml
=======================================
---
/trunk/servers/jain-slee/core/components/descriptors/src/main/java/org/mobicents/slee/container/component/SleeComponent.java
Mon Jul 20 05:42:47 2009
+++
/trunk/servers/jain-slee/core/components/descriptors/src/main/java/org/mobicents/slee/container/component/SleeComponent.java
Mon Aug 3 18:55:36 2009
@@ -79,15 +79,7 @@
* @param classLoader
*/
public void setClassLoader(ComponentClassLoader classLoader) {
- this.classLoader = classLoader;
- if (classPool != null) {
- classPool.clean();
- }
- classPool = new ClassPool();
- // add class path for domain and dependencies
- addDomainLoadersToJavassistPool(new
HashSet<URLClassLoaderDomain>(),classLoaderDomain);
- // add class path also for slee
- classPool.appendClassPath(new
LoaderClassPath(classLoaderDomain.getSleeClassLoader()));
+ this.classLoader = classLoader;
}
private void addDomainLoadersToJavassistPool(Set<URLClassLoaderDomain>
visitedDomains, URLClassLoaderDomain domain) {
@@ -119,15 +111,6 @@
public void setClassLoaderDomain(URLClassLoaderDomain
classLoaderDomain) {
this.classLoaderDomain = classLoaderDomain;
}
-
- /**
- * Sets the component javassist class pool
- *
- * @param classPool
- */
- public void setClassPool(ClassPool classPool) {
- this.classPool = classPool;
- }
/**
* Retrieves the component javassist class pool
@@ -135,6 +118,16 @@
* @return
*/
public ClassPool getClassPool() {
+ if (classPool == null) {
+ if (classLoader == null) {
+ throw new IllegalStateException("can't init javassit classpool, there
is no class loader set for the component");
+ }
+ classPool = new ClassPool();
+ // add class path for domain and dependencies
+ addDomainLoadersToJavassistPool(new
HashSet<URLClassLoaderDomain>(),classLoaderDomain);
+ // add class path also for slee
+ classPool.appendClassPath(new
LoaderClassPath(classLoaderDomain.getSleeClassLoader()));
+ }
return classPool;
}
=======================================
---
/trunk/servers/jain-slee/core/components/descriptors/src/main/java/org/mobicents/slee/container/component/deployment/DeployableUnitBuilder.java
Tue Jun 2 05:29:56 2009
+++
/trunk/servers/jain-slee/core/components/descriptors/src/main/java/org/mobicents/slee/container/component/deployment/DeployableUnitBuilder.java
Mon Aug 3 18:55:36 2009
@@ -181,16 +181,20 @@
Set<SleeComponent> duComponentsSet = deployableUnit
.getDeployableUnitComponents();
- // now that all components are built we need to , if
that's the case
+ // now that all components are built we need to
for (SleeComponent sleeComponent : duComponentsSet) {
// check if all
// dependencies are available
checkDependencies(sleeComponent,
deployableUnit);
// build its class loader
createClassLoader(sleeComponent);
- // load the provided classes for the component
+ }
+
+ // load the provided classes for the component
+ for (SleeComponent sleeComponent : duComponentsSet) {
loadAndSetNonGeneratedComponentClasses(sleeComponent);
}
+
//boolean secEnabled =
SleeContainer.isSecurityEnabled();
// validate each component
for (SleeComponent sleeComponent : duComponentsSet) {
=======================================
---
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/container/service/Service.java
Mon Aug 3 03:32:20 2009
+++
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/container/service/Service.java
Mon Aug 3 18:55:36 2009
@@ -212,15 +212,11 @@
*
* @param convergenceName
*/
- public SbbEntity addChild(String convergenceName) throws
CreateException {
+ public SbbEntity addChild(String convergenceName) {
if (logger.isDebugEnabled()) {
- if (logger.isDebugEnabled()) {
- logger.debug(getServiceID().toString() + " adding convergence
name "+convergenceName);
- }
- }
-
- sleeContainer.getTransactionManager().mandateTransaction();
+ logger.debug(getServiceID().toString() + " adding convergence
name "+convergenceName);
+ }
// create root sbb entity
SbbEntity sbbEntity =
SbbEntityFactory.createRootSbbEntity(getRootSbbID(),
=======================================
---
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/activity/ActivityContext.java
Mon Aug 3 03:32:20 2009
+++
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/activity/ActivityContext.java
Mon Aug 3 18:55:36 2009
@@ -32,7 +32,6 @@
import org.mobicents.slee.runtime.eventrouter.RollbackDeferredEventAction;
import
org.mobicents.slee.runtime.facilities.ActivityContextNamingFacilityImpl;
import org.mobicents.slee.runtime.facilities.TimerFacilityImpl;
-import
org.mobicents.slee.runtime.facilities.nullactivity.NullActivityHandle;
import org.mobicents.slee.runtime.sbbentity.RootSbbEntitiesRemovalTask;
import org.mobicents.slee.runtime.sbbentity.SbbEntityComparator;
import org.mobicents.slee.runtime.transaction.SleeTransactionManager;
@@ -321,15 +320,9 @@
* sbb entity to attach.
* @return true if the SBB Entity is attached successfully, otherwise
when
* the SBB Entitiy has already been attached before, return
false
- * @throws javax.slee.TransactionRequiredLocalException
- * @throws javax.slee.TransactionRolledbackLocalException
- * @throws javax.slee.SLEEException
*/
- public boolean attachSbbEntity(String sbbEntityId)
- throws javax.slee.TransactionRequiredLocalException {
-
- sleeContainer.getTransactionManager().mandateTransaction();
+ public boolean attachSbbEntity(String sbbEntityId) {
boolean attached = cacheData.attachSbbEntity(sbbEntityId);
if (attached) {
@@ -540,8 +533,7 @@
break;
case NULL:
- // null activity, warn the factory
-
sleeContainer.getNullActivityFactory().activityEnded((NullActivityHandle)activityContextHandle.getActivityHandle());
+ // do nothing
break;
case PTABLE:
=======================================
---
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/eventrouter/EventContextImpl.java
Mon Aug 3 03:32:20 2009
+++
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/eventrouter/EventContextImpl.java
Mon Aug 3 18:55:36 2009
@@ -3,8 +3,8 @@
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
import javax.slee.ActivityContextInterface;
import javax.slee.Address;
@@ -36,11 +36,6 @@
*/
private static final int DEFAULT_TIMEOUT = 10000;
- /**
- * the timer used to control timeouts for event context suspension
- */
- private static final Timer timer = new Timer();
-
/**
* the container
*/
@@ -78,9 +73,9 @@
private final Set<String> sbbEntitiesThatHandledEvent = new
HashSet<String>();
/**
- * the timer task controlling the suspension timeout
+ * the scheduled future for the task controlling the suspension timeout
*/
- private SuspensionTimerTask timerTask;
+ private ScheduledFuture<?> scheduledFuture;
/**
* transactional action action to change state
@@ -221,8 +216,8 @@
Runnable runnable = new Runnable() {
public void run() {
// cancel timer task
- timerTask.cancel();
- timerTask = null;
+ scheduledFuture.cancel(false);
+ scheduledFuture = null;
// send events frozen to event router again, will be processed only
after this one ends
for (DeferredEvent deferredEvent :
barriedEvents) {
eventRouter.routeEvent(deferredEvent);
@@ -256,8 +251,7 @@
return eventContextID;
}
- private class SuspensionTimerTask extends TimerTask {
- @Override
+ private class SuspensionTimerTask implements Runnable {
public void run() {
try {
resume();
@@ -294,10 +288,8 @@
barriedEvents = new LinkedList<DeferredEvent>();
// set state as suspended
suspended = true;
- // schedule timer task
- timerTask = new SuspensionTimerTask();
- // schedule task in timer
- timer.schedule(timerTask,timeout);
+ // schedule task directly in timer facility scheduler's executor, no
need to be fault tolerant
+ scheduledFuture =
sleeContainer.getTimerFacility().getScheduler().getExecutor().schedule(new
SuspensionTimerTask(),timeout,TimeUnit.MILLISECONDS);
break;
case resume:
resume();
=======================================
---
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/eventrouter/routingtask/EventRoutingTransactionData.java
Fri Mar 20 08:59:29 2009
+++
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/eventrouter/routingtask/EventRoutingTransactionData.java
Mon Aug 3 18:55:36 2009
@@ -9,7 +9,6 @@
import org.mobicents.slee.container.SleeContainer;
import org.mobicents.slee.runtime.eventrouter.DeferredEvent;
-import org.mobicents.slee.runtime.transaction.SleeTransactionManager;
/**
* The context of event routing stored in the transaction
@@ -79,10 +78,8 @@
* Puts the data into tx context
*/
public void putInTransactionContext() throws
TransactionRequiredLocalException {
- final SleeTransactionManager txManager =
sleeContainer.getTransactionManager();
- txManager.mandateTransaction();
try {
-
txManager.getTransactionContext().getData().put(TRANSACTION_CONTEXT_KEY,this);
+
sleeContainer.getTransactionManager().getTransactionContext().getData().put(TRANSACTION_CONTEXT_KEY,this);
} catch (SystemException e) {
throw new SLEEException(e.getMessage(),e);
}
@@ -93,20 +90,16 @@
* @return null if there is no event routing tx data for the active tx
*/
public static EventRoutingTransactionData getFromTransactionContext()
throws TransactionRequiredLocalException {
- final SleeTransactionManager txManager =
sleeContainer.getTransactionManager();
- txManager.mandateTransaction();
try {
- return (EventRoutingTransactionData)
txManager.getTransactionContext().getData().get(TRANSACTION_CONTEXT_KEY);
+ return (EventRoutingTransactionData)
sleeContainer.getTransactionManager().getTransactionContext().getData().get(TRANSACTION_CONTEXT_KEY);
} catch (SystemException e) {
throw new SLEEException(e.getMessage(),e);
}
}
public void removeFromTransactionContext() {
- final SleeTransactionManager txManager =
sleeContainer.getTransactionManager();
- txManager.mandateTransaction();
try {
-
txManager.getTransactionContext().getData().remove(TRANSACTION_CONTEXT_KEY);
+
sleeContainer.getTransactionManager().getTransactionContext().getData().remove(TRANSACTION_CONTEXT_KEY);
} catch (SystemException e) {
throw new SLEEException(e.getMessage(),e);
}
=======================================
---
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/eventrouter/routingtask/HandleRollback.java
Fri Mar 20 08:59:29 2009
+++
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/eventrouter/routingtask/HandleRollback.java
Mon Aug 3 18:55:36 2009
@@ -1,6 +1,5 @@
package org.mobicents.slee.runtime.eventrouter.routingtask;
-import javax.slee.ActivityContextInterface;
import javax.slee.TransactionRequiredLocalException;
import javax.transaction.SystemException;
@@ -37,8 +36,6 @@
public boolean handleRollback(SbbObject sbbObject,
Exception e, ClassLoader contextClassLoader,SleeTransactionManager
txMgr) throws TransactionRequiredLocalException, SystemException {
- txMgr.mandateTransaction();
-
boolean invokeSbbRolledBack = false;
if (e != null && e instanceof RuntimeException) {
=======================================
---
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/facilities/TimerFacilityImpl.java
Mon Aug 3 03:32:20 2009
+++
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/facilities/TimerFacilityImpl.java
Mon Aug 3 18:55:36 2009
@@ -54,6 +54,14 @@
scheduler = new
FaultTolerantScheduler(16,sleeContainer.getCache().getTimerFacilityCacheData(),
sleeContainer.getTransactionManager(),new TimerFacilityTimerTaskFactory());
}
+ /**
+ * Retrieves
+ * @return the scheduler
+ */
+ public FaultTolerantScheduler getScheduler() {
+ return scheduler;
+ }
+
/*
* One shot timer
*
=======================================
---
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/facilities/nullactivity/NullActivityContextInterfaceFactoryImpl.java
Mon Aug 3 03:32:20 2009
+++
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/facilities/nullactivity/NullActivityContextInterfaceFactoryImpl.java
Mon Aug 3 18:55:36 2009
@@ -30,7 +30,6 @@
import javax.slee.nullactivity.NullActivity;
import javax.slee.nullactivity.NullActivityContextInterfaceFactory;
-import org.jboss.logging.Logger;
import org.mobicents.slee.container.SleeContainer;
import org.mobicents.slee.runtime.activity.ActivityContext;
import org.mobicents.slee.runtime.activity.ActivityContextHandle;
@@ -46,9 +45,7 @@
NullActivityContextInterfaceFactory {
private SleeContainer sleeContainer ;
-
- private static Logger logger =
Logger.getLogger(NullActivityContextInterfaceFactoryImpl.class);
-
+
public NullActivityContextInterfaceFactoryImpl(SleeContainer
svcContainer) {
this.sleeContainer = svcContainer;
}
@@ -66,8 +63,8 @@
if (nullActivity == null )
throw new NullPointerException ("null NullActivity ! huh!!");
+
if ( sleeContainer.getSleeState() == SleeState.STOPPING) {
- logger.debug("Trying to create null activity in stopping
state!");
return null;
}
=======================================
---
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/facilities/nullactivity/NullActivityFactoryImpl.java
Tue Jun 9 11:56:55 2009
+++
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/facilities/nullactivity/NullActivityFactoryImpl.java
Mon Aug 3 18:55:36 2009
@@ -16,16 +16,10 @@
import javax.slee.nullactivity.NullActivityFactory;
import javax.slee.resource.ActivityAlreadyExistsException;
import javax.slee.resource.ActivityFlags;
-import javax.transaction.SystemException;
import org.apache.log4j.Logger;
import org.mobicents.slee.container.SleeContainer;
-import org.mobicents.slee.runtime.activity.ActivityContext;
-import org.mobicents.slee.runtime.activity.ActivityContextFactoryImpl;
-import org.mobicents.slee.runtime.activity.ActivityContextHandle;
import org.mobicents.slee.runtime.activity.ActivityContextHandlerFactory;
-import org.mobicents.slee.runtime.activity.ActivityContextState;
-import org.mobicents.slee.runtime.cache.NullActivityFactoryCacheData;
/**
* Implementation of the null activity factory.
@@ -40,14 +34,10 @@
private SleeContainer sleeContainer;
private static Logger logger =
Logger.getLogger(NullActivityFactoryImpl.class);
-
- private final NullActivityFactoryCacheData cacheData;
public NullActivityFactoryImpl(SleeContainer serviceContainer)
throws Exception {
this.sleeContainer = serviceContainer;
- cacheData =
sleeContainer.getCache().getNullActivityFactoryCacheData();
- cacheData.create();
}
/*
@@ -101,50 +91,11 @@
if (logger.isDebugEnabled()) {
logger
- .debug("NullActivityFactory.createNullActivity() Creating null
activity "
+ .debug("NullActivityFactory.createNullActivity() Created null
activity "
+ nullActivity);
}
-
- // put in cache
- cacheData.addNullActivityId(nullActivityHandle.getId());
return nullActivity;
-
- }
-
- public void activityEnded(NullActivityHandle nullActivityHandle) {
- try {
- // remove from cache
-
cacheData.removeNullActivityId(nullActivityHandle.getId());
- }
- catch (Exception e) {
- logger.error("failed to remove null activity", e);
- }
- }
-
- public void restart() throws Exception {
- sleeContainer.getTransactionManager().mandateTransaction();
- if (logger.isDebugEnabled())
- logger.debug("NullActivityFactory.restart()");
- // Restore the cached image
- ActivityContextFactoryImpl acf =
sleeContainer.getActivityContextFactory();
- for (String id : cacheData.getNullActivityIds()) {
-
- if (logger.isDebugEnabled())
- logger
- .debug("NullActivityFactory.restart():
restoring null activity "
- + id);
- // recreate handle
- NullActivityHandle nullActivityHandle = new
NullActivityHandle(id);
- // get an activity context for it
-
acf.createActivityContext(ActivityContextHandlerFactory.createNullActivityContextHandle(nullActivityHandle));
- }
- }
-
- @Override
- public String toString() {
- return "Null Activity Factory: " +
- "\n+-- Null Activities: " +
cacheData.getNullActivityIds().size();
}
}
=======================================
---
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/sbbentity/SbbEntity.java
Mon Aug 3 03:32:20 2009
+++
/trunk/servers/jain-slee/core/jar/src/main/java/org/mobicents/slee/runtime/sbbentity/SbbEntity.java
Mon Aug 3 18:55:36 2009
@@ -26,7 +26,7 @@
import javax.transaction.SystemException;
import javax.transaction.TransactionRequiredException;
-import org.jboss.logging.Logger;
+import org.apache.log4j.Logger;
import org.mobicents.slee.container.SleeContainer;
import org.mobicents.slee.container.component.SbbComponent;
import
org.mobicents.slee.container.component.SbbComponent.EventHandlerMethod;
=======================================
--- /trunk/servers/jain-slee/core/pom.xml Sun Jul 26 13:36:14 2009
+++ /trunk/servers/jain-slee/core/pom.xml Mon Aug 3 18:55:36 2009
@@ -44,7 +44,7 @@
<slee.version>${pom.version}</slee.version>
<jboss.version>5.1.0.GA</jboss.version>
<!-- OTHER MOBICENTS COMPONENTS VERSIONS -->
-
<mobicents.tools.mavenplugin.du.version>1.0.0.BETA2</mobicents.tools.mavenplugin.du.version>
+
<mobicents.tools.mavenplugin.du.version>2.0.0.BETA1</mobicents.tools.mavenplugin.du.version>
<mobicents.tools.mavenplugin.eclipse.version>1.0.0.BETA2</mobicents.tools.mavenplugin.eclipse.version>
</properties>