+ You are visible to other peers and contact them to distribute your presence.
+ Your peer does not accept any outside index data, but responds on all remote search requests.
+
#[cluster.peers.yacydomain.hashes]#
-
-
-
-
-
- You are visible to other peers and contact them to distribute your presence.
- Your peer does not accept any outside index data, but responds on all remote search requests.
-
When you allow access from the YaCy network, your data is recognized using keywords.
diff --git a/source/de/anomic/server/serverAbstractSwitch.java b/source/de/anomic/server/serverAbstractSwitch.java
index 890039cb1..51258a935 100644
--- a/source/de/anomic/server/serverAbstractSwitch.java
+++ b/source/de/anomic/server/serverAbstractSwitch.java
@@ -43,7 +43,6 @@ package de.anomic.server;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -151,40 +150,37 @@ public abstract class serverAbstractSwitch implements serverSwitch {
public void track(String host, String accessPath) {
// learn that a specific host has accessed a specific path
- ArrayList access = (ArrayList) accessTracker.get(host);
- if (access == null) access = new ArrayList();
- access.add(new serverTrack(accessPath));
+ if (accessPath == null) accessPath="NULL";
+ TreeMap access = (TreeMap) accessTracker.get(host);
+ if (access == null) access = new TreeMap();
+ access.put(new Long(System.currentTimeMillis()), accessPath);
- // clear too old entries
- clearTooOldAccess(access);
-
// write back to tracker
- accessTracker.put(host, access);
+ accessTracker.put(host, clearTooOldAccess(access));
}
- public ArrayList accessTrack(String host) {
+ public TreeMap accessTrack(String host) {
// returns mapping from Long(accesstime) to path
- ArrayList access = (ArrayList) accessTracker.get(host);
+ TreeMap access = (TreeMap) accessTracker.get(host);
if (access == null) return null;
// clear too old entries
- if (clearTooOldAccess(access)) {
+ int oldsize = access.size();
+ if ((access = clearTooOldAccess(access)).size() != oldsize) {
// write back to tracker
- accessTracker.put(host, access);
+ if (access.size() == 0) {
+ accessTracker.remove(host);
+ } else {
+ accessTracker.put(host, access);
+ }
}
return access;
}
- private boolean clearTooOldAccess(ArrayList access) {
- boolean changed = false;
- while ((access.size() > 0) &&
- (((serverTrack) access.get(0)).time < (System.currentTimeMillis() - maxTrackingTime))) {
- access.remove(0);
- changed = true;
- }
- return changed;
+ private TreeMap clearTooOldAccess(TreeMap access) {
+ return new TreeMap(access.tailMap(new Long(System.currentTimeMillis() - maxTrackingTime)));
}
public Iterator accessHosts() {
diff --git a/source/de/anomic/server/serverSwitch.java b/source/de/anomic/server/serverSwitch.java
index d4f55e766..f1573e157 100644
--- a/source/de/anomic/server/serverSwitch.java
+++ b/source/de/anomic/server/serverSwitch.java
@@ -50,9 +50,10 @@
package de.anomic.server;
import java.net.InetAddress;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
+import java.util.TreeMap;
+
import de.anomic.server.logging.serverLog;
public interface serverSwitch {
@@ -66,7 +67,7 @@ public interface serverSwitch {
// access tracker
public void track(String host, String accessPath); // learn that a specific host has accessed a specific path
- public ArrayList accessTrack(String host); // returns mapping from Long(accesstime) to path
+ public TreeMap accessTrack(String host); // returns mapping from Long(accesstime) to path
public Iterator accessHosts(); // returns an iterator of hosts in tracker (String)
// a switchboard can have action listener
diff --git a/source/de/anomic/server/serverTrack.java b/source/de/anomic/server/serverTrack.java
deleted file mode 100644
index 49178b8df..000000000
--- a/source/de/anomic/server/serverTrack.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// serverTrack.java
-// (C) 2007 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
-// first published 11.06.2007 on http://yacy.net
-//
-// This is a part of YaCy, a peer-to-peer based web search engine
-//
-// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
-// $LastChangedRevision: 1986 $
-// $LastChangedBy: orbiter $
-//
-// LICENSE
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-package de.anomic.server;
-
-public class serverTrack {
-
- public long time; // access time
- public String path;
-
- public serverTrack(String path) {
- this.time = System.currentTimeMillis();
- this.path = path;
- }
-
-}