Glassfish 21219

https://java.net/jira/browse/GLASSFISH-21219
One commit depends on GLASSFISH-21148 (pull request #45) so this branch is based on that branch and that branch should be pulled first (another option is to pull only this branch and the request #45 can be dropped).