X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2FUpdateMessageBroker.java;h=16599735a80fc831ede28f72241f1310f42a3bb7;hb=ff33ebba6b7c62834f6dae16ce33eb2c710b160e;hp=337fc27967712542addcde896b07568558058d03;hpb=140e9d165f85c3d4f0435a311e091209313faa2a;p=GpsPrune.git diff --git a/tim/prune/UpdateMessageBroker.java b/tim/prune/UpdateMessageBroker.java index 337fc27..1659973 100644 --- a/tim/prune/UpdateMessageBroker.java +++ b/tim/prune/UpdateMessageBroker.java @@ -6,9 +6,13 @@ package tim.prune; */ public abstract class UpdateMessageBroker { - private static final int MAXIMUM_NUMBER_SUBSCRIBERS = 6; + private static final int MAXIMUM_NUMBER_SUBSCRIBERS = 8; + /** Array of all subscribers */ private static DataSubscriber[] _subscribers = new DataSubscriber[MAXIMUM_NUMBER_SUBSCRIBERS]; - 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; /** @@ -17,10 +21,43 @@ 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