You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2016/06/13 15:09:51 UTC
svn commit: r1748248 - in /commons/proper/jcs/trunk:
commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
src/changes/changes.xml
Author: sebb
Date: Mon Jun 13 15:09:51 2016
New Revision: 1748248
URL: http://svn.apache.org/viewvc?rev=1748248&view=rev
Log:
JCS-156 BlockDiskCache is limited to 2GB
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
commons/proper/jcs/trunk/src/changes/changes.xml
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java?rev=1748248&r1=1748247&r2=1748248&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/block/BlockDisk.java Mon Jun 13 15:09:51 2016
@@ -210,7 +210,7 @@ public class BlockDisk
ByteBuffer dataBuffer = ByteBuffer.wrap(data, offset, length);
- long position = calculateByteOffsetForBlock(blocks[i]);
+ long position = calculateByteOffsetForBlockAsLong(blocks[i]);
// write the header
headerBuffer.flip();
int written = fc.write(headerBuffer, position);
@@ -323,7 +323,7 @@ public class BlockDisk
boolean corrupted = false;
long fileLength = fc.size();
- int position = calculateByteOffsetForBlock( block );
+ long position = calculateByteOffsetForBlockAsLong( block );
// if ( position > fileLength )
// {
// corrupted = true;
@@ -374,13 +374,27 @@ public class BlockDisk
/**
* Calculates the file offset for a particular block.
* <p>
- * @param block
- * @return the offset for this block
+ * @param block number
+ * @return the byte offset for this block in the file as an int; may overflow
+ * @deprecacted (since 2.0) use {@link #calculateByteOffsetForBlockAsLong(int)} instead
*/
+ @Deprecated
protected int calculateByteOffsetForBlock( int block )
{
return block * blockSizeBytes;
}
+
+ /**
+ * Calculates the file offset for a particular block.
+ * <p>
+ * @param block number
+ * @return the byte offset for this block in the file as a long
+ * @since 2.0
+ */
+ protected long calculateByteOffsetForBlockAsLong( int block )
+ {
+ return block * blockSizeBytes;
+ }
/**
* The number of blocks needed.
Modified: commons/proper/jcs/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/changes/changes.xml?rev=1748248&r1=1748247&r2=1748248&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/changes/changes.xml (original)
+++ commons/proper/jcs/trunk/src/changes/changes.xml Mon Jun 13 15:09:51 2016
@@ -20,6 +20,9 @@
</properties>
<body>
<release version="2.0" date="unreleased" description="JDK 1.6 based major release">
+ <action issue="JCS-156" dev="sebb" type="fix" due-to="Ryan Fong">
+ BlockDiskCache is limited to 2GB
+ </action>
<action issue="JCS-162" dev="tv" type="fix" due-to="Ryan Fong">
Fix: Memory region properties documentation incorrect
</action>