[gwt-contrib] Re: Error embedded 1.6 Compiler
I may be wrong, but doesn't the ProcessBuilder use the OS interpreter to parse the forked process command line arguments ? (This may be JRE dependenant) In such case, it may fail on windows with long classpath String as we can have on JEE web applications and maven projects For my personnal info, why do you fork a JVM and not just use multiple threads using java.util.concurrent ? On Fri, Feb 20, 2009 at 4:16 AM, Scott Blum sco...@google.com wrote: Nicolas, I see what the problem is. Check out this code in ExternalPermutationWorkerFactoryhttp://code.google.com/p/google-web-toolkit/source/browse/releases/1.6/dev/core/src/com/google/gwt/dev/ExternalPermutationWorkerFactory.java#246 : // Cook up the classpath, main class, and extra args args.addAll(Arrays.asList(-classpath, ManagementFactory.getRuntimeMXBean().getClassPath(), CompilePermsServer.class.getName(), -host, localhost, -port, String.valueOf(port), -logLevel, logLevel.toString(), -cookie, cookie)); This is getting the system-level classpath in order to fork a new process, which in the Maven case is wrong. I guess the other option would be to check if (this.getClass().getClassLoader() instanceof URLClassLoader)... if that's true, we should be able to send over the classpath for the ClassLoader that contains gwt-dev-*.jar. Bob, do you have any thoughts on this? This is your code I think. Scott On Thu, Feb 19, 2009 at 10:30 AM, nicolas.deloof nicolas.del...@gmail.com wrote: Hi, I'm trying to upgrade the gwt-maven plugin to support 1.6 release. I've applied the shell / compiler changes and now try to launch the compiler. I got a strange error : [INFO]Compiling 15 permutations [INFO]Process output [INFO] [ERROR] java.lang.NoClassDefFoundError: com/google/gwt/ dev/CompilePermsServer [INFO] [ERROR] Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.CompilePermsServer [INFO] [ERROR]at java.net.URLClassLoader$1.run (URLClassLoader.java:200) [INFO] [ERROR]at java.security.AccessController.doPrivileged (Native Method) [INFO] [ERROR]at java.net.URLClassLoader.findClass (URLClassLoader.java:188) [INFO] [ERROR]at java.lang.ClassLoader.loadClass (ClassLoader.java:307) [INFO] [ERROR]at sun.misc.Launcher$AppClassLoader.loadClass (Launcher.java:301) [INFO] [ERROR]at java.lang.ClassLoader.loadClass (ClassLoader.java:252) [INFO] [ERROR]at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:320) [INFO] [ERROR] Could not find the main class: com.google.gwt.dev.CompilePermsServer. Program will exit. [INFO] [ERROR] Exception in thread main The plugin creates a native command script, like this one : D:\jdk6\jre\bin\java -Xmx512M -cp D:\repository\org\codehaus\mojo \gwt-maven-plugin\1.1-SNAPSHOT\gwt-maven-plugin-1.1-SNAPSHOT.jar org.codehaus.mojo.gwt.fork.ForkBooter D:\projets\webapp\target \gwt.classpath com.google.gwt.dev.Compiler -gen D:\projets\webapp \target\gen -logLevel INFO -style OBF -war D:\projets\webapp\target \webapp-1.0.0-SNAPSHOT -localWorkers 2 com.sfr.bios.rc.CADM The ForkBooter class is used to bypass Windows command line length limitation. It created a child classloader based on project dependencies list. In my case, the gwt.classpath file looks like : D:\projets\webapp\src\main\java D:\projets\webapp\target\generated-sources\gwt D:\projets\webapp\src\main\resources D:\projets\webapp\target\classes D:\repository\com\google\gwt\gwt-user\1.6.0\gwt-user-1.6.0.jar D:\repository\com\google\gwt\gwt-dev\1.6.0\gwt-dev-1.6.0-windows.jar D:\repository\com\google\gwt\gwt-servlet\1.6.0\gwt-servlet-1.6.0.jar ... As you can notice, the expected gwt-dev jar is present. I suppose the Compiling * permutations - Process output step has some Classloader issue that doesn't support our nested ClassLoader. Maybe it uses SystemClassloader directly ? I didn't get further with this issue debugging the compiler to understand what's wrong, maybe you've got an idea ? Nicolas --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: RR : Declassifying RPC / Removing all type names from compilation
I know this is a bit late, but is it true that we will now need to be more aggressive about deploying servlet classes? Is the obfuscated name mapping stable if new type names are added? On Wed, Feb 18, 2009 at 8:15 PM, BobV b...@google.com wrote: Thanks for the review. SerializerBase contains the comment Relies on monotonic behavior of hashcodes in web mode. I see no problem with this (and I've wanted to do so for JRE stuff at times), but I don't think we've ever explicitly stated this as a requirement of System.identityHashCode(). We should, at a minimum, document this requirement in our implementation of identityHashCode()/Impl.getHashCode(), so we don't inadvertently break it. Comments updated. SerializerBase.MethodMap is a JSO whose methods are non-final. Do you know why this is working? Do we only run JSO constraint-checking in hosted mode? MethodMap is a final class. Nits: ClientSerializationStreamWriter:57,82,96: JSNI reformat cruft. StandardSerializationPolicy:55: Double semicolons. ServerSerializationStreamWriter:412: Comment reformatting cruft (right-shifted notes). Fixed cruft. All that said, once you feel comfortable with it go ahead and commit away. I've run it against some pretty big projects without incident thus far, so... Good work! Merged to trunk at r4790. -- Bob Vawter Google Web Toolkit Team -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: Error embedded 1.6 Compiler
On Fri, Feb 20, 2009 at 3:09 AM, nicolas de loof nicolas.del...@gmail.comwrote: I may be wrong, but doesn't the ProcessBuilder use the OS interpreter to parse the forked process command line arguments ? (This may be JRE dependenant) Not sure, but it's worth pointing out that CompilePermsServer doesn't actually need a really long classpath... it is designed to work with only gwt-dev on the classpath. For my personnal info, why do you fork a JVM and not just use multiple threads using java.util.concurrent ? You can manually raise the number of local threads by setting the System property gwt.jjs.maxThreads. If you don't set it, it defaults to 1. The reason we prefer processes to threads has to do with heap usage. The compiler is extremely memory intensive-- the amount of memory required to compile is nearly linear with the number of permutations you run at the same time. This causes several problems. - The user has to start up the VM with a much higher memory ceiling or they risk running out of memory. - If you get anywhere near the hard memory ceiling, you'll start thrashing GC badly and everything will grind to a standstill. This is far less likely to happen with multiple processes each with their own heap. - Even when you don't get anywhere near the memory ceiling, we've seen that empirically, GC appears to be super-linear with respect to the amount of heap being used. By sharding across processes instead of threads, we tend to find that GC overhead is reduced overall. - Finally, some operating systems (particularly Linux) will simply devote more processing time to a set of processes than it will to a single process with a lot of threads. We tend to get much higher CPU utilization with multi-process Bob, I went searching for the design doc for multi-process/threaded compiles but couldn't find it. Does one exist already? If not, could this email be a start for one? Thanks, Scott --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Respecting onBeforeSelect.cancel
Reviewers: ecc, Description: When beforeSelect is fired check that if cancel is called the tree item doesn't get selected. Please review this at http://gwt-code-reviews.appspot.com/5801 Affected files: src-demo/com/google/gwt/gen2/demo/fasttree/client/FastTreeDemo.java src/com/google/gwt/gen2/complexpanel/client/FastTree.java src/com/google/gwt/gen2/complexpanel/client/FastTreeItem.java Index: src/com/google/gwt/gen2/complexpanel/client/FastTreeItem.java === --- src/com/google/gwt/gen2/complexpanel/client/FastTreeItem.java (revision 1526) +++ src/com/google/gwt/gen2/complexpanel/client/FastTreeItem.java (working copy) @@ -657,10 +657,11 @@ * it. */ void setSelection(boolean selected, boolean fireEvents) { -tree.beforeSelected(this); -setStyleName(getControlElement(), css.selected(), selected); -if (selected fireEvents) { - onSelected(); +if (!tree.beforeSelected(this).isCanceled()) { + setStyleName(getControlElement(), css.selected(), selected); + if (selected fireEvents) { +onSelected(); + } } } Index: src/com/google/gwt/gen2/complexpanel/client/FastTree.java === --- src/com/google/gwt/gen2/complexpanel/client/FastTree.java (revision 1526) +++ src/com/google/gwt/gen2/complexpanel/client/FastTree.java (working copy) @@ -666,8 +666,8 @@ BeforeOpenEvent.fire(this, fastTreeItem, isFirstTime); } - void beforeSelected(FastTreeItem fastTreeItem) { -BeforeSelectionEvent.fire(this, fastTreeItem); + BeforeSelectionEventFastTreeItem beforeSelected(FastTreeItem fastTreeItem) { +return BeforeSelectionEvent.fire(this, fastTreeItem); } /* Index: src-demo/com/google/gwt/gen2/demo/fasttree/client/FastTreeDemo.java === --- src-demo/com/google/gwt/gen2/demo/fasttree/client/FastTreeDemo.java (revision 1526) +++ src-demo/com/google/gwt/gen2/demo/fasttree/client/FastTreeDemo.java (working copy) @@ -19,6 +19,7 @@ import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.logical.shared.BeforeSelectionEvent; +import com.google.gwt.event.logical.shared.BeforeSelectionHandler; import com.google.gwt.event.logical.shared.CloseEvent; import com.google.gwt.event.logical.shared.CloseHandler; import com.google.gwt.event.logical.shared.OpenEvent; @@ -63,7 +64,8 @@ p.add(lazyTree(), Lazy tree); p.add(verboseTree(), Verbose tree); p.add(crazyTree(), Crazy tree); -p.add(dynamicTree(), DynamicTree); +p.add(dynamicTree(), Dynamic tree); +p.add(cancelEventTree(), Cancel event tree); return p; } @@ -241,6 +243,30 @@ return hebrewTree; } + private Widget cancelEventTree() { +final FastTree cancelEventTree = new FastTree(); +FastTreeItem firstBranch = cancelEventTree.addItem(Select Me!); +firstBranch.addItem(No! Select Me!); +firstBranch.addItem(No! Select Me!); +firstBranch.addItem(No! Select Me!); +FastTreeItem secondBranch = cancelEventTree.addItem(Don't Select me!); +secondBranch.addItem(Not me!); +secondBranch.addItem(Not me!); +secondBranch.addItem(Not me!); + +cancelEventTree.addBeforeSelectionHandler( +new BeforeSelectionHandlerFastTreeItem() { + public void onBeforeSelection(BeforeSelectionEventFastTreeItem event) { + if (!Window.confirm(Continue?)) { +event.cancel(); + } + } +}); + +return cancelEventTree; + } + + private void lazyCreateChild(final HasFastTreeItems parent, final int index, final int children) { --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Respecting onBeforeSelect.cancel
Reviewers: ecc, Description: When beforeSelect is fired check that if cancel is called the tree item doesn't get selected. Please review this at http://gwt-code-reviews.appspot.com/6801 Affected files: src-demo/com/google/gwt/gen2/demo/fasttree/client/FastTreeDemo.java src/com/google/gwt/gen2/complexpanel/client/FastTree.java src/com/google/gwt/gen2/complexpanel/client/FastTreeItem.java Index: src/com/google/gwt/gen2/complexpanel/client/FastTreeItem.java === --- src/com/google/gwt/gen2/complexpanel/client/FastTreeItem.java (revision 1526) +++ src/com/google/gwt/gen2/complexpanel/client/FastTreeItem.java (working copy) @@ -657,10 +657,11 @@ * it. */ void setSelection(boolean selected, boolean fireEvents) { -tree.beforeSelected(this); -setStyleName(getControlElement(), css.selected(), selected); -if (selected fireEvents) { - onSelected(); +if (!tree.beforeSelected(this).isCanceled()) { + setStyleName(getControlElement(), css.selected(), selected); + if (selected fireEvents) { +onSelected(); + } } } Index: src/com/google/gwt/gen2/complexpanel/client/FastTree.java === --- src/com/google/gwt/gen2/complexpanel/client/FastTree.java (revision 1526) +++ src/com/google/gwt/gen2/complexpanel/client/FastTree.java (working copy) @@ -666,8 +666,8 @@ BeforeOpenEvent.fire(this, fastTreeItem, isFirstTime); } - void beforeSelected(FastTreeItem fastTreeItem) { -BeforeSelectionEvent.fire(this, fastTreeItem); + BeforeSelectionEventFastTreeItem beforeSelected(FastTreeItem fastTreeItem) { +return BeforeSelectionEvent.fire(this, fastTreeItem); } /* Index: src-demo/com/google/gwt/gen2/demo/fasttree/client/FastTreeDemo.java === --- src-demo/com/google/gwt/gen2/demo/fasttree/client/FastTreeDemo.java (revision 1526) +++ src-demo/com/google/gwt/gen2/demo/fasttree/client/FastTreeDemo.java (working copy) @@ -19,6 +19,7 @@ import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.logical.shared.BeforeSelectionEvent; +import com.google.gwt.event.logical.shared.BeforeSelectionHandler; import com.google.gwt.event.logical.shared.CloseEvent; import com.google.gwt.event.logical.shared.CloseHandler; import com.google.gwt.event.logical.shared.OpenEvent; @@ -63,7 +64,8 @@ p.add(lazyTree(), Lazy tree); p.add(verboseTree(), Verbose tree); p.add(crazyTree(), Crazy tree); -p.add(dynamicTree(), DynamicTree); +p.add(dynamicTree(), Dynamic tree); +p.add(cancelEventTree(), Cancel event tree); return p; } @@ -241,6 +243,30 @@ return hebrewTree; } + private Widget cancelEventTree() { +final FastTree cancelEventTree = new FastTree(); +FastTreeItem firstBranch = cancelEventTree.addItem(Select Me!); +firstBranch.addItem(No! Select Me!); +firstBranch.addItem(No! Select Me!); +firstBranch.addItem(No! Select Me!); +FastTreeItem secondBranch = cancelEventTree.addItem(Don't Select me!); +secondBranch.addItem(Not me!); +secondBranch.addItem(Not me!); +secondBranch.addItem(Not me!); + +cancelEventTree.addBeforeSelectionHandler( +new BeforeSelectionHandlerFastTreeItem() { + public void onBeforeSelection(BeforeSelectionEventFastTreeItem event) { + if (!Window.confirm(Continue?)) { +event.cancel(); + } + } +}); + +return cancelEventTree; + } + + private void lazyCreateChild(final HasFastTreeItems parent, final int index, final int children) { --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---