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

@ -10,6 +10,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>

@ -44,7 +44,7 @@ import de.anomic.yacy.yacyURL;
public class PhpBB3Dao implements Dao {
private DatabaseConnection conn = null;
protected DatabaseConnection conn = null;
private String urlstub, prefix;
private HashMap<Integer, String> users;
@ -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,13 +45,10 @@ 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 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;

@ -55,10 +55,10 @@ 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;
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;
@ -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) {

@ -38,8 +38,8 @@ import de.anomic.htmlFilter.htmlFilterCharacterCoding;
public class diff {
private final ArrayList <Part> parts = new ArrayList<Part>();
private final Object[] o;
private final Object[] n;
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,14 +78,14 @@ public class ArrayStack implements BLOB {
public static final long oneMonth = 1000L * 60L * 60L * 24L * 365L / 12L;
private int keylength;
private ByteOrder ordering;
protected int keylength;
protected ByteOrder ordering;
private File heapLocation;
private long fileAgeLimit;
private long fileSizeLimit;
private long repositoryAgeMax;
private long repositorySizeMax;
private List<blobItem> blobs;
protected List<blobItem> blobs;
private String prefix;
private int buffersize;

@ -55,7 +55,7 @@ import de.anomic.yacy.dht.FlatWordPartitionScheme;
public class HandleMap implements Iterable<Row.Entry> {
private final Row rowdef;
private ObjectIndexCache index;
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

@ -40,7 +40,8 @@ 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;
protected int cacheSize;
private Map<K, V> levelA, levelB;
public SimpleARC(int cacheSize) {

@ -201,7 +201,7 @@ public class Digest {
private BlockingQueue<filechunk> empty;
private BlockingQueue<filechunk> filed;
private static filechunk poison = new filechunk(0);
protected static filechunk poison = new filechunk(0);
private MessageDigest digest;
public md5FilechunkConsumer(int bufferSize, int 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);

@ -75,14 +75,14 @@ public class Table implements ObjectIndex {
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;
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;

@ -54,7 +54,7 @@ public class IODispatcher extends Thread {
private ArrayBlockingQueue<DumpJob<? extends Reference>> dumpQueue;
//private ReferenceFactory<ReferenceType> factory;
private boolean terminate;
private int writeBufferSize;
protected int writeBufferSize;
public IODispatcher(int dumpQueueLength, int mergeQueueLength, int writeBufferSize) {
this.termination = new Semaphore(0);

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

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

@ -40,9 +40,9 @@ 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;
protected final ReferenceFactory<ReferenceType> factory;
protected final Row payloadrow;
protected final ArrayStack array;
private final IODispatcher merger;
/**
@ -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;

@ -50,7 +50,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte
private final Row payloadrow;
private final ByteOrder termOrder;
private Map<ByteArray, ReferenceContainer<ReferenceType>> cache;
protected Map<ByteArray, ReferenceContainer<ReferenceType>> cache;
/**
* opens an existing heap file in undefined mode

@ -69,9 +69,9 @@ public final class Segment {
public static final ByteOrder wordOrder = Base64Order.enhancedCoder;
private final Log log;
private final IndexCell<WordReference> termIndex;
protected final IndexCell<WordReference> termIndex;
private final IndexCell<NavigationReference> authorNavIndex;
private final MetadataRepository urlMetadata;
protected final MetadataRepository urlMetadata;
private final File segmentPath;
private final IODispatcher merger;

@ -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 };

@ -90,7 +90,7 @@ public final class serverCore extends serverAbstractBusyThread implements server
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);
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,9 +79,9 @@ 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;
protected wikiParser wparser;
protected plasmaParser hparser;
protected String urlStub;
public File sourcefile;
public File targetdir;
public int count;
@ -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 {
@ -376,7 +376,7 @@ 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);
protected static wikiraw poison = new wikiraw(new byte[0], 0, 0);
private indexProducer producer;
private int count;

@ -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,8 +301,8 @@ public final class Log {
}
}
private static logEntry poison = new logEntry();
private static BlockingQueue<logEntry> logQueue = new LinkedBlockingQueue<logEntry>();
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 {

Loading…
Cancel
Save