001/** 002 * Copyright The Apache Software Foundation 003 * 004 * Licensed to the Apache Software Foundation (ASF) under one or more 005 * contributor license agreements. See the NOTICE file distributed with this 006 * work for additional information regarding copyright ownership. The ASF 007 * licenses this file to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 015 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 016 * License for the specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.hadoop.hbase.io.hfile.bucket; 020 021import java.io.IOException; 022 023import org.apache.yetus.audience.InterfaceAudience; 024 025/** 026 * Thrown by {@link BucketAllocator#allocateBlock(int)} when cache is full for 027 * the requested size 028 */ 029@InterfaceAudience.Private 030public class CacheFullException extends IOException { 031 private static final long serialVersionUID = 3265127301824638920L; 032 private int requestedSize, bucketIndex; 033 034 CacheFullException(int requestedSize, int bucketIndex) { 035 super(); 036 this.requestedSize = requestedSize; 037 this.bucketIndex = bucketIndex; 038 } 039 040 public int bucketIndex() { 041 return bucketIndex; 042 } 043 044 public int requestedSize() { 045 return requestedSize; 046 } 047 048 @Override 049 public String toString() { 050 StringBuilder sb = new StringBuilder(1024); 051 sb.append("Allocator requested size ").append(requestedSize); 052 sb.append(" for bucket ").append(bucketIndex); 053 return sb.toString(); 054 } 055}