Skip to content

Commit

Permalink
WFLY-2080: Moves all functionality to save context, i.e. the ContextH…
Browse files Browse the repository at this point in the history
…andleFactories, into each ConcurrentContext instance. The context is saved in a context handle that chains each factory's individual context handle, and which manages serialization tasks. Each ConcurrentContext is installed into MSC, to support deserialization. Two additional context handle factories are added to, one that builds handles which add Other EE Setup Actions to the invocation context, and another one that rollbacks any started transaction left open.
  • Loading branch information
emmartins authored and n1hility committed Sep 24, 2013
1 parent d260728 commit d4aecbe
Show file tree
Hide file tree
Showing 32 changed files with 1,018 additions and 411 deletions.
16 changes: 16 additions & 0 deletions ee/src/main/java/org/jboss/as/ee/EeLogger.java
Expand Up @@ -192,4 +192,20 @@ public interface EeLogger extends BasicLogger {
@Message(id = 11013, value = "%s in subdeployment ignored. jboss-ejb-client.xml is only parsed for top level deployments.")
void subdeploymentIgnored(String pathName);

@LogMessage(level = WARN)
@Message(id = 11014, value = "Transaction started in EE Concurrent invocation left open, starting rollback to prevent leak.")
void rollbackOfTransactionStartedInEEConcurrentInvocation();

@LogMessage(level = WARN)
@Message(id = 11015, value = "Failed to rollback transaction.")
void failedToRollbackTransaction(@Cause Throwable cause);

@LogMessage(level = WARN)
@Message(id = 11016, value = "Failed to suspend transaction.")
void failedToSuspendTransaction(@Cause Throwable cause);

@LogMessage(level = WARN)
@Message(id = 11017, value = "System error while checking for transaction leak in EE Concurrent invocation.")
void systemErrorWhileCheckingForTransactionLeak(@Cause Throwable cause);

}
17 changes: 17 additions & 0 deletions ee/src/main/java/org/jboss/as/ee/EeMessages.java
Expand Up @@ -35,6 +35,7 @@
import org.jboss.as.ee.component.BindingConfiguration;
import org.jboss.as.ee.component.ComponentConfiguration;
import org.jboss.as.ee.component.InjectionSource;
import org.jboss.as.ee.concurrent.ConcurrentContext;
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.jboss.invocation.proxy.MethodIdentifier;
import org.jboss.jandex.AnnotationTarget;
Expand All @@ -45,6 +46,7 @@
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageBundle;
import org.jboss.logging.annotations.Param;
import org.jboss.msc.service.ServiceName;
import org.jboss.vfs.VirtualFile;

/**
Expand Down Expand Up @@ -901,4 +903,19 @@ public interface EeMessages {
@Message(id = 16708, value = "EE Concurrent Service's value uninitialized.")
IllegalStateException concurrentServiceValueUninitialized();

@Message(id = 16709, value = "EE Concurrent ContextHandle serialization must be handled by the factory.")
IOException serializationMustBeHandledByThefactory();

@Message(id = 16710, value = "The EE Concurrent Context %s already has a factory named %s")
IllegalArgumentException factoryAlreadyExists(ConcurrentContext concurrentContext, String factoryName);

@Message(id = 16711, value = "EE Concurrent Context %s does not has a factory named %s")
IOException factoryNotFound(ConcurrentContext concurrentContext, String factoryName);

@Message(id = 16712, value = "EE Concurrent Context %s service not installed.")
IOException concurrentContextServiceNotInstalled(ServiceName serviceName);

@Message(id = 16713, value = "EE Concurrent Transaction Setup Provider service not installed.")
IllegalStateException transactionSetupProviderServiceNotInstalled();

}
Expand Up @@ -35,8 +35,7 @@
import java.util.Set;

import org.jboss.as.ee.component.interceptors.OrderedItemContainer;
import org.jboss.as.ee.concurrent.handle.ChainedContextHandleFactory;
import org.jboss.as.ee.concurrent.handle.ContextHandleFactory;
import org.jboss.as.ee.concurrent.ConcurrentContext;
import org.jboss.as.naming.context.NamespaceContextSelector;
import org.jboss.as.server.deployment.reflect.ClassIndex;
import org.jboss.invocation.InterceptorFactory;
Expand All @@ -61,8 +60,7 @@ public class ComponentConfiguration {
private final ModuleLoader moduleLoader;
private final ClassLoader moduleClassLoader;

// jsr-236 all chained context handle factories
private final ChainedContextHandleFactory allChainedConcurrentContextHandleFactory;
private final ConcurrentContext concurrentContext;

private ComponentCreateServiceFactory componentCreateServiceFactory = ComponentCreateServiceFactory.BASIC;

Expand Down Expand Up @@ -97,7 +95,7 @@ public ComponentConfiguration(final ComponentDescription componentDescription, f
this.classIndex = classIndex;
this.moduleClassLoader = moduleClassLoader;
this.moduleLoader = moduleLoader;
this.allChainedConcurrentContextHandleFactory = new ChainedContextHandleFactory(ContextHandleFactory.Type.ALL_CHAINED);
this.concurrentContext = new ConcurrentContext(getApplicationName(),getModuleName(),getComponentName());
}

/**
Expand Down Expand Up @@ -465,11 +463,7 @@ public Set<Object> getInterceptorContextKeys() {
return interceptorContextKeys;
}

/**
* @return the chained context handle factory with all concurrent (jsr 236) contexts.
*/
public ChainedContextHandleFactory getAllChainedContextHandleFactory() {
return allChainedConcurrentContextHandleFactory;
public ConcurrentContext getConcurrentContext() {
return concurrentContext;
}

}
Expand Up @@ -32,6 +32,7 @@
import java.util.Map;

import org.jboss.as.ee.component.interceptors.InterceptorClassDescription;
import org.jboss.as.ee.concurrent.ConcurrentContext;
import org.jboss.as.ee.naming.InjectedEENamespaceContextSelector;
import org.jboss.msc.service.ServiceName;

Expand Down Expand Up @@ -70,6 +71,8 @@ public final class EEModuleDescription implements ResourceInjectionTarget {

private ServiceName defaultClassIntrospectorServiceName = ReflectiveClassIntrospector.SERVICE_NAME;

private final ConcurrentContext concurrentContext;

/**
* Construct a new instance.
*
Expand All @@ -83,6 +86,7 @@ public EEModuleDescription(final String applicationName, final String moduleName
this.moduleName = moduleName;
this.earApplicationName = earApplicationName;
this.appClient = appClient;
this.concurrentContext = new ConcurrentContext(getApplicationName(),getModuleName(),null);
}

/**
Expand Down Expand Up @@ -300,4 +304,8 @@ public void addInterceptorEnvironment(final String interceptorClassName, final I
public Map<String, InterceptorEnvironment> getInterceptorEnvironment() {
return interceptorEnvironment;
}

public ConcurrentContext getConcurrentContext() {
return concurrentContext;
}
}

0 comments on commit d4aecbe

Please sign in to comment.