Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2006-08-10 11:53:58 -0400
committerThomas Watson2006-08-10 11:53:58 -0400
commit7e266514f1d9bd5574ecae1179b573ef9c725b3e (patch)
tree14fbf5280c17cf14d043c5963362c190dbd1ba75
parent29caf249dcf878375cac40b87e769a6e45908cfe (diff)
downloadrt.equinox.framework-7e266514f1d9bd5574ecae1179b573ef9c725b3e.tar.gz
rt.equinox.framework-7e266514f1d9bd5574ecae1179b573ef9c725b3e.tar.xz
rt.equinox.framework-7e266514f1d9bd5574ecae1179b573ef9c725b3e.zip
Bug 150711 StateReader should use smaller file buffers
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
index 17bb6ff7e..3a12206a3 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
@@ -22,6 +22,8 @@ import org.osgi.framework.Version;
class StateReader {
public static final String STATE_FILE = ".state"; //$NON-NLS-1$
public static final String LAZY_FILE = ".lazy"; //$NON-NLS-1$
+ private static final int BUFFER_SIZE_LAZY = 4096;
+ private static final int BUFFER_SIZE_FULLYREAD = 16384;
private static final SecureAction secureAction = new SecureAction();
// objectTable will be a hashmap of objects. The objects will be things
@@ -70,7 +72,7 @@ class StateReader {
}
private boolean readState(StateImpl state, long expectedTimestamp) throws IOException {
- DataInputStream in = new DataInputStream(new BufferedInputStream(secureAction.getFileInputStream(stateFile), 65536));
+ DataInputStream in = new DataInputStream(new BufferedInputStream(secureAction.getFileInputStream(stateFile), BUFFER_SIZE_FULLYREAD));
DataInputStream lazyIn = null;
try {
if (in.readByte() != STATE_CACHE_VERSION)
@@ -109,8 +111,8 @@ class StateReader {
state.setResolved(in.readBoolean());
if (lazyLoad)
return true;
- //read in from lazy data file
- lazyIn = new DataInputStream(new BufferedInputStream(secureAction.getFileInputStream(lazyFile), 65536));
+ //read in from lazy data file; using the fully read buffer size because we are reading the complete file in.
+ lazyIn = new DataInputStream(new BufferedInputStream(secureAction.getFileInputStream(lazyFile), BUFFER_SIZE_FULLYREAD));
for (int i = 0; i < numBundles; i++)
readBundleDescriptionLazyData(lazyIn, 0);
} finally {
@@ -551,7 +553,7 @@ class StateReader {
private DataInputStream openLazyFile() throws IOException {
if (lazyFile == null)
throw new IOException(); // TODO error message here!
- return new DataInputStream(new BufferedInputStream(secureAction.getFileInputStream(lazyFile), 65536));
+ return new DataInputStream(new BufferedInputStream(secureAction.getFileInputStream(lazyFile), BUFFER_SIZE_LAZY));
}
boolean isLazyLoaded() {

Back to the top