forked from I2P_Developers/i2p.i2p
Findbugs all over:
- Serializable - hashCode() - Make DataStructureImpl Serializable (removed from DataStructure in 2005)
This commit is contained in:
@ -41,7 +41,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Servlet extends HttpServlet {
|
public class Servlet extends HttpServlet {
|
||||||
private DaemonThread thread;
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private transient DaemonThread thread;
|
||||||
//private String nonce;
|
//private String nonce;
|
||||||
//private static final String PROP_NONCE = "addressbook.nonce";
|
//private static final String PROP_NONCE = "addressbook.nonce";
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -1969,7 +1970,7 @@ public class SnarkManager implements CompleteListener {
|
|||||||
* ignore case, current locale
|
* ignore case, current locale
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
private static class IgnoreCaseComparator implements Comparator<Tracker> {
|
private static class IgnoreCaseComparator implements Comparator<Tracker>, Serializable {
|
||||||
public int compare(Tracker l, Tracker r) {
|
public int compare(Tracker l, Tracker r) {
|
||||||
return l.name.toLowerCase().compareTo(r.name.toLowerCase());
|
return l.name.toLowerCase().compareTo(r.name.toLowerCase());
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package org.klomp.snark.dht;
|
|||||||
* From zzzot, modded and relicensed to GPLv2
|
* From zzzot, modded and relicensed to GPLv2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import net.i2p.crypto.SHA1Hash;
|
import net.i2p.crypto.SHA1Hash;
|
||||||
@ -15,7 +16,7 @@ import net.i2p.data.DataHelper;
|
|||||||
* @since 0.9.2
|
* @since 0.9.2
|
||||||
* @author zzz
|
* @author zzz
|
||||||
*/
|
*/
|
||||||
class NodeInfoComparator implements Comparator<NodeInfo> {
|
class NodeInfoComparator implements Comparator<NodeInfo>, Serializable {
|
||||||
private final byte[] _base;
|
private final byte[] _base;
|
||||||
|
|
||||||
public NodeInfoComparator(SHA1Hash h) {
|
public NodeInfoComparator(SHA1Hash h) {
|
||||||
|
@ -84,16 +84,17 @@ import net.i2p.util.SystemVersion;
|
|||||||
*/
|
*/
|
||||||
class BasicServlet extends HttpServlet
|
class BasicServlet extends HttpServlet
|
||||||
{
|
{
|
||||||
protected final I2PAppContext _context;
|
private static final long serialVersionUID = 1L;
|
||||||
protected final Log _log;
|
protected transient final I2PAppContext _context;
|
||||||
|
protected transient final Log _log;
|
||||||
protected File _resourceBase;
|
protected File _resourceBase;
|
||||||
private String _warBase;
|
private String _warBase;
|
||||||
|
|
||||||
private final MimeTypes _mimeTypes;
|
private transient final MimeTypes _mimeTypes;
|
||||||
|
|
||||||
/** same as PeerState.PARTSIZE */
|
/** same as PeerState.PARTSIZE */
|
||||||
private static final int BUFSIZE = 16*1024;
|
private static final int BUFSIZE = 16*1024;
|
||||||
private ByteCache _cache = ByteCache.getInstance(16, BUFSIZE);
|
private transient ByteCache _cache = ByteCache.getInstance(16, BUFSIZE);
|
||||||
|
|
||||||
private static final int WAR_CACHE_CONTROL_SECS = 24*60*60;
|
private static final int WAR_CACHE_CONTROL_SECS = 24*60*60;
|
||||||
private static final int FILE_CACHE_CONTROL_SECS = 24*60*60;
|
private static final int FILE_CACHE_CONTROL_SECS = 24*60*60;
|
||||||
|
@ -3,6 +3,7 @@ package org.klomp.snark.web;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -44,11 +45,13 @@ import org.klomp.snark.dht.DHT;
|
|||||||
* Refactored to eliminate Jetty dependencies.
|
* Refactored to eliminate Jetty dependencies.
|
||||||
*/
|
*/
|
||||||
public class I2PSnarkServlet extends BasicServlet {
|
public class I2PSnarkServlet extends BasicServlet {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
/** generally "/i2psnark" */
|
/** generally "/i2psnark" */
|
||||||
private String _contextPath;
|
private String _contextPath;
|
||||||
/** generally "i2psnark" */
|
/** generally "i2psnark" */
|
||||||
private String _contextName;
|
private String _contextName;
|
||||||
private SnarkManager _manager;
|
private transient SnarkManager _manager;
|
||||||
private long _nonce;
|
private long _nonce;
|
||||||
private String _themePath;
|
private String _themePath;
|
||||||
private String _imgPath;
|
private String _imgPath;
|
||||||
@ -1111,8 +1114,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
* (I guess this is worth it, a lot of torrents start with "The "
|
* (I guess this is worth it, a lot of torrents start with "The "
|
||||||
* @since 0.7.14
|
* @since 0.7.14
|
||||||
*/
|
*/
|
||||||
private static class TorrentNameComparator implements Comparator<Snark> {
|
private static class TorrentNameComparator implements Comparator<Snark>, Serializable {
|
||||||
private final Comparator collator = Collator.getInstance();
|
|
||||||
|
|
||||||
public int compare(Snark l, Snark r) {
|
public int compare(Snark l, Snark r) {
|
||||||
// put downloads and magnets first
|
// put downloads and magnets first
|
||||||
@ -1128,7 +1130,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
String rlc = rs.toLowerCase(Locale.US);
|
String rlc = rs.toLowerCase(Locale.US);
|
||||||
if (rlc.startsWith("the ") || rlc.startsWith("the.") || rlc.startsWith("the_"))
|
if (rlc.startsWith("the ") || rlc.startsWith("the.") || rlc.startsWith("the_"))
|
||||||
rs = rs.substring(4);
|
rs = rs.substring(4);
|
||||||
return collator.compare(ls, rs);
|
return Collator.getInstance().compare(ls, rs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1627,7 +1629,8 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
* Sort by completeness (seeds first), then by ID
|
* Sort by completeness (seeds first), then by ID
|
||||||
* @since 0.8.1
|
* @since 0.8.1
|
||||||
*/
|
*/
|
||||||
private static class PeerComparator implements Comparator<Peer> {
|
private static class PeerComparator implements Comparator<Peer>, Serializable {
|
||||||
|
|
||||||
public int compare(Peer l, Peer r) {
|
public int compare(Peer l, Peer r) {
|
||||||
int diff = r.completed() - l.completed(); // reverse
|
int diff = r.completed() - l.completed(); // reverse
|
||||||
if (diff != 0)
|
if (diff != 0)
|
||||||
@ -2211,15 +2214,14 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
* directories first
|
* directories first
|
||||||
* @since 0.9.6
|
* @since 0.9.6
|
||||||
*/
|
*/
|
||||||
private static class ListingComparator implements Comparator<File> {
|
private static class ListingComparator implements Comparator<File>, Serializable {
|
||||||
private final Comparator collator = Collator.getInstance();
|
|
||||||
|
|
||||||
public int compare(File l, File r) {
|
public int compare(File l, File r) {
|
||||||
if (l.isDirectory() && !r.isDirectory())
|
if (l.isDirectory() && !r.isDirectory())
|
||||||
return -1;
|
return -1;
|
||||||
if (r.isDirectory() && !l.isDirectory())
|
if (r.isDirectory() && !l.isDirectory())
|
||||||
return 1;
|
return 1;
|
||||||
return collator.compare(l.getName(), r.getName());
|
return Collator.getInstance().compare(l.getName(), r.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,9 @@ import net.i2p.data.DataHelper;
|
|||||||
*/
|
*/
|
||||||
public class I2PSocketAddress extends SocketAddress {
|
public class I2PSocketAddress extends SocketAddress {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private final int _port;
|
private final int _port;
|
||||||
private Destination _dest;
|
private transient Destination _dest;
|
||||||
private final String _host;
|
private final String _host;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1584,6 +1584,12 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
|||||||
return super.equals(o) && (o instanceof VersionAvailable);
|
return super.equals(o) && (o instanceof VersionAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
// findbugs
|
||||||
|
return super.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VersionAvailable \"" + version + "\" " + sourceMap +
|
return "VersionAvailable \"" + version + "\" " + sourceMap +
|
||||||
|
@ -9,6 +9,7 @@ package net.i2p.router.web;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -30,7 +31,7 @@ public class BanlistRenderer {
|
|||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class HashComparator implements Comparator<Hash> {
|
private static class HashComparator implements Comparator<Hash>, Serializable {
|
||||||
public int compare(Hash l, Hash r) {
|
public int compare(Hash l, Hash r) {
|
||||||
return l.toBase64().compareTo(r.toBase64());
|
return l.toBase64().compareTo(r.toBase64());
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.i2p.router.web;
|
package net.i2p.router.web;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -171,6 +171,7 @@ public class ConfigStatsHelper extends HelperBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated sort
|
* Translated sort
|
||||||
|
* Inner class, can't be Serializable
|
||||||
* @since 0.9.4
|
* @since 0.9.4
|
||||||
*/
|
*/
|
||||||
private class AlphaComparator implements Comparator<String> {
|
private class AlphaComparator implements Comparator<String> {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.i2p.router.web;
|
package net.i2p.router.web;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -440,7 +441,7 @@ public class GraphHelper extends FormHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class AlphaComparator implements Comparator<SummaryListener> {
|
private static class AlphaComparator implements Comparator<SummaryListener>, Serializable {
|
||||||
public int compare(SummaryListener l, SummaryListener r) {
|
public int compare(SummaryListener l, SummaryListener r) {
|
||||||
String lName = l.getRate().getRateStat().getName();
|
String lName = l.getRate().getRateStat().getName();
|
||||||
String rName = r.getRate().getRateStat().getName();
|
String rName = r.getRate().getRateStat().getName();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.router.web;
|
package net.i2p.router.web;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -238,7 +239,7 @@ public class HomeHelper extends HelperBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** ignore case, current locale */
|
/** ignore case, current locale */
|
||||||
private static class AppComparator implements Comparator<App> {
|
private static class AppComparator implements Comparator<App>, Serializable {
|
||||||
public int compare(App l, App r) {
|
public int compare(App l, App r) {
|
||||||
return l.name.toLowerCase().compareTo(r.name.toLowerCase());
|
return l.name.toLowerCase().compareTo(r.name.toLowerCase());
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package net.i2p.router.web;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -204,14 +205,14 @@ public class JobQueueHelper extends HelperBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @since 0.8.9 */
|
/** @since 0.8.9 */
|
||||||
private static class JobStatsComparator implements Comparator<JobStats> {
|
private static class JobStatsComparator implements Comparator<JobStats>, Serializable {
|
||||||
public int compare(JobStats l, JobStats r) {
|
public int compare(JobStats l, JobStats r) {
|
||||||
return l.getName().compareTo(r.getName());
|
return l.getName().compareTo(r.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @since 0.9.5 */
|
/** @since 0.9.5 */
|
||||||
private static class JobCountComparator implements Comparator<String> {
|
private static class JobCountComparator implements Comparator<String>, Serializable {
|
||||||
private final ObjectCounter<String> _counter;
|
private final ObjectCounter<String> _counter;
|
||||||
|
|
||||||
public JobCountComparator(ObjectCounter<String> counter) {
|
public JobCountComparator(ObjectCounter<String> counter) {
|
||||||
|
@ -9,6 +9,7 @@ package net.i2p.router.web;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.math.BigInteger; // debug
|
import java.math.BigInteger; // debug
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
@ -46,6 +47,9 @@ public class NetDbRenderer {
|
|||||||
_context = ctx;
|
_context = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inner class, can't be Serializable
|
||||||
|
*/
|
||||||
private class LeaseSetComparator implements Comparator<LeaseSet> {
|
private class LeaseSetComparator implements Comparator<LeaseSet> {
|
||||||
public int compare(LeaseSet l, LeaseSet r) {
|
public int compare(LeaseSet l, LeaseSet r) {
|
||||||
Destination dl = l.getDestination();
|
Destination dl = l.getDestination();
|
||||||
@ -59,7 +63,7 @@ public class NetDbRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** for debugging @since 0.7.14 */
|
/** for debugging @since 0.7.14 */
|
||||||
private static class LeaseSetRoutingKeyComparator implements Comparator<LeaseSet> {
|
private static class LeaseSetRoutingKeyComparator implements Comparator<LeaseSet>, Serializable {
|
||||||
private final Hash _us;
|
private final Hash _us;
|
||||||
public LeaseSetRoutingKeyComparator(Hash us) {
|
public LeaseSetRoutingKeyComparator(Hash us) {
|
||||||
_us = us;
|
_us = us;
|
||||||
@ -69,7 +73,7 @@ public class NetDbRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RouterInfoComparator implements Comparator<RouterInfo> {
|
private static class RouterInfoComparator implements Comparator<RouterInfo>, Serializable {
|
||||||
public int compare(RouterInfo l, RouterInfo r) {
|
public int compare(RouterInfo l, RouterInfo r) {
|
||||||
return l.getIdentity().getHash().toBase64().compareTo(r.getIdentity().getHash().toBase64());
|
return l.getIdentity().getHash().toBase64().compareTo(r.getIdentity().getHash().toBase64());
|
||||||
}
|
}
|
||||||
@ -365,9 +369,13 @@ public class NetDbRenderer {
|
|||||||
return Translate.getString(name, _context, Messages.COUNTRY_BUNDLE_NAME);
|
return Translate.getString(name, _context, Messages.COUNTRY_BUNDLE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** sort by translated country name using rules for the current language setting */
|
/**
|
||||||
|
* Sort by translated country name using rules for the current language setting
|
||||||
|
* Inner class, can't be Serializable
|
||||||
|
*/
|
||||||
private class CountryComparator implements Comparator<String> {
|
private class CountryComparator implements Comparator<String> {
|
||||||
Collator coll;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private final Collator coll;
|
||||||
|
|
||||||
public CountryComparator() {
|
public CountryComparator() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.i2p.router.web;
|
package net.i2p.router.web;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -330,7 +331,7 @@ class ProfileOrganizerRenderer {
|
|||||||
* Used for floodfill-only page
|
* Used for floodfill-only page
|
||||||
* @since 0.9.8
|
* @since 0.9.8
|
||||||
*/
|
*/
|
||||||
private static class HashComparator implements Comparator<PeerProfile> {
|
private static class HashComparator implements Comparator<PeerProfile>, Serializable {
|
||||||
public int compare(PeerProfile left, PeerProfile right) {
|
public int compare(PeerProfile left, PeerProfile right) {
|
||||||
return left.getPeer().toBase64().compareTo(right.getPeer().toBase64());
|
return left.getPeer().toBase64().compareTo(right.getPeer().toBase64());
|
||||||
}
|
}
|
||||||
|
@ -252,6 +252,7 @@ public class StatsGenerator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Translated sort
|
* Translated sort
|
||||||
|
* Inner class, can't be Serializable
|
||||||
* @since 0.9.3
|
* @since 0.9.3
|
||||||
*/
|
*/
|
||||||
private class AlphaComparator implements Comparator<String> {
|
private class AlphaComparator implements Comparator<String> {
|
||||||
|
@ -461,7 +461,10 @@ public class SummaryHelper extends HelperBase {
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** compare translated nicknames - put "shared clients" first in the sort */
|
/**
|
||||||
|
* Compare translated nicknames - put "shared clients" first in the sort
|
||||||
|
* Inner class, can't be Serializable
|
||||||
|
*/
|
||||||
private class AlphaComparator implements Comparator<Destination> {
|
private class AlphaComparator implements Comparator<Destination> {
|
||||||
private final String xsc = _("shared clients");
|
private final String xsc = _("shared clients");
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.i2p.router.web;
|
package net.i2p.router.web;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -133,7 +134,7 @@ public class TunnelRenderer {
|
|||||||
out.write("</div>");
|
out.write("</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TunnelComparator implements Comparator<HopConfig> {
|
private static class TunnelComparator implements Comparator<HopConfig>, Serializable {
|
||||||
public int compare(HopConfig l, HopConfig r) {
|
public int compare(HopConfig l, HopConfig r) {
|
||||||
return (r.getProcessedMessagesCount() - l.getProcessedMessagesCount());
|
return (r.getProcessedMessagesCount() - l.getProcessedMessagesCount());
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,10 @@
|
|||||||
|
|
||||||
package i2p.susi.dns;
|
package i2p.susi.dns;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
public class AddressByNameSorter implements Comparator<AddressBean>
|
public class AddressByNameSorter implements Comparator<AddressBean>, Serializable
|
||||||
{
|
{
|
||||||
public int compare(AddressBean a, AddressBean b)
|
public int compare(AddressBean a, AddressBean b)
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
@ -235,7 +236,7 @@ public class WebMail extends HttpServlet
|
|||||||
*
|
*
|
||||||
* @since 0.9.13
|
* @since 0.9.13
|
||||||
*/
|
*/
|
||||||
private abstract static class SorterBase implements Comparator<String> {
|
private abstract static class SorterBase implements Comparator<String>, Serializable {
|
||||||
private final MailCache mailCache;
|
private final MailCache mailCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1488,6 +1488,7 @@
|
|||||||
<arg value="build/i2psnark.war"/>
|
<arg value="build/i2psnark.war"/>
|
||||||
<arg value="build/i2ptunnel.jar"/>
|
<arg value="build/i2ptunnel.jar"/>
|
||||||
<arg value="build/i2ptunnel.war"/>
|
<arg value="build/i2ptunnel.war"/>
|
||||||
|
<arg value="build/jetty-i2p.jar"/>
|
||||||
<arg value="build/mstreaming.jar"/>
|
<arg value="build/mstreaming.jar"/>
|
||||||
<arg value="build/router.jar/"/>
|
<arg value="build/router.jar/"/>
|
||||||
<arg value="build/desktopgui.jar"/>
|
<arg value="build/desktopgui.jar"/>
|
||||||
|
@ -41,6 +41,7 @@ package gnu.crypto.prng;
|
|||||||
// do so, delete this exception statement from your version.
|
// do so, delete this exception statement from your version.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,7 +50,7 @@ import java.util.Map;
|
|||||||
* Modified slightly by jrandom for I2P (removing unneeded exceptions)
|
* Modified slightly by jrandom for I2P (removing unneeded exceptions)
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.1 $
|
||||||
*/
|
*/
|
||||||
public abstract class BasePRNGStandalone implements IRandomStandalone {
|
public abstract class BasePRNGStandalone implements IRandomStandalone, Serializable {
|
||||||
|
|
||||||
// Constants and variables
|
// Constants and variables
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.crypto;
|
package net.i2p.crypto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,21 +53,26 @@ public final class CryptixAESKeyCache {
|
|||||||
|
|
||||||
public static final KeyCacheEntry createNew() {
|
public static final KeyCacheEntry createNew() {
|
||||||
KeyCacheEntry e = new KeyCacheEntry();
|
KeyCacheEntry e = new KeyCacheEntry();
|
||||||
e.Ke = new int[ROUNDS + 1][BC]; // encryption round keys
|
|
||||||
e.Kd = new int[ROUNDS + 1][BC]; // decryption round keys
|
|
||||||
e.tk = new int[KC];
|
|
||||||
e.key = new Object[] { e.Ke, e.Kd };
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* all the data alloc'ed in a makeKey call
|
* all the data alloc'ed in a makeKey call
|
||||||
*/
|
*/
|
||||||
public static final class KeyCacheEntry {
|
public static class KeyCacheEntry implements Serializable {
|
||||||
int[][] Ke;
|
/** encryption round keys */
|
||||||
int[][] Kd;
|
final int[][] Ke;
|
||||||
int[] tk;
|
/** decryption round keys */
|
||||||
|
final int[][] Kd;
|
||||||
|
final int[] tk;
|
||||||
|
/** Ke, Kd */
|
||||||
|
final Object[] key;
|
||||||
|
|
||||||
Object[] key;
|
public KeyCacheEntry() {
|
||||||
|
Ke = new int[ROUNDS + 1][BC];
|
||||||
|
Kd = new int[ROUNDS + 1][BC];
|
||||||
|
tk = new int[KC];
|
||||||
|
key = new Object[] { Ke, Kd };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ package net.i2p.crypto;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -798,7 +799,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
|||||||
* Just for the HTML method above so we can see what's going on easier
|
* Just for the HTML method above so we can see what's going on easier
|
||||||
* Earliest first
|
* Earliest first
|
||||||
*/
|
*/
|
||||||
private static class TagSetComparator implements Comparator<TagSet> {
|
private static class TagSetComparator implements Comparator<TagSet>, Serializable {
|
||||||
public int compare(TagSet l, TagSet r) {
|
public int compare(TagSet l, TagSet r) {
|
||||||
int rv = (int) (l.getDate() - r.getDate());
|
int rv = (int) (l.getDate() - r.getDate());
|
||||||
if (rv != 0)
|
if (rv != 0)
|
||||||
|
@ -24,6 +24,7 @@ import java.io.InputStreamReader;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
@ -1463,7 +1464,7 @@ public class DataHelper {
|
|||||||
* See sortStructures() comments.
|
* See sortStructures() comments.
|
||||||
* @since 0.8.3
|
* @since 0.8.3
|
||||||
*/
|
*/
|
||||||
private static class DataStructureComparator implements Comparator<DataStructure> {
|
private static class DataStructureComparator implements Comparator<DataStructure>, Serializable {
|
||||||
public int compare(DataStructure l, DataStructure r) {
|
public int compare(DataStructure l, DataStructure r) {
|
||||||
return l.calculateHash().toBase64().compareTo(r.calculateHash().toBase64());
|
return l.calculateHash().toBase64().compareTo(r.calculateHash().toBase64());
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.crypto.SHA256Generator;
|
import net.i2p.crypto.SHA256Generator;
|
||||||
@ -23,7 +24,7 @@ import net.i2p.util.Log;
|
|||||||
*
|
*
|
||||||
* @author jrandom
|
* @author jrandom
|
||||||
*/
|
*/
|
||||||
public abstract class DataStructureImpl implements DataStructure {
|
public abstract class DataStructureImpl implements DataStructure, Serializable {
|
||||||
|
|
||||||
public String toBase64() {
|
public String toBase64() {
|
||||||
byte data[] = toByteArray();
|
byte data[] = toByteArray();
|
||||||
|
@ -186,4 +186,10 @@ public class Destination extends KeysAndCert {
|
|||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
return super.equals(o) && (o instanceof Destination);
|
return super.equals(o) && (o instanceof Destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
// findbugs
|
||||||
|
return super.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ package net.i2p.data.i2cp;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -28,9 +29,12 @@ import net.i2p.data.TunnelId;
|
|||||||
* @author jrandom
|
* @author jrandom
|
||||||
*/
|
*/
|
||||||
public class RequestLeaseSetMessage extends I2CPMessageImpl {
|
public class RequestLeaseSetMessage extends I2CPMessageImpl {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
public final static int MESSAGE_TYPE = 21;
|
public final static int MESSAGE_TYPE = 21;
|
||||||
private SessionId _sessionId;
|
private SessionId _sessionId;
|
||||||
private final List<TunnelEndpoint> _endpoints;
|
// ArrayList is Serializable, List is not
|
||||||
|
private final ArrayList<TunnelEndpoint> _endpoints;
|
||||||
private Date _end;
|
private Date _end;
|
||||||
|
|
||||||
public RequestLeaseSetMessage() {
|
public RequestLeaseSetMessage() {
|
||||||
@ -139,7 +143,8 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TunnelEndpoint {
|
private static class TunnelEndpoint implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private final Hash _router;
|
private final Hash _router;
|
||||||
private final TunnelId _tunnelId;
|
private final TunnelId _tunnelId;
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ import net.i2p.util.OrderedProperties;
|
|||||||
* @author jrandom
|
* @author jrandom
|
||||||
*/
|
*/
|
||||||
public class SessionConfig extends DataStructureImpl {
|
public class SessionConfig extends DataStructureImpl {
|
||||||
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(SessionConfig.class);
|
|
||||||
private Destination _destination;
|
private Destination _destination;
|
||||||
private Signature _signature;
|
private Signature _signature;
|
||||||
private Date _creationDate;
|
private Date _creationDate;
|
||||||
@ -125,31 +124,32 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
*/
|
*/
|
||||||
public boolean verifySignature() {
|
public boolean verifySignature() {
|
||||||
if (getSignature() == null) {
|
if (getSignature() == null) {
|
||||||
if (_log.shouldLog(Log.WARN)) _log.warn("Signature is null!");
|
//if (_log.shouldLog(Log.WARN)) _log.warn("Signature is null!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getDestination() == null) {
|
if (getDestination() == null) {
|
||||||
if (_log.shouldLog(Log.WARN)) _log.warn("Destination is null!");
|
//if (_log.shouldLog(Log.WARN)) _log.warn("Destination is null!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getCreationDate() == null) {
|
if (getCreationDate() == null) {
|
||||||
if (_log.shouldLog(Log.WARN)) _log.warn("Date is null!");
|
//if (_log.shouldLog(Log.WARN)) _log.warn("Date is null!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (tooOld()) {
|
if (tooOld()) {
|
||||||
if (_log.shouldLog(Log.WARN)) _log.warn("Too old!");
|
//if (_log.shouldLog(Log.WARN)) _log.warn("Too old!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
byte data[] = getBytes();
|
byte data[] = getBytes();
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
if (_log.shouldLog(Log.WARN)) _log.warn("Bytes could not be found - wtf?");
|
//if (_log.shouldLog(Log.WARN)) _log.warn("Bytes could not be found - wtf?");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean ok = DSAEngine.getInstance().verifySignature(getSignature(), data,
|
boolean ok = DSAEngine.getInstance().verifySignature(getSignature(), data,
|
||||||
getDestination().getSigningPublicKey());
|
getDestination().getSigningPublicKey());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
if (_log.shouldLog(Log.WARN)) _log.warn("DSA signature failed!");
|
Log log = I2PAppContext.getGlobalContext().logManager().getLog(SessionConfig.class);
|
||||||
|
if (log.shouldLog(Log.WARN)) log.warn("DSA signature failed!");
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -177,10 +177,12 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
DataHelper.writeProperties(out, _options, true); // UTF-8
|
DataHelper.writeProperties(out, _options, true); // UTF-8
|
||||||
DataHelper.writeDate(out, _creationDate);
|
DataHelper.writeDate(out, _creationDate);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
_log.error("IOError signing", ioe);
|
Log log = I2PAppContext.getGlobalContext().logManager().getLog(SessionConfig.class);
|
||||||
|
log.error("IOError signing", ioe);
|
||||||
return null;
|
return null;
|
||||||
} catch (DataFormatException dfe) {
|
} catch (DataFormatException dfe) {
|
||||||
_log.error("Error writing out the bytes for signing/verification", dfe);
|
Log log = I2PAppContext.getGlobalContext().logManager().getLog(SessionConfig.class);
|
||||||
|
log.error("Error writing out the bytes for signing/verification", dfe);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return out.toByteArray();
|
return out.toByteArray();
|
||||||
|
@ -8,6 +8,7 @@ package net.i2p.kademlia;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -750,7 +751,7 @@ public class KBucketSet<T extends SimpleDataStructure> {
|
|||||||
* For Collections.binarySearch.
|
* For Collections.binarySearch.
|
||||||
* Returns equal for any overlap.
|
* Returns equal for any overlap.
|
||||||
*/
|
*/
|
||||||
private static class BucketComparator<T extends SimpleDataStructure> implements Comparator<KBucket<T>> {
|
private static class BucketComparator<T extends SimpleDataStructure> implements Comparator<KBucket<T>>, Serializable {
|
||||||
public int compare(KBucket<T> l, KBucket<T> r) {
|
public int compare(KBucket<T> l, KBucket<T> r) {
|
||||||
if (l.getRangeEnd() < r.getRangeBegin())
|
if (l.getRangeEnd() < r.getRangeBegin())
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.kademlia;
|
package net.i2p.kademlia;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import net.i2p.data.SimpleDataStructure;
|
import net.i2p.data.SimpleDataStructure;
|
||||||
@ -9,7 +10,7 @@ import net.i2p.data.SimpleDataStructure;
|
|||||||
*
|
*
|
||||||
* @since 0.9.2 in i2psnark, moved to core in 0.9.10
|
* @since 0.9.2 in i2psnark, moved to core in 0.9.10
|
||||||
*/
|
*/
|
||||||
public class XORComparator<T extends SimpleDataStructure> implements Comparator<T> {
|
public class XORComparator<T extends SimpleDataStructure> implements Comparator<T>, Serializable {
|
||||||
private final byte[] _base;
|
private final byte[] _base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.util;
|
package net.i2p.util;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.ConcurrentModificationException;
|
import java.util.ConcurrentModificationException;
|
||||||
@ -38,7 +39,7 @@ public class CachedIteratorArrayList<E> extends ArrayList<E> {
|
|||||||
return iterator;
|
return iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CachedIterator implements Iterator<E> {
|
private class CachedIterator implements Iterator<E>, Serializable {
|
||||||
/**
|
/**
|
||||||
* Index of element to be returned by subsequent call to next.
|
* Index of element to be returned by subsequent call to next.
|
||||||
*/
|
*/
|
||||||
|
@ -811,4 +811,10 @@ public class NativeBigInteger extends BigInteger {
|
|||||||
// for findbugs
|
// for findbugs
|
||||||
return super.equals(o);
|
return super.equals(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
// for findbugs
|
||||||
|
return super.hashCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ package net.i2p.util;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -46,7 +47,7 @@ public class OrderedProperties extends Properties {
|
|||||||
return Collections.unmodifiableSortedSet(rv);
|
return Collections.unmodifiableSortedSet(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EntryComparator implements Comparator<Map.Entry<Object, Object>> {
|
private static class EntryComparator implements Comparator<Map.Entry<Object, Object>>, Serializable {
|
||||||
public int compare(Map.Entry<Object, Object> l, Map.Entry<Object, Object> r) {
|
public int compare(Map.Entry<Object, Object> l, Map.Entry<Object, Object> r) {
|
||||||
return ((String)l.getKey()).compareTo(((String)r.getKey()));
|
return ((String)l.getKey()).compareTo(((String)r.getKey()));
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,10 @@ import net.i2p.crypto.EntropyHarvester;
|
|||||||
* @author jrandom
|
* @author jrandom
|
||||||
*/
|
*/
|
||||||
public class RandomSource extends SecureRandom implements EntropyHarvester {
|
public class RandomSource extends SecureRandom implements EntropyHarvester {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
private final EntropyHarvester _entropyHarvester;
|
private final EntropyHarvester _entropyHarvester;
|
||||||
protected final I2PAppContext _context;
|
protected transient final I2PAppContext _context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deprecated - do not instantiate this directly, as you won't get the
|
* Deprecated - do not instantiate this directly, as you won't get the
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.util;
|
package net.i2p.util;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,7 +10,7 @@ import java.util.Comparator;
|
|||||||
* Moved from TrustedUpdate.java
|
* Moved from TrustedUpdate.java
|
||||||
* @since 0.7.10
|
* @since 0.7.10
|
||||||
*/
|
*/
|
||||||
public class VersionComparator implements Comparator<String> {
|
public class VersionComparator implements Comparator<String>, Serializable {
|
||||||
|
|
||||||
public int compare(String l, String r) {
|
public int compare(String l, String r) {
|
||||||
return comp(l, r);
|
return comp(l, r);
|
||||||
|
@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
package net.metanotion.io.block.index;
|
package net.metanotion.io.block.index;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
@ -311,7 +312,7 @@ public class BSkipLevels extends SkipLevels {
|
|||||||
* Sorts in REVERSE order.
|
* Sorts in REVERSE order.
|
||||||
* @since 0.8.8
|
* @since 0.8.8
|
||||||
*/
|
*/
|
||||||
private static class LevelComparator implements Comparator<SkipLevels> {
|
private static class LevelComparator implements Comparator<SkipLevels>, Serializable {
|
||||||
public int compare(SkipLevels l, SkipLevels r) {
|
public int compare(SkipLevels l, SkipLevels r) {
|
||||||
Comparable lk = l.key();
|
Comparable lk = l.key();
|
||||||
Comparable rk = r.key();
|
Comparable rk = r.key();
|
||||||
|
@ -29,8 +29,10 @@ import net.i2p.util.Log;
|
|||||||
* @author jrandom
|
* @author jrandom
|
||||||
*/
|
*/
|
||||||
public class GarlicClove extends DataStructureImpl {
|
public class GarlicClove extends DataStructureImpl {
|
||||||
|
|
||||||
//private final Log _log;
|
//private final Log _log;
|
||||||
private final I2PAppContext _context;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private transient final I2PAppContext _context;
|
||||||
private DeliveryInstructions _instructions;
|
private DeliveryInstructions _instructions;
|
||||||
private I2NPMessage _msg;
|
private I2NPMessage _msg;
|
||||||
private long _cloveId;
|
private long _cloveId;
|
||||||
|
@ -9,6 +9,7 @@ package net.i2p.router;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -658,7 +659,7 @@ public class JobQueue {
|
|||||||
* Ensure different jobs with the same timing are different so they aren't removed.
|
* Ensure different jobs with the same timing are different so they aren't removed.
|
||||||
* @since 0.8.9
|
* @since 0.8.9
|
||||||
*/
|
*/
|
||||||
private static class JobComparator implements Comparator<Job> {
|
private static class JobComparator implements Comparator<Job>, Serializable {
|
||||||
public int compare(Job l, Job r) {
|
public int compare(Job l, Job r) {
|
||||||
// equals first, Jobs generally don't override so this should be fast
|
// equals first, Jobs generally don't override so this should be fast
|
||||||
// And this MUST be first so we can remove a job even if its timing has changed.
|
// And this MUST be first so we can remove a job even if its timing has changed.
|
||||||
|
@ -16,7 +16,9 @@ import net.i2p.util.KeyRing;
|
|||||||
* Caution - not all HashMap methods are overridden.
|
* Caution - not all HashMap methods are overridden.
|
||||||
*/
|
*/
|
||||||
public class PersistentKeyRing extends KeyRing {
|
public class PersistentKeyRing extends KeyRing {
|
||||||
private RouterContext _ctx;
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private transient final RouterContext _ctx;
|
||||||
private static final String PROP_PFX = "router.keyring.key.";
|
private static final String PROP_PFX = "router.keyring.key.";
|
||||||
|
|
||||||
public PersistentKeyRing(RouterContext ctx) {
|
public PersistentKeyRing(RouterContext ctx) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.router.peermanager;
|
package net.i2p.router.peermanager;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import net.i2p.data.DataHelper;
|
import net.i2p.data.DataHelper;
|
||||||
@ -8,7 +9,7 @@ import net.i2p.data.DataHelper;
|
|||||||
* Order profiles by their capacity, but backwards (highest capacity / value first).
|
* Order profiles by their capacity, but backwards (highest capacity / value first).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class InverseCapacityComparator implements Comparator<PeerProfile> {
|
class InverseCapacityComparator implements Comparator<PeerProfile>, Serializable {
|
||||||
/**
|
/**
|
||||||
* Compare the two objects backwards. The standard comparator returns
|
* Compare the two objects backwards. The standard comparator returns
|
||||||
* -1 if lhs is less than rhs, 1 if lhs is greater than rhs, or 0 if they're
|
* -1 if lhs is less than rhs, 1 if lhs is greater than rhs, or 0 if they're
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.router.peermanager;
|
package net.i2p.router.peermanager;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import net.i2p.data.DataHelper;
|
import net.i2p.data.DataHelper;
|
||||||
@ -8,7 +9,7 @@ import net.i2p.data.DataHelper;
|
|||||||
* Order profiles by their speed (lowest first).
|
* Order profiles by their speed (lowest first).
|
||||||
* @since 0.7.10
|
* @since 0.7.10
|
||||||
*/
|
*/
|
||||||
class SpeedComparator implements Comparator<PeerProfile> {
|
class SpeedComparator implements Comparator<PeerProfile>, Serializable {
|
||||||
|
|
||||||
public int compare(PeerProfile left, PeerProfile right) {
|
public int compare(PeerProfile left, PeerProfile right) {
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ package net.i2p.router.transport;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -627,7 +628,7 @@ public abstract class TransportImpl implements Transport {
|
|||||||
* Lowest cost (most preferred) first.
|
* Lowest cost (most preferred) first.
|
||||||
* @since IPv6
|
* @since IPv6
|
||||||
*/
|
*/
|
||||||
private static class AddrComparator implements Comparator<RouterAddress> {
|
private static class AddrComparator implements Comparator<RouterAddress>, Serializable {
|
||||||
private final int adj;
|
private final int adj;
|
||||||
|
|
||||||
public AddrComparator(int ipv6Adjustment) {
|
public AddrComparator(int ipv6Adjustment) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.i2p.router.transport.ntcp;
|
package net.i2p.router.transport.ntcp;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.Inet6Address;
|
import java.net.Inet6Address;
|
||||||
@ -1275,7 +1276,7 @@ public class NTCPTransport extends TransportImpl {
|
|||||||
public static final AlphaComparator instance() { return _instance; }
|
public static final AlphaComparator instance() { return _instance; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PeerComparator implements Comparator<NTCPConnection> {
|
private static class PeerComparator implements Comparator<NTCPConnection>, Serializable {
|
||||||
public int compare(NTCPConnection l, NTCPConnection r) {
|
public int compare(NTCPConnection l, NTCPConnection r) {
|
||||||
if (l == null || r == null)
|
if (l == null || r == null)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.i2p.router.transport.udp;
|
package net.i2p.router.transport.udp;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
@ -2240,59 +2241,59 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
private static final int FLAG_DEBUG = 99;
|
private static final int FLAG_DEBUG = 99;
|
||||||
|
|
||||||
private static Comparator<PeerState> getComparator(int sortFlags) {
|
private static Comparator<PeerState> getComparator(int sortFlags) {
|
||||||
Comparator<PeerState> rv = null;
|
Comparator<PeerState> rv;
|
||||||
switch (Math.abs(sortFlags)) {
|
switch (Math.abs(sortFlags)) {
|
||||||
case FLAG_IDLE_IN:
|
case FLAG_IDLE_IN:
|
||||||
rv = IdleInComparator.instance();
|
rv = new IdleInComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_IDLE_OUT:
|
case FLAG_IDLE_OUT:
|
||||||
rv = IdleOutComparator.instance();
|
rv = new IdleOutComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_RATE_IN:
|
case FLAG_RATE_IN:
|
||||||
rv = RateInComparator.instance();
|
rv = new RateInComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_RATE_OUT:
|
case FLAG_RATE_OUT:
|
||||||
rv = RateOutComparator.instance();
|
rv = new RateOutComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_UPTIME:
|
case FLAG_UPTIME:
|
||||||
rv = UptimeComparator.instance();
|
rv = new UptimeComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_SKEW:
|
case FLAG_SKEW:
|
||||||
rv = SkewComparator.instance();
|
rv = new SkewComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_CWND:
|
case FLAG_CWND:
|
||||||
rv = CwndComparator.instance();
|
rv = new CwndComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_SSTHRESH:
|
case FLAG_SSTHRESH:
|
||||||
rv = SsthreshComparator.instance();
|
rv = new SsthreshComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_RTT:
|
case FLAG_RTT:
|
||||||
rv = RTTComparator.instance();
|
rv = new RTTComparator();
|
||||||
break;
|
break;
|
||||||
//case FLAG_DEV:
|
//case FLAG_DEV:
|
||||||
// rv = DevComparator.instance();
|
// rv = new DevComparator();
|
||||||
// break;
|
// break;
|
||||||
case FLAG_RTO:
|
case FLAG_RTO:
|
||||||
rv = RTOComparator.instance();
|
rv = new RTOComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_MTU:
|
case FLAG_MTU:
|
||||||
rv = MTUComparator.instance();
|
rv = new MTUComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_SEND:
|
case FLAG_SEND:
|
||||||
rv = SendCountComparator.instance();
|
rv = new SendCountComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_RECV:
|
case FLAG_RECV:
|
||||||
rv = RecvCountComparator.instance();
|
rv = new RecvCountComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_RESEND:
|
case FLAG_RESEND:
|
||||||
rv = ResendComparator.instance();
|
rv = new ResendComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_DUP:
|
case FLAG_DUP:
|
||||||
rv = DupComparator.instance();
|
rv = new DupComparator();
|
||||||
break;
|
break;
|
||||||
case FLAG_ALPHA:
|
case FLAG_ALPHA:
|
||||||
default:
|
default:
|
||||||
rv = AlphaComparator.instance();
|
rv = new AlphaComparator();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (sortFlags < 0)
|
if (sortFlags < 0)
|
||||||
@ -2301,12 +2302,9 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class AlphaComparator extends PeerComparator {
|
private static class AlphaComparator extends PeerComparator {
|
||||||
private static final AlphaComparator _instance = new AlphaComparator();
|
|
||||||
public static final AlphaComparator instance() { return _instance; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class IdleInComparator extends PeerComparator {
|
private static class IdleInComparator extends PeerComparator {
|
||||||
private static final IdleInComparator _instance = new IdleInComparator();
|
|
||||||
public static final IdleInComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
long rv = r.getLastReceiveTime() - l.getLastReceiveTime();
|
long rv = r.getLastReceiveTime() - l.getLastReceiveTime();
|
||||||
@ -2316,9 +2314,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return (int)rv;
|
return (int)rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class IdleOutComparator extends PeerComparator {
|
private static class IdleOutComparator extends PeerComparator {
|
||||||
private static final IdleOutComparator _instance = new IdleOutComparator();
|
|
||||||
public static final IdleOutComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
long rv = r.getLastSendTime() - l.getLastSendTime();
|
long rv = r.getLastSendTime() - l.getLastSendTime();
|
||||||
@ -2328,9 +2325,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return (int)rv;
|
return (int)rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RateInComparator extends PeerComparator {
|
private static class RateInComparator extends PeerComparator {
|
||||||
private static final RateInComparator _instance = new RateInComparator();
|
|
||||||
public static final RateInComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
int rv = l.getReceiveBps() - r.getReceiveBps();
|
int rv = l.getReceiveBps() - r.getReceiveBps();
|
||||||
@ -2340,9 +2336,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RateOutComparator extends PeerComparator {
|
private static class RateOutComparator extends PeerComparator {
|
||||||
private static final RateOutComparator _instance = new RateOutComparator();
|
|
||||||
public static final RateOutComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
int rv = l.getSendBps() - r.getSendBps();
|
int rv = l.getSendBps() - r.getSendBps();
|
||||||
@ -2352,9 +2347,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class UptimeComparator extends PeerComparator {
|
private static class UptimeComparator extends PeerComparator {
|
||||||
private static final UptimeComparator _instance = new UptimeComparator();
|
|
||||||
public static final UptimeComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
long rv = r.getKeyEstablishedTime() - l.getKeyEstablishedTime();
|
long rv = r.getKeyEstablishedTime() - l.getKeyEstablishedTime();
|
||||||
@ -2364,9 +2358,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return (int)rv;
|
return (int)rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SkewComparator extends PeerComparator {
|
private static class SkewComparator extends PeerComparator {
|
||||||
private static final SkewComparator _instance = new SkewComparator();
|
|
||||||
public static final SkewComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
long rv = Math.abs(l.getClockSkew()) - Math.abs(r.getClockSkew());
|
long rv = Math.abs(l.getClockSkew()) - Math.abs(r.getClockSkew());
|
||||||
@ -2376,9 +2369,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return (int)rv;
|
return (int)rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CwndComparator extends PeerComparator {
|
private static class CwndComparator extends PeerComparator {
|
||||||
private static final CwndComparator _instance = new CwndComparator();
|
|
||||||
public static final CwndComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
int rv = l.getSendWindowBytes() - r.getSendWindowBytes();
|
int rv = l.getSendWindowBytes() - r.getSendWindowBytes();
|
||||||
@ -2388,9 +2380,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SsthreshComparator extends PeerComparator {
|
private static class SsthreshComparator extends PeerComparator {
|
||||||
private static final SsthreshComparator _instance = new SsthreshComparator();
|
|
||||||
public static final SsthreshComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
int rv = l.getSlowStartThreshold() - r.getSlowStartThreshold();
|
int rv = l.getSlowStartThreshold() - r.getSlowStartThreshold();
|
||||||
@ -2400,9 +2391,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RTTComparator extends PeerComparator {
|
private static class RTTComparator extends PeerComparator {
|
||||||
private static final RTTComparator _instance = new RTTComparator();
|
|
||||||
public static final RTTComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
int rv = l.getRTT() - r.getRTT();
|
int rv = l.getRTT() - r.getRTT();
|
||||||
@ -2430,8 +2420,6 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
|
|
||||||
/** */
|
/** */
|
||||||
private static class RTOComparator extends PeerComparator {
|
private static class RTOComparator extends PeerComparator {
|
||||||
private static final RTOComparator _instance = new RTOComparator();
|
|
||||||
public static final RTOComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
int rv = l.getRTO() - r.getRTO();
|
int rv = l.getRTO() - r.getRTO();
|
||||||
@ -2441,9 +2429,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class MTUComparator extends PeerComparator {
|
private static class MTUComparator extends PeerComparator {
|
||||||
private static final MTUComparator _instance = new MTUComparator();
|
|
||||||
public static final MTUComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
int rv = l.getMTU() - r.getMTU();
|
int rv = l.getMTU() - r.getMTU();
|
||||||
@ -2453,9 +2440,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SendCountComparator extends PeerComparator {
|
private static class SendCountComparator extends PeerComparator {
|
||||||
private static final SendCountComparator _instance = new SendCountComparator();
|
|
||||||
public static final SendCountComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
long rv = l.getPacketsTransmitted() - r.getPacketsTransmitted();
|
long rv = l.getPacketsTransmitted() - r.getPacketsTransmitted();
|
||||||
@ -2465,9 +2451,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return (int)rv;
|
return (int)rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RecvCountComparator extends PeerComparator {
|
private static class RecvCountComparator extends PeerComparator {
|
||||||
private static final RecvCountComparator _instance = new RecvCountComparator();
|
|
||||||
public static final RecvCountComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
long rv = l.getPacketsReceived() - r.getPacketsReceived();
|
long rv = l.getPacketsReceived() - r.getPacketsReceived();
|
||||||
@ -2477,9 +2462,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return (int)rv;
|
return (int)rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ResendComparator extends PeerComparator {
|
private static class ResendComparator extends PeerComparator {
|
||||||
private static final ResendComparator _instance = new ResendComparator();
|
|
||||||
public static final ResendComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
long rv = l.getPacketsRetransmitted() - r.getPacketsRetransmitted();
|
long rv = l.getPacketsRetransmitted() - r.getPacketsRetransmitted();
|
||||||
@ -2489,9 +2473,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
return (int)rv;
|
return (int)rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DupComparator extends PeerComparator {
|
private static class DupComparator extends PeerComparator {
|
||||||
private static final DupComparator _instance = new DupComparator();
|
|
||||||
public static final DupComparator instance() { return _instance; }
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
long rv = l.getPacketsReceivedDuplicate() - r.getPacketsReceivedDuplicate();
|
long rv = l.getPacketsReceivedDuplicate() - r.getPacketsReceivedDuplicate();
|
||||||
@ -2502,7 +2485,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PeerComparator implements Comparator<PeerState> {
|
private static class PeerComparator implements Comparator<PeerState>, Serializable {
|
||||||
public int compare(PeerState l, PeerState r) {
|
public int compare(PeerState l, PeerState r) {
|
||||||
return DataHelper.compareTo(l.getRemotePeer().getData(), r.getRemotePeer().getData());
|
return DataHelper.compareTo(l.getRemotePeer().getData(), r.getRemotePeer().getData());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.router.tunnel.pool;
|
package net.i2p.router.tunnel.pool;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -436,7 +437,7 @@ class BuildExecutor implements Runnable {
|
|||||||
* WARNING - this sort may be unstable, as a pool's tunnel count may change
|
* WARNING - this sort may be unstable, as a pool's tunnel count may change
|
||||||
* during the sort. This will cause Java 7 sort to throw an IAE.
|
* during the sort. This will cause Java 7 sort to throw an IAE.
|
||||||
*/
|
*/
|
||||||
private static class TunnelPoolComparator implements Comparator<TunnelPool> {
|
private static class TunnelPoolComparator implements Comparator<TunnelPool>, Serializable {
|
||||||
|
|
||||||
private final boolean _preferEmpty;
|
private final boolean _preferEmpty;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.router.tunnel.pool;
|
package net.i2p.router.tunnel.pool;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -525,7 +526,7 @@ public abstract class TunnelPeerSelector {
|
|||||||
* Now:
|
* Now:
|
||||||
* d((H(l+h), h) - d(H(r+h), h)
|
* d((H(l+h), h) - d(H(r+h), h)
|
||||||
*/
|
*/
|
||||||
private static class HashComparator implements Comparator<Hash> {
|
private static class HashComparator implements Comparator<Hash>, Serializable {
|
||||||
private final Hash _hash, tmp;
|
private final Hash _hash, tmp;
|
||||||
private final byte[] data;
|
private final byte[] data;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.router.tunnel.pool;
|
package net.i2p.router.tunnel.pool;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -640,7 +641,7 @@ public class TunnelPool {
|
|||||||
* but we use latest expiration first, since we need to sort them by that anyway.
|
* but we use latest expiration first, since we need to sort them by that anyway.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static class LeaseComparator implements Comparator<Lease> {
|
private static class LeaseComparator implements Comparator<Lease>, Serializable {
|
||||||
public int compare(Lease l, Lease r) {
|
public int compare(Lease l, Lease r) {
|
||||||
return r.getEndDate().compareTo(l.getEndDate());
|
return r.getEndDate().compareTo(l.getEndDate());
|
||||||
}
|
}
|
||||||
@ -651,7 +652,7 @@ public class TunnelPool {
|
|||||||
*
|
*
|
||||||
* @since 0.8.10
|
* @since 0.8.10
|
||||||
*/
|
*/
|
||||||
private static class TunnelInfoComparator implements Comparator<TunnelInfo> {
|
private static class TunnelInfoComparator implements Comparator<TunnelInfo>, Serializable {
|
||||||
private final byte[] _base;
|
private final byte[] _base;
|
||||||
private final boolean _avoidZero;
|
private final boolean _avoidZero;
|
||||||
|
|
||||||
|
@ -26,8 +26,9 @@ import net.i2p.util.Log;
|
|||||||
*/
|
*/
|
||||||
public class CoDelBlockingQueue<E extends CDQEntry> extends LinkedBlockingQueue<E> {
|
public class CoDelBlockingQueue<E extends CDQEntry> extends LinkedBlockingQueue<E> {
|
||||||
|
|
||||||
private final I2PAppContext _context;
|
private static final long serialVersionUID = 1L;
|
||||||
private final Log _log;
|
private transient final I2PAppContext _context;
|
||||||
|
private transient final Log _log;
|
||||||
private final String _name;
|
private final String _name;
|
||||||
private final int _capacity;
|
private final int _capacity;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.i2p.router.util;
|
package net.i2p.router.util;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.concurrent.PriorityBlockingQueue;
|
import java.util.concurrent.PriorityBlockingQueue;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -19,8 +20,9 @@ import net.i2p.util.Log;
|
|||||||
*/
|
*/
|
||||||
public class PriBlockingQueue<E extends PQEntry> extends PriorityBlockingQueue<E> {
|
public class PriBlockingQueue<E extends PQEntry> extends PriorityBlockingQueue<E> {
|
||||||
|
|
||||||
protected final I2PAppContext _context;
|
private static final long serialVersionUID = 1L;
|
||||||
protected final Log _log;
|
protected transient final I2PAppContext _context;
|
||||||
|
protected transient final Log _log;
|
||||||
protected final String _name;
|
protected final String _name;
|
||||||
private final AtomicLong _seqNum = new AtomicLong();
|
private final AtomicLong _seqNum = new AtomicLong();
|
||||||
|
|
||||||
@ -114,7 +116,7 @@ public class PriBlockingQueue<E extends PQEntry> extends PriorityBlockingQueue<E
|
|||||||
/**
|
/**
|
||||||
* highest priority first, then lowest sequence number first
|
* highest priority first, then lowest sequence number first
|
||||||
*/
|
*/
|
||||||
private static class PriorityComparator<E extends PQEntry> implements Comparator<E> {
|
private static class PriorityComparator<E extends PQEntry> implements Comparator<E>, Serializable {
|
||||||
public int compare(E l, E r) {
|
public int compare(E l, E r) {
|
||||||
int d = r.getPriority() - l.getPriority();
|
int d = r.getPriority() - l.getPriority();
|
||||||
if (d != 0)
|
if (d != 0)
|
||||||
|
Reference in New Issue
Block a user