Hi, guys i'm new and i'm not english. I have a problem with using js setInterval that simulate a user click, every X seconds, on submit button. In the page there is only one h:form and h:commandButton. I use a profiler and i see that the java.util.HashMap increase continuosly it's size. After some hours the used heap size is growed a lot respect the start point.
Please help me, this problem make me crazy.
This is the code:
<?xml version = "1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<script type="text/javascript">
var timeoutId = window.setInterval( "userClick()" , 1000 );
</script>
</h:head>
<h:body>
<h:panelGroup id="testo">test</h:panelGroup>
<h:form prependId="false" >
<h:commandButton id="buttonId"
action="null"
value="Invia">
<f:ajax event="click" execute="@form" render=":testo"/>
</h:commandButton>
</h:form>
<script type="text/javascript">
function userClick()
{
document.getElementById('buttonId').click();
}
</script>
</h:body>
</html>
Update: After 1 days the application crash again. Now I have used only the setInterval but i have the heapDump generated by glassfish this is the screenshot but i'm unable to post it because my reputation is too low. however java.lang.Object[] consume 20% of heap, java.util.HashMap$Entry[]18% and HashMap 10% Any idea?
Update: Hi, guys i have solved my problem and have found a bug in CDI dependency/injection. I have solved my problem changing the Annotation @Named with @ManagedBean and this solve my problem. In the example i have omitted the code because i think that CDI haven't bug. Obviously the Bean annotated with @Named have request Scoped while the ApplicationScoped Bean doesn't produce the bug. I'm relatively new with CDI, so where i must report the bug?