Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Multiple Notifiers Support (Range and Monitor) #392

Merged
merged 4 commits into from Jun 24, 2016

Conversation

herow-io
Copy link

Re-do the job done by @Maxeee09 in this pull request with a correct code style

@@ -109,9 +109,9 @@
protected static BeaconManager client = null;
private final ConcurrentMap<BeaconConsumer, ConsumerInfo> consumers = new ConcurrentHashMap<BeaconConsumer,ConsumerInfo>();
private Messenger serviceMessenger = null;
protected RangeNotifier rangeNotifier = null;
protected final List<RangeNotifier> rangeNotifiers = new CopyOnWriteArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good if these collections were based on Set not List. Because if folks repeatedly call addXxxNotifier() with the same object, it could cause trouble. Making this change could protect against this. Perhaps use ConcurrentHashMap.newKeySet()?

Copy link
Author

Choose a reason for hiding this comment

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

I think to use an CopyOnWriteArraySet. What do you think?

As consequences, the getMonitorNotifier() and the getRangeNotifier() method are irrelevants. Do you want to keep them or can I remove them ?
(I think these methods are only useful internally to the library. They are not in usage any more inside the library)

Copy link
Member

Choose a reason for hiding this comment

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

We do need to keep getMonitorNotifier() and getRangeNotifier() so that this is not a breaking API change. I think a CopyOnWriteArraySet is probably fine.

@davidgyoung
Copy link
Member

@OPscT, do you need the RegionRangeNotifier and RegionMonitorNotifier classes? I know they were part of the original PR, but they are not referenced by any of the other files, and they appear to me to be utility classes. They might be useful, but probably won't be unless there is documentation and code examples to go with them. I'd be inclined to remove them (and RegionFilter which is their dependency) unless somebody can make the case for them.

Sorry to make you spin your wheels on this -- I know this is not your original PR. I appreciate your help.

@herow-io
Copy link
Author

The update has been done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants