MailHandler extends Handler { private void setContextClassLoader(final Object ccl) { if (ccl == null || ccl instanceof ClassLoader) { AccessController.doPrivileged(new GetAndSetContext(ccl)); } } MailHandler();  MailHandler(final int capacity);  MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); void publish(final LogRecord record); void push(); void flush(); void close(); @Override synchronized void setLevel(final Level newLevel); final synchronized Level getPushLevel(); final synchronized void setPushLevel(final Level level); final synchronized Filter getPushFilter(); final synchronized void setPushFilter(final Filter filter); final synchronized Comparator<? super LogRecord> getComparator(); final synchronized void setComparator(Comparator<? super LogRecord> c); final synchronized int getCapacity(); final synchronized Authenticator getAuthenticator(); final void setAuthenticator(final Authenticator auth); final void setAuthenticator(final char... password); final void setMailProperties(Properties props); final Properties getMailProperties(); final Filter[] getAttachmentFilters(); final void setAttachmentFilters(Filter... filters); final Formatter[] getAttachmentFormatters(); final void setAttachmentFormatters(Formatter... formatters); final Formatter[] getAttachmentNames(); final void setAttachmentNames(final String... names); final void setAttachmentNames(Formatter... formatters); final synchronized Formatter getSubject(); final void setSubject(final String subject); final void setSubject(final Formatter format);  }
@Test public void testCloseContextClassLoader() { assertNull(System.getSecurityManager()); final Thread thread = Thread.currentThread(); final ClassLoader ccl = thread.getContextClassLoader(); try { testCloseContextClassLoader((CloseClassLoaderSecurityManager) null); thread.setContextClassLoader(ccl); testCloseContextClassLoader(new CloseClassLoaderSecurityManager()); } finally { thread.setContextClassLoader(ccl); } }