Mercurial > hg > blitz_condensed
comparison src/org/dancres/blitz/entry/LeaseTrackerFactory.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.entry; | |
2 | |
3 import java.io.IOException; | |
4 | |
5 import org.dancres.blitz.lease.LeaseReaper; | |
6 import org.dancres.blitz.lease.ReapFilter; | |
7 | |
8 import org.dancres.blitz.oid.Allocator; | |
9 | |
10 class LeaseTrackerFactory { | |
11 /** | |
12 Create a LeaseTracker capable of managing all leases for a particular | |
13 entry type which is using a particular Allocator instance to assign ids. | |
14 */ | |
15 static LeaseTracker getTracker(String aType, Allocator anAllocator) | |
16 throws IOException { | |
17 | |
18 if (EntryRepositoryFactory.getReaper().isActive()) | |
19 return new LeaseTrackerImpl(aType, | |
20 anAllocator.getMaxZoneId()); | |
21 else | |
22 return new NullTrackerImpl(aType); | |
23 } | |
24 | |
25 private static class NullTrackerImpl implements LeaseTracker { | |
26 private String theType; | |
27 | |
28 NullTrackerImpl(String aType) { | |
29 // System.err.println("NullTracker: " + aType); | |
30 theType = aType; | |
31 } | |
32 | |
33 public void bringOutTheDead(EntryReaper aReaper) { | |
34 // Do nothing | |
35 } | |
36 | |
37 public void delete(PersistentEntry anEntry) throws IOException { | |
38 // Do nothing | |
39 } | |
40 | |
41 public void update(PersistentEntry anEntry) throws IOException { | |
42 // Do nothing | |
43 } | |
44 | |
45 public void write(PersistentEntry anEntry) throws IOException { | |
46 // Do nothing | |
47 } | |
48 | |
49 public void close() throws IOException { | |
50 // Do nothing | |
51 } | |
52 | |
53 public void delete() throws IOException { | |
54 // Do nothing | |
55 } | |
56 } | |
57 } |