This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 186554 - [69cat] IllegalStateException: Too many org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$3 (3) in shared RequestProcessor; create your own
Summary: [69cat] IllegalStateException: Too many org.netbeans.modules.maven.j2ee.web.W...
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-23 10:44 UTC by big_al
Modified: 2010-08-18 03:22 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 170003


Attachments
stacktrace (3.86 KB, text/plain)
2010-05-23 10:44 UTC, big_al
Details

Note You need to log in before you can comment on or make changes to this bug.
Description big_al 2010-05-23 10:44:15 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-5216-on-100521)
VM: Java HotSpot(TM) 64-Bit Server VM, 14.3-b01-101, Java(TM) SE Runtime Environment, 1.6.0_17-b04-248-10M3025
OS: Mac OS X

User Comments:
big_al: Right clicked a file in the Projects view




Stacktrace: 
java.lang.IllegalStateException: Too many org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$3 (3) in shared RequestProcessor; create your own
   at org.openide.util.RequestProcessor.post(RequestProcessor.java:422)
   at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider.setServletClasses(WebReplaceTokenProvider.java:383)
   at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider.isServletFile(WebReplaceTokenProvider.java:294)
   at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider.convert(WebReplaceTokenProvider.java:236)
   at org.netbeans.modules.maven.ActionProviderImpl.isActionEnabled(ActionProviderImpl.java:340)
   at org.netbeans.modules.project.ui.actions.ActionsUtil.commandSupported(ActionsUtil.java:153)
Comment 1 big_al 2010-05-23 10:44:19 UTC
Created attachment 99352 [details]
stacktrace
Comment 2 David Konecny 2010-07-05 01:27:45 UTC
Denis, could you have a look at this issue please. I thought it would be trivial but I've got lost and you seem to be the person who introduced threading in that class. I can understand what class was doing before your changes and that checking if it is a servlet in AWT thread was bad. What I do not understand now is for example code:

if ( fo.getAttribute(ATTR_EXECUTION_URI) == null && servletFilesScanning( fo )){
  return null;
}

it does not take into account fo, for example calling convert("action1", lookupWithFileObjectOne) will start scanning for FileObjectOne and return null but if I call immediately after that convert("action2", lookupWithFileObjectTwo) then outcome of above condition will depend on state of scanning of  FileObjectOne, no? Maybe I should just drop it and have a look at it tomorrow but I cannot grasp what's happening. I was expecting to see something quite straightforward: if we do not have info on whether java file is servlet then just return null and start isServlet check on background. Next time somebody asks the same question the answer already will be available or we will know that a task is scheduled to test it and nothing needs to be done.

Thanks for shedding some light on this. :-)
Comment 3 Denis Anisimov 2010-07-07 07:23:09 UTC
Sorry for late response David.
I've got a flue and still sick.
So my explanation could be not so clear.

This code is required because of performance of checking servlet classes.
Such checking doesn't depend on method parameters.
Servlet checking is done via asking Web metamodel about available servlets.
It's OK to call metamodel methods in AWT thread if metamodel ALREADY has
information about available servlets in project based on original project state.
I mean here : user could add servlet into the project when the project is already 
opened . In this case metamodel will update its information via listener methods
and access to servlets via metamodel is not expensive.
If there were no calls to servlets information then first call will be very 
expensive.
So what the code is doing :
1) checks whether servlet attribute was set or servlet files scanning in the 
progress ( someone ask metamodel about servlets ). It means that metamodel
doesn't have yet information about servlets . We agree with Petr J that
in this case one should just return.
2) method servletFilesScanning() start this scan in the separate thread.
3) When scanning will be finished new "convert" method call can ask metamodel 
directly.

Actually for me it looks exactly the same as you described in the last comment.
Probably you need to check servletFilesScanning() method implementation.
In case you care about FileObject parameter of servletFilesScanning ( that they 
can be different ) : it is used mostly for finding WebModule instance.
Just check isServletFile() method. 
It is used also for calling setServletClasses method at the end of scanning in the separate thread .
Comment 4 Denis Anisimov 2010-08-17 09:59:54 UTC
changeset:   175654:612ff91189f7
user:        Denis Anisimov <ads@netbeans.org>
date:        Mon Aug 16 22:43:35 2010 +0400
summary:     Fix for BZ#186554 -  [69cat] IllegalStateException: Too many org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$3 (3) in shared RequestProcessor; create your own
Comment 5 Quality Engineering 2010-08-18 03:22:51 UTC
Integrated into 'main-golden', will be available in build *201008180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/612ff91189f7
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#186554 -  [69cat] IllegalStateException: Too many org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$3 (3) in shared RequestProcessor; create your own