X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2FUpdateMessageBroker.java;h=16599735a80fc831ede28f72241f1310f42a3bb7;hb=96b13866faa7559233689ce73e9de8041859bc2f;hp=b584ed88384249eb5a639e8dfec993b6c61b4df8;hpb=a6197ddcaac11c0b943183da7d46169742d024af;p=GpsPrune.git diff --git a/tim/prune/UpdateMessageBroker.java b/tim/prune/UpdateMessageBroker.java index b584ed8..1659973 100644 --- a/tim/prune/UpdateMessageBroker.java +++ b/tim/prune/UpdateMessageBroker.java @@ -6,11 +6,11 @@ package tim.prune; */ public abstract class UpdateMessageBroker { - private static final int MAXIMUM_NUMBER_SUBSCRIBERS = 7; + private static final int MAXIMUM_NUMBER_SUBSCRIBERS = 8; /** Array of all subscribers */ private static DataSubscriber[] _subscribers = new DataSubscriber[MAXIMUM_NUMBER_SUBSCRIBERS]; - /** Counter of the number of subscribers added so far */ - private static int _subscriberNum = 0; + /** Index from which to start looking for an empty slot*/ + private static int _searchStartIndex = 0; /** Enable/disabled flag */ private static boolean _enabled = true; @@ -21,8 +21,33 @@ public abstract class UpdateMessageBroker */ public static void addSubscriber(DataSubscriber inSub) { - _subscribers[_subscriberNum] = inSub; - _subscriberNum++; + // Loop looking for first null entry + for (int i=_searchStartIndex; i