Skip to content

Commit

Permalink
Merge pull request #325 from dmlloyd/ejbclient-275
Browse files Browse the repository at this point in the history
[EJBCLIENT-275] Updates to ensure that the naming identity propagates even if there is no naming provider
  • Loading branch information
dmlloyd authored Sep 29, 2017
2 parents 49903e2 + 9168583 commit 1da3cee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
<version.org.kohsuke.metainf-services>1.7</version.org.kohsuke.metainf-services>
<version.org.wildfly.client-config>1.0.0.Final</version.org.wildfly.client-config>
<version.org.wildfly.common>1.2.0.Final</version.org.wildfly.common>
<version.org.wildfly.naming.client>1.0.2.Final</version.org.wildfly.naming.client>
<version.org.wildfly.naming.client>1.0.4.Final</version.org.wildfly.naming.client>
<version.org.wildfly.discovery>1.0.0.Final</version.org.wildfly.discovery>
<version.org.wildfly.security.elytron>1.1.0.Final</version.org.wildfly.security.elytron>
<version.org.wildfly.transaction-client>1.0.1.Final</version.org.wildfly.transaction-client>
<version.org.wildfly.transaction-client>1.0.2.Final</version.org.wildfly.transaction-client>

<version.org.jboss.bridger>1.4.Final</version.org.jboss.bridger>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.kohsuke.MetaInfServices;
import org.wildfly.naming.client.NamingContextFactory;
import org.wildfly.naming.client.NamingProvider;
import org.wildfly.naming.client.ProviderEnvironment;
import org.wildfly.naming.client.util.FastHashtable;

/**
Expand All @@ -43,8 +44,8 @@ public boolean supportsUriScheme(final NamingProvider namingProvider, final Stri
return "ejb".equals(nameScheme);
}

public Context createRootContext(final NamingProvider namingProvider, final String nameScheme, final FastHashtable<String, Object> env) throws NamingException {
public Context createRootContext(final NamingProvider namingProvider, final String nameScheme, final FastHashtable<String, Object> env, final ProviderEnvironment providerEnvironment) throws NamingException {
assert nameScheme.equals("ejb");
return new EJBRootContext(namingProvider, env);
return new EJBRootContext(namingProvider, env, providerEnvironment);
}
}
9 changes: 6 additions & 3 deletions src/main/java/org/jboss/ejb/client/EJBRootContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.wildfly.naming.client.AbstractContext;
import org.wildfly.naming.client.CloseableNamingEnumeration;
import org.wildfly.naming.client.NamingProvider;
import org.wildfly.naming.client.ProviderEnvironment;
import org.wildfly.naming.client.SimpleName;
import org.wildfly.naming.client.store.RelativeContext;
import org.wildfly.naming.client.util.FastHashtable;
Expand All @@ -43,10 +44,12 @@ class EJBRootContext extends AbstractContext {
private static final String PROPERTY_KEY_INVOCATION_TIMEOUT = "invocation.timeout";
private final Affinity baseAffinity;
private final NamingProvider namingProvider;
private final ProviderEnvironment providerEnvironment;

EJBRootContext(final NamingProvider namingProvider, final FastHashtable<String, Object> env) {
EJBRootContext(final NamingProvider namingProvider, final FastHashtable<String, Object> env, final ProviderEnvironment providerEnvironment) {
super(env);
this.namingProvider = namingProvider;
this.providerEnvironment = providerEnvironment;

// check if strong affinity for this context has been set in the environment
String clusterName = getClusterAffinityValueFromEnvironment();
Expand Down Expand Up @@ -139,12 +142,12 @@ protected Object lookupNative(final Name name) throws NamingException {
final Object proxy;
if (stateful) {
try {
proxy = EJBClient.createSessionProxy(statelessLocator, namingProvider == null ? null : namingProvider.getProviderEnvironment().getAuthenticationContextSupplier() , namingProvider);
proxy = EJBClient.createSessionProxy(statelessLocator, providerEnvironment.getAuthenticationContextSupplier(), namingProvider);
} catch (Exception e) {
throw Logs.MAIN.lookupFailed(name, name, e);
}
} else {
proxy = EJBClient.createProxy(statelessLocator, namingProvider == null ? null : namingProvider.getProviderEnvironment().getAuthenticationContextSupplier());
proxy = EJBClient.createProxy(statelessLocator, providerEnvironment.getAuthenticationContextSupplier());
}
if (namingProvider != null) EJBClient.putProxyAttachment(proxy, NAMING_PROVIDER_ATTACHMENT_KEY, namingProvider);

Expand Down

0 comments on commit 1da3cee

Please sign in to comment.