Mercurial > hg > blitz_condensed
comparison src/org/dancres/blitz/lease/LeaseBounds.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 package org.dancres.blitz.lease; | |
2 | |
3 import java.util.logging.*; | |
4 | |
5 import net.jini.config.ConfigurationException; | |
6 | |
7 import org.dancres.blitz.Logging; | |
8 | |
9 import org.dancres.blitz.util.Time; | |
10 | |
11 import org.dancres.blitz.config.ConfigurationFactory; | |
12 | |
13 /** | |
14 Responsible for handling bounding of lease durations based on configuration | |
15 items <code>notifyLeaseBound</code> and <code>entryLeaseBound</code> | |
16 */ | |
17 public class LeaseBounds { | |
18 private static Logger theLogger = | |
19 Logging.newLogger("org.dancres.blitz.lease.LeaseBounds"); | |
20 | |
21 private static long theNotifyBound; | |
22 private static long theEntryBound; | |
23 private static long theViewBound; | |
24 private static long theTxnBound; | |
25 | |
26 static { | |
27 try { | |
28 theNotifyBound = | |
29 ((Long) ConfigurationFactory.getEntry("notifyLeaseBound", | |
30 long.class, | |
31 new Long(0))).longValue(); | |
32 theEntryBound = | |
33 ((Long) ConfigurationFactory.getEntry("entryLeaseBound", | |
34 long.class, | |
35 new Long(0))).longValue(); | |
36 theViewBound = | |
37 ((Long) ConfigurationFactory.getEntry("viewLeaseBound", | |
38 long.class, | |
39 new Long(0))).longValue(); | |
40 theTxnBound = | |
41 ((Long) ConfigurationFactory.getEntry("loopbackTxnLeaseBound", | |
42 long.class, | |
43 new Long(0))).longValue(); | |
44 | |
45 theLogger.log(Level.INFO, "LeaseBounds: " + theNotifyBound + | |
46 ", " + theEntryBound + ", " + theViewBound + ", " + | |
47 theTxnBound); | |
48 | |
49 } catch (ConfigurationException aCE) { | |
50 theLogger.log(Level.SEVERE, "Got config problem", aCE); | |
51 } | |
52 } | |
53 | |
54 public static long boundWrite(long aLeaseDuration) { | |
55 return Time.getLeaseDuration(aLeaseDuration, theEntryBound); | |
56 } | |
57 | |
58 public static long boundNotify(long aLeaseDuration) { | |
59 return Time.getLeaseDuration(aLeaseDuration, theNotifyBound); | |
60 } | |
61 | |
62 public static long boundView(long aLeaseDuration) { | |
63 return Time.getLeaseDuration(aLeaseDuration, theViewBound); | |
64 } | |
65 | |
66 public static long boundTxn(long aLeaseDuration) { | |
67 return Time.getLeaseDuration(aLeaseDuration, theTxnBound); | |
68 } | |
69 } |