extending visibility of objects and methods to avoid synthetic accessor methods and increase performance

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6156 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 154bbc3364
commit 1f1399e5c5

@ -1,17 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>yacy</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>yacy</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

@ -44,9 +44,9 @@ import de.anomic.yacy.yacyURL;
public class PhpBB3Dao implements Dao {
private DatabaseConnection conn = null;
private String urlstub, prefix;
private HashMap<Integer, String> users;
protected DatabaseConnection conn = null;
private String urlstub, prefix;
private HashMap<Integer, String> users;
public PhpBB3Dao(
String urlstub,
@ -195,7 +195,7 @@ public class PhpBB3Dao implements Dao {
return queue;
}
private DCEntry parseResultSet(ResultSet rs) throws SQLException, MalformedURLException {
protected DCEntry parseResultSet(ResultSet rs) throws SQLException, MalformedURLException {
yacyURL url;
int item = rs.getInt("post_id");
url = new yacyURL(this.urlstub + "/viewtopic.php?t=" + item);

@ -45,18 +45,15 @@ public class Balancer {
private static final int EcoFSBufferSize = 200;
// class variables
private final ConcurrentHashMap<String, LinkedList<String>>
domainStacks; // a map from domain name part to Lists with url hashs
private ConcurrentLinkedQueue<String>
top;
private TreeMap<Long, String>
delayed;
private ObjectIndex urlFileIndex;
private final File cacheStacksPath;
private long minimumLocalDelta;
private long minimumGlobalDelta;
private int profileErrors;
private long lastDomainStackFill;
private final ConcurrentHashMap<String, LinkedList<String>> domainStacks; // a map from domain name part to Lists with url hashs
private ConcurrentLinkedQueue<String> top;
private TreeMap<Long, String> delayed;
protected ObjectIndex urlFileIndex;
private final File cacheStacksPath;
private long minimumLocalDelta;
private long minimumGlobalDelta;
private int profileErrors;
private long lastDomainStackFill;
public Balancer(final File cachePath, final String stackname, final boolean fullram,
final long minimumLocalDelta, final long minimumGlobalDelta) {

@ -55,11 +55,11 @@ import de.anomic.yacy.logging.Log;
public class CrawlQueues {
private plasmaSwitchboard sb;
private Log log;
private Map<Integer, crawlWorker> workers; // mapping from url hash to Worker thread object
private ProtocolLoader loader;
private final ArrayList<String> remoteCrawlProviderHashes;
protected plasmaSwitchboard sb;
protected Log log;
protected Map<Integer, crawlWorker> workers; // mapping from url hash to Worker thread object
protected ProtocolLoader loader;
private final ArrayList<String> remoteCrawlProviderHashes;
public NoticedURL noticeURL;
public ZURL errorURL, delegatedURL;
@ -538,7 +538,7 @@ public class CrawlQueues {
protected final class crawlWorker extends Thread {
private CrawlEntry entry;
protected CrawlEntry entry;
private final Integer code;
private long start;

@ -52,10 +52,10 @@ import de.anomic.yacy.logging.Log;
public class IndexingStack {
private final Stack sbQueueStack;
private final CrawlProfile profiles;
private final yacySeedDB peers;
private final ConcurrentHashMap<String, QueueEntry> queueInProcess;
protected final CrawlProfile profiles;
protected final Stack sbQueueStack;
protected final yacySeedDB peers;
protected final ConcurrentHashMap<String, QueueEntry> queueInProcess;
public IndexingStack(
final yacySeedDB peers,

@ -58,7 +58,7 @@ public class ZURL {
);
// the class object
private final ObjectIndex urlIndex;
protected final ObjectIndex urlIndex;
private final LinkedList<String> stack;
public ZURL(final File cachePath, final String tablename, final boolean startWithEmptyFile) {

@ -37,9 +37,9 @@ import de.anomic.htmlFilter.htmlFilterCharacterCoding;
*/
public class diff {
private final ArrayList <Part> parts = new ArrayList<Part>();
private final Object[] o;
private final Object[] n;
private final ArrayList <Part> parts = new ArrayList<Part>();
protected final Object[] o;
protected final Object[] n;
/**
* @param o the original <code>String</code>

@ -115,7 +115,7 @@ public final class httpdFileHandler {
private static File htDefaultPath = null;
private static File htLocalePath = null;
private static final class TemplateCacheEntry {
protected static final class TemplateCacheEntry {
Date lastModified;
byte[] content;
}

@ -78,16 +78,16 @@ public class ArrayStack implements BLOB {
public static final long oneMonth = 1000L * 60L * 60L * 24L * 365L / 12L;
private int keylength;
private ByteOrder ordering;
private File heapLocation;
private long fileAgeLimit;
private long fileSizeLimit;
private long repositoryAgeMax;
private long repositorySizeMax;
private List<blobItem> blobs;
private String prefix;
private int buffersize;
protected int keylength;
protected ByteOrder ordering;
private File heapLocation;
private long fileAgeLimit;
private long fileSizeLimit;
private long repositoryAgeMax;
private long repositorySizeMax;
protected List<blobItem> blobs;
private String prefix;
private int buffersize;
// the thread pool for the keeperOf executor service
private ExecutorService executor;

@ -54,8 +54,8 @@ import de.anomic.yacy.dht.FlatWordPartitionScheme;
public class HandleMap implements Iterable<Row.Entry> {
private final Row rowdef;
private ObjectIndexCache index;
private final Row rowdef;
protected ObjectIndexCache index;
/**
* initialize a HandleMap
@ -296,7 +296,8 @@ public class HandleMap implements Iterable<Row.Entry> {
this.l = l;
}
}
private static final entry poisonEntry = new entry(new byte[0], 0);
protected static final entry poisonEntry = new entry(new byte[0], 0);
public static class initDataConsumer implements Callable<HandleMap> {

@ -230,7 +230,7 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable<Row.E
return -1;
}
private int binaryPosition(final byte[] key, final int astart, final int alength) {
protected int binaryPosition(final byte[] key, final int astart, final int alength) {
// returns the exact position of the key if the key exists,
// or a position of an entry that is greater than the key if the
// key does not exist

@ -39,9 +39,10 @@ import java.util.Map;
public class SimpleARC <K, V> {
public final static boolean accessOrder = false; // if false, then a insertion-order is used
private int cacheSize;
private Map<K, V> levelA, levelB;
public final static boolean accessOrder = false; // if false, then a insertion-order is used
protected int cacheSize;
private Map<K, V> levelA, levelB;
public SimpleARC(int cacheSize) {
this.cacheSize = cacheSize / 2;

@ -199,10 +199,10 @@ public class Digest {
private static class md5FilechunkConsumer implements Callable<MessageDigest> {
private BlockingQueue<filechunk> empty;
private BlockingQueue<filechunk> filed;
private static filechunk poison = new filechunk(0);
private MessageDigest digest;
private BlockingQueue<filechunk> empty;
private BlockingQueue<filechunk> filed;
protected static filechunk poison = new filechunk(0);
private MessageDigest digest;
public md5FilechunkConsumer(int bufferSize, int bufferCount) {
empty = new ArrayBlockingQueue<filechunk>(bufferCount);

@ -207,7 +207,7 @@ public final class Stack extends Records {
return row().newEntry(n.getValueRow());
}
private void unlinkNode(final Node n) throws IOException {
protected void unlinkNode(final Node n) throws IOException {
// join chaines over node
final Records.Handle l = n.getOHHandle(left);
final Records.Handle r = n.getOHHandle(right);

@ -73,16 +73,16 @@ public class Table implements ObjectIndex {
public static final int tailCacheForceUsage = 1;
public static final int tailCacheUsageAuto = 2;
public static final long maxarraylength = 134217727L; // that may be the maxmimum size of array length in some JVMs
private static final long minmemremaining = 20 * 1024 * 1024; // if less than this memory is remaininig, the memory copy of a table is abandoned
private RowSet table;
private HandleMap index;
private BufferedEcoFS file;
private Row rowdef;
private int fail;
private File tablefile;
private Row taildef;
private final int buffersize;
public static final long maxarraylength = 134217727L; // that may be the maxmimum size of array length in some JVMs
private static final long minmemremaining = 20 * 1024 * 1024; // if less than this memory is remaininig, the memory copy of a table is abandoned
private int fail;
private final int buffersize;
protected HandleMap index;
protected BufferedEcoFS file;
protected Row rowdef;
protected File tablefile;
protected RowSet table;
protected Row taildef;
public Table(final File tablefile, final Row rowdef, final int useTailCache, final int buffersize, final int initialSpace) {
this.tablefile = tablefile;

@ -48,13 +48,13 @@ import de.anomic.yacy.logging.Log;
*/
public class IODispatcher extends Thread {
private Semaphore controlQueue;
private Semaphore termination;
private ArrayBlockingQueue<MergeJob> mergeQueue;
private ArrayBlockingQueue<DumpJob<? extends Reference>> dumpQueue;
private Semaphore controlQueue;
private Semaphore termination;
private ArrayBlockingQueue<MergeJob> mergeQueue;
private ArrayBlockingQueue<DumpJob<? extends Reference>> dumpQueue;
//private ReferenceFactory<ReferenceType> factory;
private boolean terminate;
private int writeBufferSize;
private boolean terminate;
protected int writeBufferSize;
public IODispatcher(int dumpQueueLength, int mergeQueueLength, int writeBufferSize) {
this.termination = new Semaphore(0);

@ -58,10 +58,10 @@ import de.anomic.yacy.logging.Log;
public final class MetadataRepository implements Iterable<byte[]> {
// class objects
private ObjectIndex urlIndexFile;
private Export exportthread; // will have a export thread assigned if exporter is running
private File location;
private ArrayList<hostStat> statsDump;
protected ObjectIndex urlIndexFile;
private Export exportthread; // will have a export thread assigned if exporter is running
private File location;
private ArrayList<hostStat> statsDump;
public MetadataRepository(final File path) {
this.location = path;

@ -50,8 +50,8 @@ import de.anomic.kelondro.util.ByteBuffer;
*/
public class ReferenceContainer<ReferenceType extends Reference> extends RowSet {
private byte[] termHash;
private ReferenceFactory<ReferenceType> factory;
private byte[] termHash;
protected ReferenceFactory<ReferenceType> factory;
public ReferenceContainer(final ReferenceFactory<ReferenceType> factory, final byte[] termHash, final RowSet collection) {
super(collection);

@ -40,10 +40,10 @@ import de.anomic.yacy.logging.Log;
public final class ReferenceContainerArray<ReferenceType extends Reference> {
private final ReferenceFactory<ReferenceType> factory;
private final Row payloadrow;
private final ArrayStack array;
private final IODispatcher merger;
protected final ReferenceFactory<ReferenceType> factory;
protected final Row payloadrow;
protected final ArrayStack array;
private final IODispatcher merger;
/**
* open a index container based on a BLOB dump. The content of the BLOB will not be read
@ -128,7 +128,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
// plus the mentioned features
private final boolean rot;
private CloneableIterator<byte[]> iterator;
protected CloneableIterator<byte[]> iterator;
public heapCacheIterator(final byte[] startWordHash, final boolean rot) throws IOException {
this.rot = rot;

@ -48,9 +48,9 @@ import de.anomic.yacy.logging.Log;
public final class ReferenceContainerCache<ReferenceType extends Reference> extends AbstractIndex<ReferenceType> implements Index<ReferenceType>, IndexReader<ReferenceType>, Iterable<ReferenceContainer<ReferenceType>> {
private final Row payloadrow;
private final ByteOrder termOrder;
private Map<ByteArray, ReferenceContainer<ReferenceType>> cache;
private final Row payloadrow;
private final ByteOrder termOrder;
protected Map<ByteArray, ReferenceContainer<ReferenceType>> cache;
/**
* opens an existing heap file in undefined mode

@ -68,12 +68,12 @@ public final class Segment {
public static final ReferenceFactory<NavigationReference> navigationReferenceFactory = new NavigationReferenceFactory();
public static final ByteOrder wordOrder = Base64Order.enhancedCoder;
private final Log log;
private final IndexCell<WordReference> termIndex;
private final IndexCell<NavigationReference> authorNavIndex;
private final MetadataRepository urlMetadata;
private final File segmentPath;
private final IODispatcher merger;
private final Log log;
protected final IndexCell<WordReference> termIndex;
private final IndexCell<NavigationReference> authorNavIndex;
protected final MetadataRepository urlMetadata;
private final File segmentPath;
private final IODispatcher merger;
public Segment(
final Log log,

@ -177,7 +177,7 @@ public class UPnP {
// DiscoveryAdvertisement.getInstance().unRegisterEvent(DiscoveryAdvertisement.EVENT_SSDP_BYE_BYE, devicetype, handler);
}
private static class Handler implements DiscoveryEventHandler {
protected static class Handler implements DiscoveryEventHandler {
public void eventSSDPAlive(String usn, String udn, String nt, String maxAge, URL location) {
InternetGatewayDevice[] newIGD = { null };

@ -84,13 +84,13 @@ public final class serverCore extends serverAbstractBusyThread implements server
/**
* Line End of HTTP/ICAP headers
*/
public static final byte[] CRLF = {CR, LF};
public static final String CRLF_STRING = new String(CRLF);
public static final String LF_STRING = new String(new byte[]{LF});
public static final Class<?>[] stringType = {"".getClass()}; // set up some reflection
public static final long startupTime = System.currentTimeMillis();
public static final ThreadGroup sessionThreadGroup = new ThreadGroup("sessionThreadGroup");
private static final HashMap<String, Object> commandObjMethodCache = new HashMap<String, Object>(5);
public static final byte[] CRLF = {CR, LF};
public static final String CRLF_STRING = new String(CRLF);
public static final String LF_STRING = new String(new byte[]{LF});
public static final Class<?>[] stringType = {"".getClass()}; // set up some reflection
public static final long startupTime = System.currentTimeMillis();
public static final ThreadGroup sessionThreadGroup = new ThreadGroup("sessionThreadGroup");
protected static final HashMap<String, Object> commandObjMethodCache = new HashMap<String, Object>(5);
/**
* will be increased with each session and is used to return a hash code

@ -28,16 +28,16 @@ import de.anomic.yacy.logging.Log;
*/
public class DidYouMean {
private static final char[] alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',
protected static final char[] alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',
'q','r','s','t','u','v','w','x','y','z','\u00e4','\u00f6','\u00fc','\u00df'};
public static final int availableCPU = Runtime.getRuntime().availableProcessors();
final LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<String>();
private final Set<String> set;
private final IndexCell<WordReference> index;
private String word;
private int len;
protected final Set<String> set;
protected final IndexCell<WordReference> index;
protected String word;
protected int len;
/**
@ -140,7 +140,7 @@ public class DidYouMean {
* based on the given alphabet and puts it on the blocking queue, to be 'consumed' by a consumer thread.<p/>
* <b>Note:</b> the loop runs (alphabet.length * len) tests.
*/
private class ChangingOneLetter extends Thread {
public class ChangingOneLetter extends Thread {
public void run() {
String s;
@ -161,7 +161,7 @@ public class DidYouMean {
* and puts it on the blocking queue, to be 'consumed' by a consumer thread.<p/>
* <b>Note:</b> the loop runs (len) tests.
*/
private class DeletingOneLetter extends Thread {
protected class DeletingOneLetter extends Thread {
public void run() {
String s;
@ -180,7 +180,7 @@ public class DidYouMean {
* based on the given alphabet and puts it on the blocking queue, to be 'consumed' by a consumer thread.<p/>
* <b>Note:</b> the loop runs (alphabet.length * len) tests.
*/
private class AddingOneLetter extends Thread {
protected class AddingOneLetter extends Thread {
public void run() {
String s;
@ -201,7 +201,7 @@ public class DidYouMean {
* and puts it on the blocking queue, to be 'consumed' by a consumer thread.<p/>
* <b>Note:</b> the loop runs (len-1) tests.
*/
private class ReversingTwoConsecutiveLetters extends Thread {
protected class ReversingTwoConsecutiveLetters extends Thread {
public void run() {
String s;
@ -245,7 +245,7 @@ public class DidYouMean {
* wordSizeComparator is used by DidYouMean to order terms by index.count()<p/>
* <b>Warning:</b> this causes heavy i/o
*/
private class wordSizeComparator implements Comparator<String> {
protected class wordSizeComparator implements Comparator<String> {
public int compare(final String o1, final String o2) {
final Integer i1 = index.count(Word.word2hash(o1));
final Integer i2 = index.count(Word.word2hash(o2));

@ -79,15 +79,15 @@ public class mediawikiIndex extends Thread {
private static final byte[] pagestartb = pagestart.getBytes();
private static final byte[] pageendb = pageend.getBytes();
private wikiParser wparser;
private plasmaParser hparser;
private String urlStub;
public File sourcefile;
public File targetdir;
public int count;
private long start;
private long docsize;
private int approxdocs;
protected wikiParser wparser;
protected plasmaParser hparser;
protected String urlStub;
public File sourcefile;
public File targetdir;
public int count;
private long start;
private long docsize;
private int approxdocs;
private static final int docspermbinxmlbz2 = 800; // documents per megabyte in a xml.bz2 wikimedia dump
@ -328,7 +328,7 @@ public class mediawikiIndex extends Thread {
private BlockingQueue<wikisourcerecord> entries;
PrintWriter out;
private static wikisourcerecord poison = new wikisourcerecord("", 0, 0);
protected static wikisourcerecord poison = new wikisourcerecord("", 0, 0);
int count;
public indexProducer(int bufferCount, File indexFile) throws IOException {
@ -375,10 +375,10 @@ public class mediawikiIndex extends Thread {
private static class wikiConsumer implements Callable<Integer> {
private BlockingQueue<wikiraw> entries;
private static wikiraw poison = new wikiraw(new byte[0], 0, 0);
private indexProducer producer;
private int count;
private BlockingQueue<wikiraw> entries;
protected static wikiraw poison = new wikiraw(new byte[0], 0, 0);
private indexProducer producer;
private int count;
public wikiConsumer(int bufferCount, indexProducer producer) {
entries = new ArrayBlockingQueue<wikiraw>(bufferCount);

@ -43,7 +43,7 @@ import de.anomic.server.serverSystem;
public final class Tray {
private static plasmaSwitchboard sb;
protected static plasmaSwitchboard sb;
private static nativeTrayIcon ti;
private static boolean isIntegrated; // browser integration
@ -142,7 +142,7 @@ public final class Tray {
}
private static void trayClickAction(){ //doubleclick
protected static void trayClickAction(){ //doubleclick
if (lockBrowserPopup) {
String label;
if(deutsch) label = "Bitte warten bis YaCy gestartet ist.";
@ -153,7 +153,7 @@ public final class Tray {
}
}
private static void openBrowser(final String browserPopUpPage){
protected static void openBrowser(final String browserPopUpPage){
if(isIntegrated) return;
// no need for https, because we are on localhost
serverSystem.openBrowser("http://localhost:" + sb.getConfig("port", "8080") + "/" + browserPopUpPage);

@ -242,7 +242,7 @@ public class PeerSelection {
* @param minVersion
* @return
*/
private static Iterator<yacySeed> getDHTSeeds(yacySeedDB seedDB, final byte[] firstHash, final float minVersion) {
protected static Iterator<yacySeed> getDHTSeeds(yacySeedDB seedDB, final byte[] firstHash, final float minVersion) {
// enumerates seed-type objects: all seeds with starting point in the middle, rotating at the end/beginning
return new seedDHTEnum(seedDB, firstHash, minVersion);
}

@ -46,12 +46,12 @@ import de.anomic.yacy.logging.Log;
public class Transmission {
private Log log;
private MetadataRepository repository;
private yacySeedDB seeds;
private Index<WordReference> backend;
private boolean gzipBody4Transfer;
private int timeout4Transfer;
protected Log log;
protected MetadataRepository repository;
protected yacySeedDB seeds;
protected boolean gzipBody4Transfer;
protected int timeout4Transfer;
protected Index<WordReference> backend;
public Transmission(
Log log,

@ -301,9 +301,9 @@ public final class Log {
}
}
private static logEntry poison = new logEntry();
private static BlockingQueue<logEntry> logQueue = new LinkedBlockingQueue<logEntry>();
private static logRunner logRunnerThread = null;
protected static logEntry poison = new logEntry();
protected static BlockingQueue<logEntry> logQueue = new LinkedBlockingQueue<logEntry>();
private static logRunner logRunnerThread = null;
protected static class logRunner extends Thread {
public logRunner() {

Loading…
Cancel
Save