Re: Maybe i'm being naive about Threads.

2009-11-22 Thread David Holmes - Sun Microsystems
Paulo Levi said the following on 11/21/09 16:48: But i'm wondering why there isn't a global jvm system option for the new Thread(runnable).start() to perserve stack traces at least until the start method. Why? Probably because not enough people have considered it to be a necessary thing to

Re: What methods should go into a java.util.Objects class in JDK 7?

2009-11-16 Thread David Holmes - Sun Microsystems
Stephen Colebourne said the following on 11/16/09 18:44: In this specific case, the question was why include it when you can use a?b:c. Well, I've seen resistance by developers to that language feature, and I know some places outright block it in coding standards. For many, a method call is

Re: What methods should go into a java.util.Objects class in JDK 7?

2009-11-15 Thread David Holmes - Sun Microsystems
On Sat, Nov 14, 2009 at 10:46 PM, David Holmes - Sun Microsystems david.hol...@sun.com wrote: Paul, Paul Benedict said the following on 11/15/09 11:28: I would like to propose adding this method: /** * Selects the object if not {...@code null}; otherwise fallsback to the * specified default

Re: What methods should go into a java.util.Objects class in JDK 7?

2009-11-14 Thread David Holmes - Sun Microsystems
Paul, Paul Benedict said the following on 11/15/09 11:28: I would like to propose adding this method: /** * Selects the object if not {...@code null}; otherwise fallsback to the * specified default object. * * @param object the object to test * @param defaultObject the default object *

Re: Anyway in java to way for the child process to wait for parent process to die

2009-11-11 Thread David Holmes - Sun Microsystems
Paulo Levi said the following on 11/12/09 05:31: In process builder. No. I'm not aware of any OS support for waiting for a parent process to die. David Holmes

Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-08 Thread David Holmes - Sun Microsystems
Hi Ulf, Ulf Zibis said the following on 10/08/09 20:07: Am 08.10.2009 06:35, David Holmes - Sun Microsystems schrieb: Ulf Zibis said the following on 10/08/09 08:58: For my better understanding: Can you explain me the real bug in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6881442

Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-08 Thread David Holmes - Sun Microsystems
Ulf Zibis said the following on 10/08/09 21:58: Am 08.10.2009 12:59, David Holmes - Sun Microsystems schrieb: It's a memory model issue. The code is like this: public String getName() { if (name == null) name = getName0(); return name; } but in theory

Re: Objects.toString [Re: What methods should go into a java.util.Objects class in JDK 7?]

2009-10-08 Thread David Holmes - Sun Microsystems
Joe, Joseph D. Darcy said the following on 10/09/09 04:30: System.out.println( + referenceOfAnyType); will print null if referenceOfAnyType is null. This is what the platform has done since the beginning. Yes because String concatenation can not tolerate null values appearing, so it is

Re: What methods should go into a java.util.Objects class in JDK 7?

2009-10-07 Thread David Holmes - Sun Microsystems
Stephen Colebourne said the following on 10/07/09 18:10: BTW, I don't accept the argument that one and only one way to do something is part of the JDK. While the JDK is far from a model example of providing one way to do something, that doesn't mean we should gratuitously add superfluous and

Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-07 Thread David Holmes - Sun Microsystems
Ulf, Ulf Zibis said the following on 10/08/09 08:58: For my better understanding: Can you explain me the real bug in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6881442. In my understanding, loading the name field twice is too only a performance bug. Please correct me!

Re: What methods should go into a java.util.Objects class in JDK 7?

2009-10-06 Thread David Holmes - Sun Microsystems
Hi Joe, I thought the point that Jason Mehrens was making was that this: +public static String toString(Object o) { +String.valueOf(o); +} is actually pointless. Why introduce such redundancy when people can just use String.valueOf directly ? This doesn't provide any benefit.

Re: What methods should go into a java.util.Objects class in JDK 7?

2009-10-06 Thread David Holmes - Sun Microsystems
Joe, Joe Darcy said the following on 10/07/09 09:43: David Holmes - Sun Microsystems wrote: I thought the point that Jason Mehrens was making was that this: +public static String toString(Object o) { +String.valueOf(o); hat Jason Mehrens was making was that this: +public

Re: Review Request for 6878481: Add performance counters in the JDK

2009-09-13 Thread David Holmes - Sun Microsystems
Just to add 2c to Alan's method naming comments: Alan Bateman said the following on 09/13/09 18:07: Method naming is hard (and often subjective) but there are updates like this: PerfCounter.getParentDelegationTime.inc(t1 - t0); which might be easier to read as:

Re: Review Request for 6878481: Add performance counters in the JDK

2009-09-02 Thread David Holmes - Sun Microsystems
Hi Mandy, Mandy Chung said the following on 09/03/09 05:25: This is related to 6857194: Add hotspot new perf counters to aid class loading performance measurement. It's useful to add performance counters in the library code so that perf data from the JDK and VM can be collected and output in

Re: Which classes need to be supplied by any JVM?

2009-08-21 Thread David Holmes - Sun Microsystems
the bytecode-engine part of the JVM from the Java runtime platform part. The bytecode engine has few dependencies on classes, perhaps not even Object, while the runtime environment has many dependencies. David Holmes I, like Carsten, find it odd if this isn't well-defined. Stephen David Holmes

Re: Which classes need to be supplied by any JVM?

2009-08-20 Thread David Holmes - Sun Microsystems
As Martin stated what you are looking for is not part of the JVMS nor the JLS, but the platform specification, which is essentially the entire set of Java API's as found for example here: http://java.sun.com/javase/6/docs/index.html But the implementation of those classes will then have

Re: [concurrency-interest] LinkedBlockingDeque deadlock?

2009-07-15 Thread David Holmes - Sun Microsystems
Just to clarify ... Martin Buchholz said the following on 07/16/09 07:24: In summary, there are two different bugs at work here, and neither of them is in LBD. The hotspot team is working on the LBD deadlock. Not the hotspot team, just me :) - I am looking into this in my role as j.u.c

Re: malloc failures in java/util/zip/Deflater

2009-07-08 Thread David Holmes - Sun Microsystems
Hi Mario, I'm not familiar with this particular code but doesn't a value of this_len==0 imply that there's nothing to do and a whole chunk of code here can be skipped? Is finding this_len==0 even valid here? Your patch fixes your problem, but it seems to me the code either shouldn't get

Re: timsort

2009-07-07 Thread David Holmes - Sun Microsystems
Martin Buchholz said the following on 07/08/09 02:33: + * @throws IllegalArgumentException if the natural order of the array + * elements is found to violate the {...@link Comparable} contract So the proposed spec does not and cannot require any exception to be thrown. What is

Re: Review request for 5049299

2009-05-22 Thread David Holmes - Sun Microsystems
Hi Michael, But the implementation in processhelper, does not know about JNI, so it ignores the env and doesn't throw the exception, which then begs the question as to what happens if malloc returns NULL in that case? If I understand you right, the jlup_* functions called from processhelper

Re: c.toArray might (incorrectly) not return Object[] (see 6260652)

2009-05-22 Thread David Holmes - Sun Microsystems
Hi Doug, Thanks for the info, one query though ... Doug Lea said the following on 05/22/09 21:08: David Holmes - Sun Microsystems wrote: Okay well the bug is still open. I think the original intent was to change toArray() to match this, but I think it's far too late to change that behaviour

Re: Request for approval: Bug 100057 - Potential stack corruption in GetJavaProperties

2009-05-22 Thread David Holmes - Sun Microsystems
Hi Andrew, If you use malloc then you have to check for a NULL return and deal with the error possibility. Alternatively use strncpy to make sure it's safe and continue to assume that it will be big enough. Cheers, David Holmes Andrew Haley said the following on 05/22/09 21:10:

Re: c.toArray might (incorrectly) not return Object[] (see 6260652)

2009-05-22 Thread David Holmes - Sun Microsystems
Doug Lea said the following on 05/22/09 21:31: David Holmes - Sun Microsystems wrote: Thanks for the info, one query though ... Ummm why didn't it just use: elementData = c.toArray(new Object[c.size()]); Because c might be a concurrent collection, so you don't want to independently

Re: Request for approval: Bug 100057 - Potential stack corruption in GetJavaProperties

2009-05-22 Thread David Holmes - Sun Microsystems
Andrew Haley said the following on 05/22/09 21:45: David Holmes - Sun Microsystems wrote: If you use malloc then you have to check for a NULL return and deal with the error possibility. Alternatively use strncpy to make sure it's safe and continue to assume that it will be big enough. It's

Re: c.toArray might (incorrectly) not return Object[] (see 6260652)

2009-05-22 Thread David Holmes - Sun Microsystems
Doug Lea said the following on 05/22/09 21:56: Sorry; I should have been clearer about why c.toArray(new Object[c.size()]) is subtly wrong here. ArrayList.size must equal the number of elements, which might be different than the array size. If c's size shrinks at an inconvenient moment during

Re: c.toArray might (incorrectly) not return Object[] (see 6260652)

2009-05-21 Thread David Holmes - Sun Microsystems
Florian Weimer said the following on 05/22/09 03:18: So says the ArrayList(Collection) constructor. Can this bug report be opened? Is this workaround still necessary? I'm confused. The bug states: The Collection documentation claims that collection.toArray() is identical

Re: c.toArray might (incorrectly) not return Object[] (see 6260652)

2009-05-21 Thread David Holmes - Sun Microsystems
Florian Weimer said the following on 05/22/09 14:46: It's there, but not in the documentation for toArray(): | Note that toArray(new Object[0]) is identical in function to toArray(). http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html#toArray(java.lang.Object[])

Re: REVIEW 6511515: poor performance of LogRecord.inferCaller depending on java.lang.Throwable.getStackTraceElement

2009-04-21 Thread David Holmes - Sun Microsystems
do much - it just iterates over the array - so I don't think it adds much to the runtime. In the interests of not writing code that looks like that (i.e., yuck!), I recommend leaving it as-is. Jeremy On Mon, Apr 20, 2009 at 6:39 PM, David Holmes - Sun Microsystems david.hol...@sun.com wrote: Hi

Re: REVIEW 6511515: poor performance of LogRecord.inferCaller depending on java.lang.Throwable.getStackTraceElement

2009-04-20 Thread David Holmes - Sun Microsystems
Hi Martin, Jeremy, I'm assuming inferCaller always expects to find a caller, or at least that would be the common case - yes? If so then this might be a case where it is quicker to forego the getStackTraceDepth() call and simply catch the potential exception if we reach the end. Aside: we

Re: Review request for 6829503

2009-04-19 Thread David Holmes - Sun Microsystems
Alan, 2. File#deleteOnExit doesn't allow IllegalStateException to be thrown so maybe we should change DeleteOnExit#add to be a no-op if its shutdown hook is running. If an application is attempting to register files to be deleted during shutdown it will always be a timing issue if the file is

Re: Review request for 6829503

2009-04-17 Thread David Holmes - Sun Microsystems
Hi Mandy, Looks good but I have one query. At the top-level there are 3 shutdown hooks: - console hook - application hooks - deleteOnExit hook and they run in this order. The deleteOnExit hook can be added when shutdown is in progress, so this allows first-use of deleteOnExit during an

Re: PATCH: ShutdownHooks and LoggingDeadlock2

2009-04-13 Thread David Holmes - Sun Microsystems
I concur with the caution here. When looking at the lazy initialization change, it never occurred to me that first-use could actually occur after shutdown had commenced. David Martin Buchholz said the following on 04/14/09 06:57: On Mon, Apr 13, 2009 at 10:56, Mandy Chung mandy.ch...@sun.com

SIGFPE with FPE_FLTRES

2009-03-24 Thread David Holmes - Sun Microsystems
Can someone tell me when you can encounter a SIGFPE with si_code FPE_FLTRES? I'm suspecting this may be a case where a bad operation doesn't in itself fail but the next (innocent) FP operation gets hit with the FPE. Thanks, David Holmes

Re: [PATCH 1/1] Get rid of synchronization in java.util.logging.LogRecord constructor

2009-03-12 Thread David Holmes - Sun Microsystems
Andrew John Hughes said the following on 03/13/09 10:13: The rest of the code deals with allocating an ID to the thread creating the LogRequest object and doesn't depend on the global sequence number, so it doesn't matter if this is incremented by another thread before the constructor completes.

Re: Review request for 6810254

2009-03-05 Thread David Holmes - Sun Microsystems
() + $SharedSecretsHelper); ??? Leave it with you ... Cheers, David Mandy Chung said the following on 03/06/09 07:18: On 03/05/09 04:18, David Holmes - Sun Microsystems wrote: Hi Mandy, Isn't this kind of change risky? With static initialization you know that once the VM gets up and running then everything

Re: Request for review: 6806649

2009-02-20 Thread David Holmes - Sun Microsystems
Chris, Looks good to me. David Holmes Christopher Hegarty - Sun Microsystems Ireland said the following on 02/21/09 07:46: 6806649: synchronization bottleneck when constructing Thread subclasses Webrev: http://cr.openjdk.java.net/~chegar/6806649/webrev.00/webrev/ The global

Re: Question about Executors.

2009-02-11 Thread David Holmes - Sun Microsystems
FYI This question was redirected to the concurrency-inter...@cs.oswego.edu mailing list. David Paulo Levi said the following on 02/12/09 01:56: Why is there no (a horrible name) newFixedCachedThreadPool() static factory? I think it makes sense for tasks that have a upper throughput, but

Re: [PATCH] 6788196: Array bounds checks in io_util.c rely on undefined behaviour

2008-12-23 Thread David Holmes - Sun Microsystems
In C, the result of an overflowing add of two signed integers is undefined. Strewth! That's a surprise to me. I always thought that C defined integer arithmetic to always wrap. Checking for a negative to detect overflow is a common pattern - heck it's THE pattern for detecting overflow

Re: hg: jdk7/tl/jdk: 6642323: Speeding up Single Byte Decoders; ...

2008-12-16 Thread David Holmes - Sun Microsystems
It takes a couple of days for new bugs to become visible in bug parade. David Ulf Zibis said the following on 12/16/08 21:22: Am 15.12.2008 23:19, Xueming Shen schrieb: So I have created a new Cr #6785335 to keep trace this issue. Will consider put this one into 7 later. This bug

Re: Review for java launcher CR: 6742159

2008-09-17 Thread David Holmes - Sun Microsystems
Hi Kumar, Your signatureDiagnostic method seems to be doing too strong a job - it isn't checking for the existence of public static void main(String[]) it is checking that if any method with the name main exists then it must be: public static void main(String[]) So it would generate an

Re: RMI RemoteException

2008-08-29 Thread David Holmes - Sun Microsystems
HI Trenton, This might not be the right place for it but ... RemoteException is checked because you have to understand that it can happen (and occasionally will) and you have to think about what can be done to recover (even if you ultimately decide to just to fail by throwing some other