7/24/2012

ConcurrentModificationException

ConcurrentModificationException usually has nothing to do with multiple threads. Most of the time it occurs because you are modifying the collection over which it is iterating within the body of the iteration loop. For example, this will cause it:

Iterator iterator = collection.iterator();
while (iterator.hasNext()) {
    Item item = (Item) iterator.next();
    if (item.satisfiesCondition()) {
       collection.remove(item);
    }
}
In this case you must use the iterator.remove() method instead. This occurs equally if you are adding to the collection, in which case there is no general solution. However, the subclass ListIterator can be used if dealing with a list and this has an add() method.

7/18/2012

Hot Deployment in JBoss

compile war:war
(or package war:war, which is slower)
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <outputDirectory>d:\jboss5\server\default\deploy</outputDirectory>
                </configuration>
            </plugin>

The fastest way to delete a large folder in Windows

rmdir /s /q folder