Ah, I see, you want it that way to track that a warning about invalid directory is logged only once. That could be solved with an:

private static final ConcurrentMap<Path, Path> invalidDirs = new ConcurrentHashMap<>();

...and then in validateDumpDir:

    if (invalidDirs.putIfAbsent(path, path) == null) {
        logger.warning(...


If you wanted to support a per-path instance of ProxyClassDumper, you would need a registry of ProxyClassDumper instances anyway, implemented with such a ConcurrentHashMap...


Regards, Peter

On 10/02/2013 09:19 AM, Peter Levart wrote:
Hi Henry,

Just a hint: Instead of parameterized singleton ProxyClassDumper with static method getInstance(path) which suggests that different ProxyClassDumper instances are returned for different path parameters (which are not), you could create for example:

class DumpProxyClassAction implements PrivilegedAction<Void> {
DumpProxyClassAction(String dumpDir, String className, byte[] classBytes) {
        ...

...and use it in InnerClassLambdaMetafactory instead of an anonymous inner class. Same number of objects per generated class are created that way...

Regards, Peter

On 10/02/2013 01:04 AM, Henry Jen wrote:
Hi,

Please review the updated webrev at
http://cr.openjdk.java.net/~henryjen/ccc/8023524/3/webrev/

This update addressed comments from Mandy with following,

- call doPrivileged with specific file permission, "<<ALL FILES>>", "write".
- Use nio package to write deal with FS, also create directory hierarchy
with package name instead of flat files.
- If not specify a value or empty string, the directory is default to
current working directory as "." is specified.

We continue to use local encoding rule as other suggestions doesn't fit.
The reason we cannot use something like URLEncoder is that ":" won't get
encoded and it's not valid character for filename on Windows. All the
suggestions so far seems to have that same issue.

Cheers,
Henry




Reply via email to