* ProfileOrganizerRenderer:

- Move to routerconsole
      - Write directly to Writer for speed
This commit is contained in:
zzz
2009-10-15 22:42:22 +00:00
parent fdc9e11fb4
commit fa6d17a1b8
7 changed files with 15 additions and 20 deletions

View File

@ -1,4 +1,4 @@
package net.i2p.router.peermanager;
package net.i2p.router.web;
import java.io.IOException;
import java.io.Writer;
@ -12,6 +12,9 @@ import net.i2p.data.DataHelper;
import net.i2p.data.Hash;
import net.i2p.data.RouterInfo;
import net.i2p.router.RouterContext;
import net.i2p.router.peermanager.DBHistory;
import net.i2p.router.peermanager.PeerProfile;
import net.i2p.router.peermanager.ProfileOrganizer;
import net.i2p.stat.Rate;
import net.i2p.stat.RateStat;

View File

@ -1,30 +1,29 @@
package net.i2p.router.web;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
public class ProfilesHelper extends HelperBase {
public ProfilesHelper() {}
/** @return empty string, writes directly to _out */
public String getProfileSummary() {
ByteArrayOutputStream baos = new ByteArrayOutputStream(16*1024);
try {
_context.profileOrganizer().renderStatusHTML(new OutputStreamWriter(baos));
ProfileOrganizerRenderer rend = new ProfileOrganizerRenderer(_context.profileOrganizer(), _context);
rend.renderStatusHTML(_out);
} catch (IOException ioe) {
ioe.printStackTrace();
}
return new String(baos.toByteArray());
return "";
}
/** @return empty string, writes directly to _out */
public String getShitlistSummary() {
ByteArrayOutputStream baos = new ByteArrayOutputStream(4*1024);
try {
_context.shitlist().renderStatusHTML(new OutputStreamWriter(baos));
_context.shitlist().renderStatusHTML(_out);
} catch (IOException ioe) {
ioe.printStackTrace();
}
return new String(baos.toByteArray());
return "";
}
}

View File

@ -71,6 +71,7 @@
<a name="shitlist"> </a>
<jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" />
<jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" />
<jsp:getProperty name="profilesHelper" property="shitlistSummary" />
<hr>
<div class="wideload">

View File

@ -9,6 +9,7 @@
<div class="main" id="main"><div class="wideload">
<jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" />
<jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" />
<jsp:getProperty name="profilesHelper" property="profileSummary" />
<br>
<a name="shitlist"> </a>

View File

@ -250,8 +250,4 @@ class PeerManager {
return rv;
}
}
public void renderStatusHTML(Writer out) throws IOException {
_organizer.renderStatusHTML(out);
}
}

View File

@ -78,8 +78,8 @@ public class PeerManagerFacadeImpl implements PeerManagerFacade {
return _manager.getPeersByCapability(capability);
}
/** @deprecated, moved to routerconsole */
public void renderStatusHTML(Writer out) throws IOException {
_manager.renderStatusHTML(out);
}
}

View File

@ -139,7 +139,7 @@ public class ProfileOrganizer {
}
public void setUs(Hash us) { _us = us; }
Hash getUs() { return _us; }
public Hash getUs() { return _us; }
public double getSpeedThreshold() { return _thresholdSpeedValue; }
public double getCapacityThreshold() { return _thresholdCapacityValue; }
@ -258,11 +258,6 @@ public class ProfileOrganizer {
_persistenceHelper.writeProfile(prof, out);
}
public void renderStatusHTML(Writer out) throws IOException {
ProfileOrganizerRenderer rend = new ProfileOrganizerRenderer(this, _context);
rend.renderStatusHTML(out);
}
/**
* Return a set of Hashes for peers that are both fast and reliable. If an insufficient
* number of peers are both fast and reliable, fall back onto high capacity peers, and if that