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

ProxySelector leak #17

Closed
kmoens opened this issue May 14, 2014 · 1 comment
Closed

ProxySelector leak #17

kmoens opened this issue May 14, 2014 · 1 comment

Comments

@kmoens
Copy link
Contributor

@kmoens kmoens commented May 14, 2014

We found another possible leak by means of the ProxySelector Java class. To clear this one, we had to create a new method like this one:

    protected void clearDefaultProxySelector() {
        AccessController.doPrivileged(new PrivilegedAction<Void>() {
            @Override
            public Void run() {
                ProxySelector selector = ProxySelector.getDefault();
                if (isLoadedInWebApplication(selector)) {
                    ProxySelector.setDefault(null);
                    warn("Removing default java.net.ProxySelector");
                }
                return null;
            }
        });
    }

Additionally the clearDefaultProxySelector() method is called from the contextDestroyed() method.

Kind regards,

Kenny Moens
CIPAL

@mjiderhamn
Copy link
Owner

@mjiderhamn mjiderhamn commented May 14, 2014

Thanks for the report! I've added your suggested changes to the sources, to be included in the next release (not yet planned). I've also added this to the list of mistakes at http://java.jiderhamn.se/2012/02/26/classloader-leaks-v-common-mistakes-and-known-offenders/

@mjiderhamn mjiderhamn closed this May 14, 2014
mjiderhamn added a commit that referenced this issue May 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.