On Sun, Sep 21, 2008 at 6:16 AM, Matthew Toseland <toad at amphibian.dyndns.org> wrote: > On Friday 19 September 2008 15:37, Florent Daigniere wrote: >> On Fri, 2008-09-19 at 14:32 +0000, toad at freenetproject.org wrote: >> > Author: toad >> > Date: 2008-09-19 14:32:12 +0000 (Fri, 19 Sep 2008) >> > New Revision: 22701 >> > >> > Modified: >> > trunk/freenet/src/freenet/io/comm/DMT.java >> > Log: >> > Make message priorities start at 0. Add NUM_PRIORITIES. >> > >> > >> > Modified: trunk/freenet/src/freenet/io/comm/DMT.java >> > =================================================================== >> > --- trunk/freenet/src/freenet/io/comm/DMT.java 2008-09-19 13:31:02 UTC > (rev 22700) >> > +++ trunk/freenet/src/freenet/io/comm/DMT.java 2008-09-19 14:32:12 UTC > (rev 22701) >> > @@ -132,20 +132,22 @@ >> > public static final String UPTIME_PERCENT_48H = "uptimePercent48H"; >> > >> > /** Very urgent */ >> > - public static final short PRIORITY_NOW=-2; >> > + public static final short PRIORITY_NOW=0; >> > /** Short timeout, or urgent for other reasons - Accepted, RejectedLoop > etc. */ >> > - public static final short PRIORITY_HIGH=-1; // >> > + public static final short PRIORITY_HIGH=1; // >> > /** Unspecified e.g. test-only messages. */ >> > - public static final short PRIORITY_UNSPECIFIED=0; >> > + public static final short PRIORITY_UNSPECIFIED=2; >> > /** Long timeout (e.g. DataFound), or moderately urgent. */ >> > - public static final short PRIORITY_LOW=1; // long timeout, or >> > moderately > urgent >> > + public static final short PRIORITY_LOW=3; // long timeout, or >> > moderately > urgent >> > /** >> > * Bulk data transfer, bottom of the heap, high level limiting must > ensure there is time to send it by >> > * not accepting an infeasible number of requests; starvation will >> > cause > bwlimitDelayTime to go high and >> > * requests to be rejected. That's the ultimate limiter if even output > bandwidth liability fails. >> > */ >> > - public static final short PRIORITY_BULK_DATA=2; >> > + public static final short PRIORITY_BULK_DATA=4; >> > >> > + public static final short NUM_PRIORITIES = 5; >> > + >> > // Assimilation >> > >> > // New data transmission messages >> >> What about using enums here? > > Good idea ... can we index an array by an enum or do we need to use a map? I > suppose we can have an integer member.
use ENUM.ordinal()
