Skip to content

Commit 1932390

Browse files
tandraschkorzo1
authored andcommitted
- removed deprecated EL method override
- fallback to a default ContextService in ManagedScheduledExecutorServiceImpl - removed unused var in CUTask - removed not-existing jetty dependency
1 parent 9860825 commit 1932390

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

container/openejb-core/src/main/java/org/apache/openejb/cdi/WebAppElResolver.java

+1-8
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import jakarta.el.ELResolver;
2323
import jakarta.el.PropertyNotFoundException;
2424
import jakarta.el.PropertyNotWritableException;
25-
import java.beans.FeatureDescriptor;
26-
import java.util.Iterator;
2725

2826
public class WebAppElResolver extends ELResolver {
2927
private final ELResolver parent;
@@ -63,12 +61,7 @@ public boolean isReadOnly(final ELContext context, final Object base, final Obje
6361
}
6462

6563
@Override
66-
public Iterator<FeatureDescriptor> getFeatureDescriptors(final ELContext context, final Object base) {
67-
return null;
68-
}
69-
70-
@Override
71-
public Class<?> getCommonPropertyType(final ELContext context, final Object base) {
64+
public Class<?> getCommonPropertyType(ELContext context, Object base) {
7265
return null;
7366
}
7467
}

container/openejb-core/src/main/java/org/apache/openejb/resource/thread/ManagedScheduledExecutorServiceImplFactory.java

+20-7
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,38 @@ public ManagedScheduledExecutorServiceImpl create(final ContextServiceImpl conte
4343
return new ManagedScheduledExecutorServiceImpl(createScheduledExecutorService(), contextService);
4444
}
4545
public ManagedScheduledExecutorServiceImpl create() {
46-
return new ManagedScheduledExecutorServiceImpl(createScheduledExecutorService(), findContextService());
47-
}
46+
String context;
47+
if (this.context == null || this.context.isBlank()) {
48+
context = "java:comp/DefaultContextService";
49+
}
50+
else {
51+
context = "openejb/Resource/" + this.context;
52+
}
4853

49-
private ContextServiceImpl findContextService() {
50-
if (context == null || context.trim().isEmpty()) {
51-
throw new IllegalArgumentException("Please specify a context service to be used with the managed executor");
54+
ContextServiceImpl contextService = findContextService(context);
55+
if (contextService == null) {
56+
contextService = ContextServiceImplFactory.newPropagateEverythingContextService();
5257
}
5358

59+
return new ManagedScheduledExecutorServiceImpl(createScheduledExecutorService(), contextService);
60+
}
61+
62+
private ContextServiceImpl findContextService(String contextName) {
5463
try {
5564
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
65+
// happens at least in unittests
66+
if (containerSystem == null) {
67+
return null;
68+
}
5669
final Context context = containerSystem.getJNDIContext();
57-
final Object obj = context.lookup("openejb/Resource/" + this.context);
70+
final Object obj = context.lookup(contextName);
5871
if (!(obj instanceof ContextServiceImpl)) {
5972
throw new IllegalArgumentException("Resource with id " + context
6073
+ " is not a ContextService, but is " + obj.getClass().getName());
6174
}
6275
return (ContextServiceImpl) obj;
6376
} catch (final NamingException e) {
64-
throw new IllegalArgumentException("Unknown context service " + context);
77+
throw new IllegalArgumentException("Unknown context service " + contextName);
6578
}
6679
}
6780

container/openejb-core/src/main/java/org/apache/openejb/threads/task/CUTask.java

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.util.concurrent.Callable;
2929

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

3332
// only updated in container startup phase, no concurrency possible, don't use it at runtime!
3433
private static volatile ContainerListener[] CONTAINER_LISTENERS = new ContainerListener[0];

pom.xml

-5
Original file line numberDiff line numberDiff line change
@@ -1140,11 +1140,6 @@
11401140
<artifactId>jetty-server</artifactId>
11411141
<version>${version.jetty}</version>
11421142
</dependency>
1143-
<dependency>
1144-
<groupId>org.eclipse.jetty</groupId>
1145-
<artifactId>jetty-continuation</artifactId>
1146-
<version>${version.jetty}</version>
1147-
</dependency>
11481143
<dependency>
11491144
<groupId>org.eclipse.jetty</groupId>
11501145
<artifactId>jetty-jsp-2.1</artifactId>

0 commit comments

Comments
 (0)