[concurrency-interest] [Javamemorymodel-discussion] Fences.keepAlive

Doug Lea dl at cs.oswego.edu
Thu Jan 22 10:38:02 EST 2009


Michael Bien wrote:
> has it already been considered to move the Fences.* API into a sun 
> package like Unsafe etc. or even into a external library (@see JDK7 
> modules)? I am still not convinced that it is necessary to introduce it 
> as public API ;)
> 
> I don't think Fences is a API which addresses mainstream problems. It is 
> probably rather a feature you would need inside libraries to solve 
> corner cases.

Everyone (including me) has these concerns. However...
1) It must have a public, standardized API, unlike sun.* classes which
    are not and cannot be part of JCP-approved specs.
2) The specs in the API must be implemented/honored by all
    compliant JVMs, so can only be done as a part of "major release"
    platform JSR (i.e., the Java7 release JSR, whenever that finally
    happens).
3) The only means we know of restricting use; for example, by internally
    blowing up if accessed outside of bootclasspath would make it
    unavailable to a significant segment of its intended audience;
    including those implementing infrastructure running on app-servers.
4) The desired usage restrictions have nothing to do with package
    or class or module accessibility -- methods must be available across
    these. The restrictions instead amount to: don't use this unless
    you know you need to, and are sure of consequences, which is too
    squishy to automate.

If anyone else has any good, implementable, ideas about other ways to
deal with this, please let me know! As mentioned in one of my
replies to Sarita, while there might be some plausible alternative
paths here, all of them that I know would entail some significant
medium/long-term efforts.

Also, do bear in mind that the amount of discussion on the
topic is completely uncorrelated with its range of use!
Relatively few people need this API, but those who do, need
to have clear specs and correct implementations. For JMM-related
features, history shows there are usually a few thousand lines of
list discussion per line of code ultimately implemented :-)

-Doug




More information about the Concurrency-interest mailing list