Minor code cleanup

This commit is contained in:
Andrew Shvayka 2017-02-22 14:08:51 +02:00
parent e3c823ef37
commit abee0ea2d9
2 changed files with 4 additions and 11 deletions

View File

@ -95,12 +95,10 @@ public class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcesso
} }
private void refreshAttributes(DeviceAttributesEventNotificationMsg msg) { private void refreshAttributes(DeviceAttributesEventNotificationMsg msg) {
if (this.deviceAttributes != null) { if (msg.isDeleted()) {
if (msg.isDeleted()) { msg.getDeletedKeys().forEach(key -> deviceAttributes.remove(key));
msg.getDeletedKeys().forEach(key -> deviceAttributes.remove(key)); } else {
} else { deviceAttributes.update(msg.getScope(), msg.getValues());
deviceAttributes.update(msg.getScope(), msg.getValues());
}
} }
} }
@ -206,7 +204,6 @@ public class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcesso
} }
void processAttributesUpdate(ActorContext context, DeviceAttributesEventNotificationMsg msg) { void processAttributesUpdate(ActorContext context, DeviceAttributesEventNotificationMsg msg) {
//TODO: improve this procedure to fetch only changed attributes and support attributes deletion
refreshAttributes(msg); refreshAttributes(msg);
Set<AttributeKey> keys = msg.getDeletedKeys(); Set<AttributeKey> keys = msg.getDeletedKeys();
if (attributeSubscriptions.size() > 0) { if (attributeSubscriptions.size() > 0) {

View File

@ -22,10 +22,6 @@ import com.google.common.util.concurrent.AbstractFuture;
*/ */
public class SimpleListenableFuture<V> extends AbstractFuture<V> { public class SimpleListenableFuture<V> extends AbstractFuture<V> {
public SimpleListenableFuture() {
}
public boolean set(V value) { public boolean set(V value) {
return super.set(value); return super.set(value);
} }