Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrency work #1104

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import jakarta.el.ELResolver;
import jakarta.el.PropertyNotFoundException;
import jakarta.el.PropertyNotWritableException;
import java.beans.FeatureDescriptor;
import java.util.Iterator;

public class WebAppElResolver extends ELResolver {
private final ELResolver parent;
Expand Down Expand Up @@ -63,12 +61,7 @@ public boolean isReadOnly(final ELContext context, final Object base, final Obje
}

@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(final ELContext context, final Object base) {
return null;
}

@Override
public Class<?> getCommonPropertyType(final ELContext context, final Object base) {
public Class<?> getCommonPropertyType(ELContext context, Object base) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,38 @@ public ManagedScheduledExecutorServiceImpl create(final ContextServiceImpl conte
return new ManagedScheduledExecutorServiceImpl(createScheduledExecutorService(), contextService);
}
public ManagedScheduledExecutorServiceImpl create() {
return new ManagedScheduledExecutorServiceImpl(createScheduledExecutorService(), findContextService());
}
String context;
if (this.context == null || this.context.isBlank()) {
context = "java:comp/DefaultContextService";
}
else {
context = "openejb/Resource/" + this.context;
}

private ContextServiceImpl findContextService() {
if (context == null || context.trim().isEmpty()) {
throw new IllegalArgumentException("Please specify a context service to be used with the managed executor");
ContextServiceImpl contextService = findContextService(context);
if (contextService == null) {
contextService = ContextServiceImplFactory.newPropagateEverythingContextService();
}

return new ManagedScheduledExecutorServiceImpl(createScheduledExecutorService(), contextService);
}

private ContextServiceImpl findContextService(String contextName) {
try {
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
// happens at least in unittests
if (containerSystem == null) {
return null;
}
final Context context = containerSystem.getJNDIContext();
final Object obj = context.lookup("openejb/Resource/" + this.context);
final Object obj = context.lookup(contextName);
if (!(obj instanceof ContextServiceImpl)) {
throw new IllegalArgumentException("Resource with id " + context
+ " is not a ContextService, but is " + obj.getClass().getName());
}
return (ContextServiceImpl) obj;
} catch (final NamingException e) {
throw new IllegalArgumentException("Unknown context service " + context);
throw new IllegalArgumentException("Unknown context service " + contextName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.concurrent.Callable;

public abstract class CUTask<T> extends ManagedTaskListenerTask implements Comparable<Object> {
private static final SecurityService SECURITY_SERVICE = SystemInstance.get().getComponent(SecurityService.class);

// only updated in container startup phase, no concurrency possible, don't use it at runtime!
private static volatile ContainerListener[] CONTAINER_LISTENERS = new ContainerListener[0];
Expand Down
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1140,11 +1140,6 @@
<artifactId>jetty-server</artifactId>
<version>${version.jetty}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-continuation</artifactId>
<version>${version.jetty}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp-2.1</artifactId>
Expand Down