这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.

Conversation

@wborn
Copy link
Member

@wborn wborn commented Nov 29, 2016

This PR fixes some exceptions that are occasionally thrown when the binding is started. Some examples of these stacktraces are:

17:25:58.113 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler, id=294, bundle=200/mvn:org.openhab.binding/org.openhab.binding.plugwise/1.9.0-SNAPSHOT]: Unexpected problem updating configuration org.openhab.plugwise
java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)[:1.8.0_65]
	at java.util.ArrayList$Itr.next(ArrayList.java:851)[:1.8.0_65]
	at org.openhab.binding.plugwise.internal.Stick.getDeviceByMAC(Stick.java:148)[200:org.openhab.binding.plugwise:1.9.0.201611250210]
	at org.openhab.binding.plugwise.internal.PlugwiseBinding.setupNonStickDevices(PlugwiseBinding.java:149)[200:org.openhab.binding.plugwise:1.9.0.201611250210]
	at org.openhab.binding.plugwise.internal.PlugwiseBinding.updated(PlugwiseBinding.java:99)[200:org.openhab.binding.plugwise:1.9.0.201611250210]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1444)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1400)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:143)[7:org.apache.felix.configadmin:1.8.8]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:110)[7:org.apache.felix.configadmin:1.8.8]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]


18:08:57.391 [ERROR] [nhab.binding.plugwise.internal.Stick] - SendJob: unexpected error
java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)[:1.8.0_65]
	at java.util.ArrayList$Itr.next(ArrayList.java:851)[:1.8.0_65]
	at org.openhab.binding.plugwise.internal.Stick.getDeviceByMAC(Stick.java:148)[200:org.openhab.binding.plugwise:1.9.0.201611250210]
	at org.openhab.binding.plugwise.internal.Stick.processMessage(Stick.java:566)[200:org.openhab.binding.plugwise:1.9.0.201611250210]
	at org.openhab.binding.plugwise.internal.Stick$ProcessMessageThread.processMessage(Stick.java:763)[200:org.openhab.binding.plugwise:1.9.0.201611250210]
	at org.openhab.binding.plugwise.internal.Stick$ProcessMessageThread.run(Stick.java:745)[200:org.openhab.binding.plugwise:1.9.0.201611250210]

The Plugwise device cache is improved as follows:

  • Concurrent hash maps are used to resolve the exceptions and improve performance
  • Logic is extracted into a new PlugwiseDeviceCache object
  • PlugwiseDeviceCache object is now private to the Stick so other objects interact with it in a consistent way (through the Stick)

Signed-off-by: Wouter Born <github@maindrain.net>
Copy link
Contributor

@watou watou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice cleanup, thanks!

/**
* Caches all {@link PlugwiseDevice} instances and allows for querying them by mac, name and device class.
*
* @author Wouter Born
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add @since 1.9.0

@watou watou added the bug label Nov 29, 2016
@watou watou added this to the 1.9.0 milestone Nov 29, 2016
Signed-off-by: Wouter Born <github@maindrain.net>
@watou watou merged commit 83bdf8c into openhab:master Dec 2, 2016
@watou
Copy link
Contributor

watou commented Dec 2, 2016

Thanks @wborn!

@wborn
Copy link
Member Author

wborn commented Dec 2, 2016

Thank you too @watou!

@wborn wborn deleted the plugwise-bugfix branch December 15, 2016 20:59
mvolaart pushed a commit to mvolaart/openhab that referenced this pull request Dec 23, 2016
…penhab#4842)

* [Plugwise] Fix exceptions at binding startup, improve device cache

Signed-off-by: Wouter Born <github@maindrain.net>

* Add @SInCE 1.9.0 to PlugwiseDeviceCache

Signed-off-by: Wouter Born <github@maindrain.net>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants