Tom HawtinThomas Hawtin's WeblogOn while-free waits- December 24, 2005 In Java 1.5, the Object.wait documentation was "clarified" to permit spurious wakeups. This means you really do have to put wait within a while loop. Having said that, Sun's JVM does not currently wake spuriously. There is a technique that involves wait outside of a while loop. I though it was a bug the first time I saw it, but it does work in the absence of spurious wakeups. If you see it, it should be fixed. Suppose we want to perform a task on another thread. We can create a private lock...http://www.jroller.com/tackline/entry/on_while_free_waits Erase reference arrays- December 9, 2005 In the days before 1.5, arrays offered a poor person's generics. Arrays do not play nicely with generics. Old ways need to be updated. It used to be common practice to return from methods an array rather than some form of Collection. With an array you can state the type of the contents within the programming language. The interface is more readily understandable. The client code is often less messy, as it needs no casts. If a collection is returned, the type documentation must be moved to...http://www.jroller.com/tackline/entry/erase_reference_arrays Sleeper Security- December 7, 2005 I personally find security dull. However, most Java programmers need to be aware of how to avoid inadvertently opening up a security flaw. Even the best fail. The general approach to security checks in Java is to examine the privileges of frames on the stack from the top downwards. Each method involved must have the requested privilege. That is, the intersection of rights is considered. For convenience and performance, AccessController.doPrivileged allows privileged code to run with...http://www.jroller.com/tackline/entry/sleeper_security |