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

WELD-2374 Add option to disable Jandex in SE and Servlet environment. #1657

Merged
merged 1 commit into from
Apr 11, 2017

Conversation

manovotn
Copy link
Contributor

@manovotn manovotn commented Apr 7, 2017

No description provided.

@manovotn manovotn added the hold label Apr 7, 2017
@mkouba
Copy link
Member

mkouba commented Apr 7, 2017

I think we could share org.jboss.weld.discovery.disableJandexDiscovery and the log message for both Weld SE and Servlet (i.e. into weld-environment-common).

Also I would add a boolean isJandexDisabled (name TBD) param to org.jboss.weld.environment.deployment.discovery.DiscoveryStrategyFactory.create(ResourceLoader, Bootstrap, Set<Class<? extends Annotation>>) and let the factory handle the param correctly.

@manovotn manovotn force-pushed the weld2374 branch 3 times, most recently from 8ed08d8 to 7b7a261 Compare April 10, 2017 11:39
@manovotn manovotn removed the hold label Apr 10, 2017
@manovotn manovotn requested review from mkouba and tremes April 10, 2017 11:48
@Test
public void testDeploymentWorksBecauseJandexIsNotUsed() {
try (WeldContainer container = new Weld().initialize()) {
// no-op, if the option does not work, this will crash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about to add some basic assertion like container is running or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do that, although it makes no real difference. If the option does not work, you get an exception during bootstrap.

Copy link
Member

@mkouba mkouba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@manovotn
Copy link
Contributor Author

BTW apart from the SE test I did test it manually with numberguess on Tomcat 8.5.5.

} catch (Exception e) {
throw CommonLogger.LOG.unableToInstantiate(Jandex.JANDEX_DISCOVERY_STRATEGY_CLASS_NAME,
Set<Class<? extends Annotation>> initialBeanDefiningAnnotations, boolean jandexStrategyDisabled) {
if (jandexStrategyDisabled) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could move this check inside the if (Jandex.isJandexAvailable(resourceLoader)) block. It makes more sense to only show the log message if jandex is on the classpath. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we could but I don't like it.
I specifically made it this way, so that we don't even need to look whether there is any Jandex on CP if this option is set.

} catch (Exception e) {
throw CommonLogger.LOG.unableToInstantiate(Jandex.JANDEX_DISCOVERY_STRATEGY_CLASS_NAME,
if (jandexStrategyDisabled) {
CommonLogger.LOG.jandexDiscoveryStrategyDisabled();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkouba changed based on your suggestion

@mkouba
Copy link
Member

mkouba commented Apr 11, 2017

I think we're ready to merge now. @manovotn could you send a PR for 2.4 branch?

@manovotn
Copy link
Contributor Author

Done in #1659

@mkouba mkouba merged commit 7ce4710 into weld:master Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants