[jbosstools-issues] [JBoss JIRA] (JBIDE-18737) Server's XML configuration does not contain Ports in Servers view

Lucia Jelinkova (JIRA) issues at jboss.org
Fri Dec 5 08:42:39 EST 2014


    [ https://issues.jboss.org/browse/JBIDE-18737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025511#comment-13025511 ] 

Lucia Jelinkova commented on JBIDE-18737:
-----------------------------------------

I tried to debug as you suggested and I found out that the job runs OK and the XPath categories are loaded correctly. 

However, I also found out there's a racing condition when sometimes another thread "removes" loaded categories that are cached in the map. it seems that when a server is created two events are fired:

- serverAdded - it loads the categories and stores them in XPathModel.serverToCategories map
- serverChanged - it access the XPathModel.serverToCategories map and clears cache for each server

These events are handled in separate threads and the problem occured when the "serverChanged" thread called the following method:

{code}
protected ArrayList<XPathCategory> getCategoryCollection(IServer server) {
   if( serverToCategories.get(server.getId()) == null ) {
	ArrayList<XPathCategory> val = new ArrayList<XPathCategory>(Arrays.asList(load(server)));
	serverToCategories.put(server.getId(), val);
   }
   return (ArrayList<XPathCategory>)serverToCategories.get(server.getId());		
}
{code}

# serverChanged thread called the method
# serverChanged thread executed condition serverToCategories.get(server.getId()) == nul
# serverAdded thread loaded and stored values in serverToCategories
# serverChanged thread rewrote the value in serverToCategories to empty array

I have not checked why there are two events created yet. However, the access to the map should be synchronized probably. It might be even sufficient if the method changed like this (but I have not run your junit tests to make sure). My UI tests seem to pass. 

{code}
protected ArrayList<XPathCategory> getCategoryCollection(IServer server) {
		if(serverToCategories.get(server.getId()) == null ) {
			new ArrayList<XPathCategory>();
		}
		return (ArrayList<XPathCategory>)serverToCategories.get(server.getId());		
	}
{code}

> Server's XML configuration does not contain Ports in Servers view
> -----------------------------------------------------------------
>
>                 Key: JBIDE-18737
>                 URL: https://issues.jboss.org/browse/JBIDE-18737
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 4.2.0.Final
>            Reporter: Lucia Jelinkova
>            Priority: Minor
>         Attachments: createServer.png
>
>
> In my automated tests, I often run on the issue on the Servers view, that the server does not have anyting under the XML configuration (no Ports). It happens 1 out of 3 times. See screenshot attached. The Ports do not appear even if I collapse the server's tree and expand it again. 
> I was not able to reproduce this manually. Do you have any idea where the problem could be? Is thare anything special about the Ports that could cause this issue?



--
This message was sent by Atlassian JIRA
(v6.3.8#6338)


More information about the jbosstools-issues mailing list