|
From: <sgo...@us...> - 2010-09-14 17:52:29
|
Revision: 3547
http://bigdata.svn.sourceforge.net/bigdata/?rev=3547&view=rev
Author: sgossard
Date: 2010-09-14 17:52:22 +0000 (Tue, 14 Sep 2010)
Log Message:
-----------
[maven_scaleout] : Breaking transitive dependency cycle between util, io, and counters packages.
Modified Paths:
--------------
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/IndexSegmentCheckpoint.java
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/AbstractJournal.java
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/FileMetadata.java
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/RWStrategy.java
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/RootBlockView.java
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/TemporaryRawStore.java
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/BlobAllocator.java
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/FixedAllocator.java
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/RWStore.java
branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestAbort.java
branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestRollbackCommit.java
branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestRootBlockView.java
branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/util/TestChecksumUtility.java
Added Paths:
-----------
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/io/ChecksumUtility.java
Removed Paths:
-------------
branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/util/ChecksumUtility.java
Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/IndexSegmentCheckpoint.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/IndexSegmentCheckpoint.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/IndexSegmentCheckpoint.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -37,7 +37,7 @@
import com.bigdata.journal.RootBlockException;
import com.bigdata.rawstore.Bytes;
import com.bigdata.rawstore.IAddressManager;
-import com.bigdata.util.ChecksumUtility;
+import com.bigdata.io.ChecksumUtility;
/**
* The checkpoint record for an {@link IndexSegment}.
Copied: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/io/ChecksumUtility.java (from rev 3544, branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/util/ChecksumUtility.java)
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/io/ChecksumUtility.java (rev 0)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/io/ChecksumUtility.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -0,0 +1,160 @@
+/**
+
+Copyright (C) SYSTAP, LLC 2006-2007. All rights reserved.
+
+Contact:
+ SYSTAP, LLC
+ 4501 Tower Road
+ Greensboro, NC 27410
+ lic...@bi...
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+/*
+ * Created on Nov 5, 2006
+ */
+
+package com.bigdata.io;
+
+import java.nio.BufferUnderflowException;
+import java.nio.ByteBuffer;
+import java.util.zip.Adler32;
+
+/**
+ * Utility class for computing the {@link Adler32} checksum of a buffer. This
+ * class is NOT thread-safe.
+ *
+ * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
+ * @version $Id$
+ */
+public class ChecksumUtility {
+
+ private static ThreadLocal threadChk = new ThreadLocal();
+ /**
+ * static access to a ThreadLocal Checksum utility
+ *
+ * @return the ChecksumUtility
+ */
+ public static ChecksumUtility getCHK() {
+ ChecksumUtility chk = (ChecksumUtility) threadChk.get();
+
+ if (chk == null) {
+ chk = new ChecksumUtility();
+ threadChk.set(chk);
+ }
+
+ return chk;
+ }
+
+ /**
+ * Private helper object.
+ */
+ private final Adler32 chk = new Adler32();
+
+ /**
+ * Compute the {@link Adler32} checksum of the buffer. The position,
+ * mark, and limit are unchanged by this operation. The operation is
+ * optimized when the buffer is backed by an array.
+ *
+ * @param buf
+ * The buffer.
+ * @param pos
+ * The starting position.
+ * @param limit
+ * The limit.
+ *
+ * @return The checksum.
+ */
+ public int checksum(final ByteBuffer buf, final int pos, final int limit) {
+
+ assert buf != null;
+ assert pos >= 0;
+ assert limit > pos;
+
+ // reset before computing the checksum.
+ chk.reset();
+
+ if (buf.hasArray()) {
+
+ /*
+ * Optimized when the buffer is backed by an array.
+ */
+
+ final byte[] bytes = buf.array();
+
+ final int len = limit - pos;
+
+ if (pos > bytes.length - len) {
+
+ throw new BufferUnderflowException();
+
+ }
+
+ chk.update(bytes, pos + buf.arrayOffset(), len);
+
+ } else {
+
+ for (int i = pos; i < limit; i++) {
+
+ chk.update(buf.get(i));
+
+ }
+
+ }
+
+ /*
+ * The Adler checksum is a 32-bit value.
+ */
+
+ return (int) chk.getValue();
+
+ }
+
+ public int checksum(final IByteArraySlice slice) {
+
+ assert slice != null;
+
+ // reset before computing the checksum.
+ chk.reset();
+
+ chk.update(slice.array(), slice.off(), slice.len());
+
+ /*
+ * The Adler checksum is a 32-bit value.
+ */
+
+ return (int) chk.getValue();
+
+ }
+
+ public int checksum(final byte[] buf, int sze) {
+ return checksum(buf, 0, sze);
+ }
+
+ public int checksum(final byte[] buf, int off, int sze) {
+
+ assert buf != null;
+
+ // reset before computing the checksum.
+ chk.reset();
+
+ chk.update(buf, off, sze);
+
+ /*
+ * The Adler checksum is a 32-bit value.
+ */
+
+ return (int) chk.getValue();
+ }
+}
Property changes on: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/io/ChecksumUtility.java
___________________________________________________________________
Added: svn:keywords
+ Id Date Revision Author HeadURL
Added: svn:eol-style
+ native
Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/AbstractJournal.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/AbstractJournal.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/AbstractJournal.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -41,6 +41,7 @@
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
+import com.bigdata.io.ChecksumUtility;
import org.apache.log4j.Logger;
import com.bigdata.BigdataStatics;
@@ -70,7 +71,6 @@
import com.bigdata.rawstore.WormAddressManager;
import com.bigdata.relation.locator.IResourceLocator;
import com.bigdata.resources.ResourceManager;
-import com.bigdata.util.ChecksumUtility;
/**
* <p>
Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/FileMetadata.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/FileMetadata.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/FileMetadata.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -31,6 +31,7 @@
import java.nio.channels.FileChannel;
import java.util.UUID;
+import com.bigdata.io.ChecksumUtility;
import org.apache.log4j.Logger;
import com.bigdata.io.DirectBufferPool;
@@ -38,7 +39,6 @@
import com.bigdata.io.IReopenChannel;
import com.bigdata.rawstore.Bytes;
import com.bigdata.rawstore.WormAddressManager;
-import com.bigdata.util.ChecksumUtility;
/**
* Helper object used when opening or creating journal file in any of the
Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/RWStrategy.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/RWStrategy.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/RWStrategy.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -30,10 +30,10 @@
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
-import java.nio.channels.ClosedByInterruptException;
import java.nio.channels.FileChannel;
import java.util.UUID;
+import com.bigdata.io.ChecksumUtility;
import org.apache.log4j.Logger;
import com.bigdata.counters.CounterSet;
@@ -41,7 +41,6 @@
import com.bigdata.rawstore.AbstractRawStore;
import com.bigdata.rawstore.IAddressManager;
import com.bigdata.rwstore.RWStore;
-import com.bigdata.util.ChecksumUtility;
/**
* The hook that accesses the RWStore to provide read/write services as opposed
Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/RootBlockView.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/RootBlockView.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/RootBlockView.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -30,6 +30,7 @@
import java.nio.ByteBuffer;
import java.util.UUID;
+import com.bigdata.io.ChecksumUtility;
import org.apache.log4j.Logger;
import com.bigdata.btree.IndexMetadata;
@@ -38,7 +39,6 @@
import com.bigdata.rawstore.WormAddressManager;
import com.bigdata.resources.ResourceManager;
import com.bigdata.rwstore.RWStore;
-import com.bigdata.util.ChecksumUtility;
/**
* A view onto a root block of the {@link Journal}.
Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/TemporaryRawStore.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/TemporaryRawStore.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/TemporaryRawStore.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -44,7 +44,7 @@
import com.bigdata.rawstore.IMRMW;
import com.bigdata.rawstore.WormAddressManager;
import com.bigdata.relation.locator.ILocatableResource;
-import com.bigdata.util.ChecksumUtility;
+import com.bigdata.io.ChecksumUtility;
/**
* A non-restart-safe store for temporary data that buffers data in memory until
Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/BlobAllocator.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/BlobAllocator.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/BlobAllocator.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -5,9 +5,8 @@
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
-import com.bigdata.util.ChecksumUtility;
+import com.bigdata.io.ChecksumUtility;
/**
* BlobAllocator
Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/FixedAllocator.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/FixedAllocator.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/FixedAllocator.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -27,10 +27,9 @@
import java.util.*;
import java.io.*;
+import com.bigdata.io.ChecksumUtility;
import org.apache.log4j.Logger;
-import com.bigdata.util.ChecksumUtility;
-
/**
* FixedAllocator
*
Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/RWStore.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/RWStore.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/rwstore/RWStore.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -45,7 +45,7 @@
import com.bigdata.journal.FileMetadata;
import com.bigdata.journal.IRootBlockView;
import com.bigdata.journal.RWStrategy.FileMetadataView;
-import com.bigdata.util.ChecksumUtility;
+import com.bigdata.io.ChecksumUtility;
/**
* Storage class
Deleted: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/util/ChecksumUtility.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/util/ChecksumUtility.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/util/ChecksumUtility.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -1,162 +0,0 @@
-/**
-
-Copyright (C) SYSTAP, LLC 2006-2007. All rights reserved.
-
-Contact:
- SYSTAP, LLC
- 4501 Tower Road
- Greensboro, NC 27410
- lic...@bi...
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-/*
- * Created on Nov 5, 2006
- */
-
-package com.bigdata.util;
-
-import java.nio.BufferUnderflowException;
-import java.nio.ByteBuffer;
-import java.util.zip.Adler32;
-
-import com.bigdata.io.IByteArraySlice;
-
-/**
- * Utility class for computing the {@link Adler32} checksum of a buffer. This
- * class is NOT thread-safe.
- *
- * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
- */
-public class ChecksumUtility {
-
- private static ThreadLocal threadChk = new ThreadLocal();
- /**
- * static access to a ThreadLocal Checksum utility
- *
- * @return the ChecksumUtility
- */
- public static ChecksumUtility getCHK() {
- ChecksumUtility chk = (ChecksumUtility) threadChk.get();
-
- if (chk == null) {
- chk = new ChecksumUtility();
- threadChk.set(chk);
- }
-
- return chk;
- }
-
- /**
- * Private helper object.
- */
- private final Adler32 chk = new Adler32();
-
- /**
- * Compute the {@link Adler32} checksum of the buffer. The position,
- * mark, and limit are unchanged by this operation. The operation is
- * optimized when the buffer is backed by an array.
- *
- * @param buf
- * The buffer.
- * @param pos
- * The starting position.
- * @param limit
- * The limit.
- *
- * @return The checksum.
- */
- public int checksum(final ByteBuffer buf, final int pos, final int limit) {
-
- assert buf != null;
- assert pos >= 0;
- assert limit > pos;
-
- // reset before computing the checksum.
- chk.reset();
-
- if (buf.hasArray()) {
-
- /*
- * Optimized when the buffer is backed by an array.
- */
-
- final byte[] bytes = buf.array();
-
- final int len = limit - pos;
-
- if (pos > bytes.length - len) {
-
- throw new BufferUnderflowException();
-
- }
-
- chk.update(bytes, pos + buf.arrayOffset(), len);
-
- } else {
-
- for (int i = pos; i < limit; i++) {
-
- chk.update(buf.get(i));
-
- }
-
- }
-
- /*
- * The Adler checksum is a 32-bit value.
- */
-
- return (int) chk.getValue();
-
- }
-
- public int checksum(final IByteArraySlice slice) {
-
- assert slice != null;
-
- // reset before computing the checksum.
- chk.reset();
-
- chk.update(slice.array(), slice.off(), slice.len());
-
- /*
- * The Adler checksum is a 32-bit value.
- */
-
- return (int) chk.getValue();
-
- }
-
- public int checksum(final byte[] buf, int sze) {
- return checksum(buf, 0, sze);
- }
-
- public int checksum(final byte[] buf, int off, int sze) {
-
- assert buf != null;
-
- // reset before computing the checksum.
- chk.reset();
-
- chk.update(buf, off, sze);
-
- /*
- * The Adler checksum is a 32-bit value.
- */
-
- return (int) chk.getValue();
- }
-}
Modified: branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestAbort.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestAbort.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestAbort.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -35,7 +35,7 @@
import com.bigdata.btree.IndexMetadata;
import com.bigdata.cache.IGlobalLRU.ILRUCache;
import com.bigdata.io.DirectBufferPool;
-import com.bigdata.util.ChecksumUtility;
+import com.bigdata.io.ChecksumUtility;
/**
* Test the ability to abort (discard an uncommitted write set). This is a test
Modified: branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestRollbackCommit.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestRollbackCommit.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestRollbackCommit.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -29,7 +29,7 @@
import java.nio.ByteBuffer;
-import com.bigdata.util.ChecksumUtility;
+import com.bigdata.io.ChecksumUtility;
/**
* Test the ability to rollback a commit.
Modified: branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestRootBlockView.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestRootBlockView.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestRootBlockView.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -31,11 +31,11 @@
import java.util.Random;
import java.util.UUID;
+import com.bigdata.io.ChecksumUtility;
import junit.framework.TestCase2;
import com.bigdata.rawstore.TestWormAddressManager;
import com.bigdata.rawstore.WormAddressManager;
-import com.bigdata.util.ChecksumUtility;
import com.bigdata.util.MillisecondTimestampFactory;
/**
Modified: branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/util/TestChecksumUtility.java
===================================================================
--- branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/util/TestChecksumUtility.java 2010-09-14 17:41:47 UTC (rev 3546)
+++ branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/util/TestChecksumUtility.java 2010-09-14 17:52:22 UTC (rev 3547)
@@ -31,6 +31,7 @@
import java.util.Random;
import java.util.zip.Adler32;
+import com.bigdata.io.ChecksumUtility;
import junit.framework.TestCase;
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|