Changeset a82de3d


Ignore:
Timestamp:
Feb 4, 2009 5:18:00 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
a7d4b3d
Parents:
a6dc27a
Message:

Netdb: Remove all DataPublisher? stuff

Location:
router/java/src/net/i2p/router/networkdb/kademlia
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    ra6dc27a ra82de3d  
    5454    /** where the data store is pushing the data */
    5555    private String _dbDir;
    56     private Set _explicitSendKeys; // set of Hash objects that should be published ASAP
    57     private Set _passiveSendKeys; // set of Hash objects that should be published when there's time
    5856    private Set _exploreKeys; // set of Hash objects that we should search on (to fill up a bucket, not to get data)
    59     private Map _lastSent; // Hash to Long (date last sent, or <= 0 for never)
    6057    private boolean _initialized;
    6158    /** Clock independent time of when we started up */
     
    154151    }
    155152   
    156     public Set getExplicitSendKeys() {
    157         if (!_initialized) return null;
    158         synchronized (_explicitSendKeys) {
    159             return new HashSet(_explicitSendKeys);
    160         }
    161     }
    162     public Set getPassivelySendKeys() {
    163         if (!_initialized) return null;
    164         synchronized (_passiveSendKeys) {
    165             return new HashSet(_passiveSendKeys);
    166         }
    167     }
    168     public void removeFromExplicitSend(Set toRemove) {
    169         if (!_initialized) return;
    170         synchronized (_explicitSendKeys) {
    171             _explicitSendKeys.removeAll(toRemove);
    172         }
    173     }
    174     public void removeFromPassiveSend(Set toRemove) {
    175         if (!_initialized) return;
    176         synchronized (_passiveSendKeys) {
    177             _passiveSendKeys.removeAll(toRemove);
    178         }
    179     }
    180     public void queueForPublishing(Set toSend) {
    181         if (!_initialized) return;
    182         synchronized (_passiveSendKeys) {
    183             _passiveSendKeys.addAll(toSend);
    184         }
    185     }
    186    
    187     public Long getLastSent(Hash key) {
    188         if (!_initialized) return null;
    189         synchronized (_lastSent) {
    190             if (!_lastSent.containsKey(key))
    191                 _lastSent.put(key, new Long(0));
    192             return (Long)_lastSent.get(key);
    193         }
    194     }
    195    
    196     public void noteKeySent(Hash key) {
    197         if (!_initialized) return;
    198         synchronized (_lastSent) {
    199             _lastSent.put(key, new Long(_context.clock().now()));
    200         }
    201     }
    202    
    203153    public Set getExploreKeys() {
    204154        if (!_initialized) return null;
     
    227177        _kb = null;
    228178        _ds = null;
    229         _explicitSendKeys = null;
    230         _passiveSendKeys = null;
    231179        _exploreKeys = null;
    232         _lastSent = null;
    233180    }
    234181   
     
    245192            _enforceNetId = DEFAULT_ENFORCE_NETID;
    246193        _ds.restart();
    247         synchronized (_explicitSendKeys) { _explicitSendKeys.clear(); }
    248194        synchronized (_exploreKeys) { _exploreKeys.clear(); }
    249         synchronized (_passiveSendKeys) { _passiveSendKeys.clear(); }
    250195
    251196        _initialized = true;
     
    274219        _ds = new PersistentDataStore(_context, dbDir, this);
    275220        //_ds = new TransientDataStore();
    276         _explicitSendKeys = new HashSet(64);
    277         _passiveSendKeys = new HashSet(64);
    278221        _exploreKeys = new HashSet(64);
    279         _lastSent = new HashMap(1024);
    280222        _dbDir = dbDir;
    281223       
     
    285227        _started = System.currentTimeMillis();
    286228       
    287         // read the queues and publish appropriately
    288         if (false)
    289             _context.jobQueue().addJob(new DataPublisherJob(_context, this));
    290229        // expire old leases
    291230        _context.jobQueue().addJob(new ExpireLeasesJob(_context, this));
     
    299238       
    300239        if (!_quiet) {
    301             // fill the passive queue periodically
    302             // Is this pointless too???
    303             _context.jobQueue().addJob(new DataRepublishingSelectorJob(_context, this));
    304240            // fill the search queue with random keys in buckets that are too small
    305241            // Disabled since KBucketImpl.generateRandomKey() is b0rked,
     
    533469            return;
    534470       
    535         synchronized (_explicitSendKeys) {
    536             _explicitSendKeys.add(h);
    537         }
    538471        RepublishLeaseSetJob j = null;
    539472        synchronized (_publishingLeaseSets) {
     
    564497        Hash h = localRouterInfo.getIdentity().getHash();
    565498        store(h, localRouterInfo);
    566         synchronized (_explicitSendKeys) {
    567             _explicitSendKeys.add(h);
    568         }
    569499    }
    570500
     
    659589       
    660590        _ds.put(key, leaseSet);
    661         synchronized (_lastSent) {
    662             if (!_lastSent.containsKey(key))
    663                 _lastSent.put(key, new Long(0));
    664         }
    665591       
    666592        // Iterate through the old failure / success count, copying over the old
     
    771697        _context.peerManager().setCapabilities(key, routerInfo.getCapabilities());
    772698        _ds.put(key, routerInfo);
    773         synchronized (_lastSent) {
    774             if (!_lastSent.containsKey(key))
    775                 _lastSent.put(key, new Long(0));
    776         }
    777699        if (rv == null)
    778700            _kb.add(key);
     
    809731        else
    810732            _ds.removeLease(dbEntry);
    811         synchronized (_lastSent) {
    812             _lastSent.remove(dbEntry);
    813         }
    814         synchronized (_explicitSendKeys) {
    815             _explicitSendKeys.remove(dbEntry);
    816         }
    817         synchronized (_passiveSendKeys) {
    818             _passiveSendKeys.remove(dbEntry);
    819         }
    820733    }
    821734   
     
    834747       
    835748        _ds.remove(peer);
    836         synchronized (_lastSent) {
    837             _lastSent.remove(peer);
    838         }
    839         synchronized (_explicitSendKeys) {
    840             _explicitSendKeys.remove(peer);
    841         }
    842         synchronized (_passiveSendKeys) {
    843             _passiveSendKeys.remove(peer);
    844         }
    845749    }
    846750   
     
    849753        Hash h = localLeaseSet.getDestination().calculateHash();
    850754        DataStructure data = _ds.remove(h);
    851         synchronized (_lastSent) {
    852             _lastSent.remove(h);
    853         }
    854         synchronized (_explicitSendKeys) {
    855             _explicitSendKeys.remove(h);
    856         }
    857         synchronized (_passiveSendKeys) {
    858             _passiveSendKeys.remove(h);
    859         }
    860755       
    861756        if (data == null) {
  • router/java/src/net/i2p/router/networkdb/kademlia/StoreJob.java

    ra6dc27a ra82de3d  
    438438        if (_onSuccess != null)
    439439            getContext().jobQueue().addJob(_onSuccess);
    440         _facade.noteKeySent(_state.getTarget());
    441440        _state.complete(true);
    442441        getContext().statManager().addRateData("netDb.storePeers", _state.getAttempted().size(), _state.getWhenCompleted()-_state.getWhenStarted());
Note: See TracChangeset for help on using the changeset viewer.