Skip to content

Conversation

khmarbaise
Copy link
Contributor

No description provided.

@ericvergnaud
Copy link
Contributor

@parrt any concerns?

@parrt
Copy link
Member

parrt commented Feb 28, 2021

are we sure antlr is threadsafe at maven level? not sure what it means.

@khmarbaise
Copy link
Contributor Author

Thread safety means in this relationship that you can correctly build with -T XXX. (Excerpt from the docs: Marks this mojo as being thread-safe, i.e. the mojo safely supports concurrent execution during parallel builds...)

@parrt
Copy link
Member

parrt commented Feb 28, 2021

Hi. thanks. I am not sure what requirements are for thread safety in this context though. i.e., i'm not sure what maven is doing...there might be globals/statics in antlr code but should be ok in separate processes.

@khmarbaise
Copy link
Contributor Author

khmarbaise commented Mar 1, 2021

The point is that during a build process for each module the antl4-maven-plugin is called once (ok you can do several executes via execution blocks but those will be sequential). Executing a build in parallel means on the level of modules in parallel... for example if you have a build with 20 modules you could theoretically execute it with 20 thread via mvn package -T20 and it would be extremely fast but of course you have usually dependencies between modules which results in the module level tree where each level is on it's own thread. That would be a little bit slower but can safe 20-50% of build time in average.

It is safe to define the plugin threadsafe=true which in the end does not produce the WARNING.
Technically a plugin which uses an external resource (for example a file somewhere in the file system) would not be thread safe because it could happen that two instances of the plugin try to access that resource simultaneously which would result in an issue. But based on the antlr4-maven-plugin I don't see that.

That could be used to improve the build speed of the grammar-v4 project (exception is currently also the antl4test-maven-plugin which is not marked as thread safe as well. Technically it works but produces that warning.).

@parrt parrt merged commit 715acdb into antlr:master Mar 1, 2021
@ericvergnaud ericvergnaud added this to the 4.9.2 milestone Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants