We're updating the issue view to help you get more done. 

ExternalComponent#connectionLost is not thread safe

Description

If two or more different threads detect that the socket is broken they will attempt to open a new connection. Only one will succeed and the rest will stay in the loop forever printing the following exception:

[java] Error trying to reconnect with the server
[java] org.xmpp.component.ComponentException: conflict
[java] at org.jivesoftware.whack.ExternalComponent.connect(ExternalComponent.java:205)
[java] at org.jivesoftware.whack.ExternalComponent.connectionLost(ExternalComponent.java:384)
[java] at org.jivesoftware.whack.ExternalComponent.send(ExternalComponent.java:318)
[java] at org.jivesoftware.whack.ExternalComponentManager.sendPacket(ExternalComponentManager.java:203)
[java] at com.jivesoftware.community.xmpp.ClearspaceComponent.send(ClearspaceComponent.java:179)
[java] at com.jivesoftware.community.xmpp.ClearspaceComponent.processIQ(ClearspaceComponent.java:161)
[java] at com.jivesoftware.community.xmpp.ClearspaceComponent.processPacket(ClearspaceComponent.java:49)
[java] at org.jivesoftware.whack.ExternalComponent$1.run(ExternalComponent.java:300)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
[java] at java.lang.Thread.run(Thread.java:619)

Moreover, the thread that created the new connection could not be accessible from the component. Thus leaving the external component with no connectivity to the server

Environment

None

Acceptance Test - Entry

None
Fixed

Assignee

Gaston Dombiak

Reporter

Gaston Dombiak

Labels

None

Expected Effort

None

Ignite Forum URL

None

Components

Priority

Major
Configure