HBASE-11167 Avoid usage of java.rmi package Exception in MemStore. (Anoop)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1595100 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
anoopsamjohn 2014-05-16 04:13:14 +00:00
parent 4c8510f852
commit 247eadc582
5 changed files with 52 additions and 11 deletions

View File

@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.regionserver;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.rmi.UnexpectedException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@ -176,14 +175,15 @@ public class DefaultMemStore implements MemStore {
/**
* The passed snapshot was successfully persisted; it can be let go.
* @param id Id of the snapshot to clean out.
* @throws UnexpectedException
* @throws UnexpectedStateException
* @see #snapshot()
*/
@Override
public void clearSnapshot(long id) throws UnexpectedException {
public void clearSnapshot(long id) throws UnexpectedStateException {
MemStoreLAB tmpAllocator = null;
if (this.snapshotId != id) {
throw new UnexpectedException("Current snapshot id is " + this.snapshotId + ",passed " + id);
throw new UnexpectedStateException("Current snapshot id is " + this.snapshotId + ",passed "
+ id);
}
// OK. Passed in snapshot is same as current snapshot. If not-empty,
// create a new snapshot and let the old one go.

View File

@ -17,7 +17,6 @@
*/
package org.apache.hadoop.hbase.regionserver;
import java.rmi.UnexpectedException;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience;
@ -44,9 +43,10 @@ public interface MemStore extends HeapSize {
/**
* Clears the current snapshot of the Memstore.
* @param id
* @throws UnexpectedStateException
* @see #snapshot()
*/
void clearSnapshot(long id) throws UnexpectedException;
void clearSnapshot(long id) throws UnexpectedStateException;
/**
* On flush, how much memory we will clear.

View File

@ -0,0 +1,43 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.regionserver;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.hbase.HBaseIOException;
@InterfaceAudience.Private
public class UnexpectedStateException extends HBaseIOException {
private static final long serialVersionUID = -6727953144066746071L;
public UnexpectedStateException() {
super();
}
public UnexpectedStateException(String message) {
super(message);
}
public UnexpectedStateException(String message, Throwable cause) {
super(message, cause);
}
public UnexpectedStateException(Throwable cause) {
super(cause);
}
}

View File

@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.regionserver;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.rmi.UnexpectedException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -961,7 +960,7 @@ public class TestDefaultMemStore extends TestCase {
return ROW_COUNT;
}
private long runSnapshot(final DefaultMemStore hmc) throws UnexpectedException {
private long runSnapshot(final DefaultMemStore hmc) throws UnexpectedStateException {
// Save off old state.
int oldHistorySize = hmc.snapshot.size();
MemStoreSnapshot snapshot = hmc.snapshot();

View File

@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.regionserver;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.rmi.UnexpectedException;
import java.util.List;
import java.util.Random;
@ -97,7 +96,7 @@ public class TestMemStoreChunkPool {
}
@Test
public void testPuttingBackChunksAfterFlushing() throws UnexpectedException {
public void testPuttingBackChunksAfterFlushing() throws UnexpectedStateException {
byte[] row = Bytes.toBytes("testrow");
byte[] fam = Bytes.toBytes("testfamily");
byte[] qf1 = Bytes.toBytes("testqualifier1");
@ -132,7 +131,7 @@ public class TestMemStoreChunkPool {
@Test
public void testPuttingBackChunksWithOpeningScanner()
throws UnexpectedException {
throws UnexpectedStateException {
byte[] row = Bytes.toBytes("testrow");
byte[] fam = Bytes.toBytes("testfamily");
byte[] qf1 = Bytes.toBytes("testqualifier1");