当前位置: 首页>>代码示例>>Java>>正文


Java DiskOutOfSpaceException类代码示例

本文整理汇总了Java中org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException的典型用法代码示例。如果您正苦于以下问题:Java DiskOutOfSpaceException类的具体用法?Java DiskOutOfSpaceException怎么用?Java DiskOutOfSpaceException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DiskOutOfSpaceException类属于org.apache.hadoop.util.DiskChecker包,在下文中一共展示了DiskOutOfSpaceException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRRPolicyExceptionMessage

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
public static void testRRPolicyExceptionMessage(
    VolumeChoosingPolicy<FsVolumeSpi> policy) throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<FsVolumeSpi>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch(DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600
            + " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestRoundRobinVolumeChoosingPolicy.java

示例2: checkDiskError

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
/** Check if there is no space in disk 
 *  @param e that caused this checkDiskError call
 **/
protected void checkDiskError(Exception e ) throws IOException {
  
  LOG.warn("checkDiskError: exception: ", e);
  if (e instanceof SocketException || e instanceof SocketTimeoutException
  	  || e instanceof ClosedByInterruptException 
  	  || e.getMessage().startsWith("An established connection was aborted")
  	  || e.getMessage().startsWith("Broken pipe")
  	  || e.getMessage().startsWith("Connection reset")
  	  || e.getMessage().contains("java.nio.channels.SocketChannel")) {
    LOG.info("Not checking disk as checkDiskError was called on a network" +
    		" related exception");	
    return;
  }
  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:24,代码来源:DataNode.java

示例3: testRRPolicyExceptionMessage

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
@Test
public void testRRPolicyExceptionMessage() throws Exception {
  final List<FsVolumeSpi> volumes = new ArrayList<>();

  // First volume, with 500 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(0).getAvailable()).thenReturn(500L);

  // Second volume, with 600 bytes of space.
  volumes.add(Mockito.mock(FsVolumeSpi.class));
  Mockito.when(volumes.get(1).getAvailable()).thenReturn(600L);

  final RoundRobinVolumeChoosingPolicy<FsVolumeSpi> policy =
      new RoundRobinVolumeChoosingPolicy<>();
  int blockSize = 700;
  try {
    policy.chooseVolume(volumes, blockSize);
    Assert.fail("expected to throw DiskOutOfSpaceException");
  } catch (DiskOutOfSpaceException e) {
    Assert.assertEquals("Not returnig the expected message",
        "Out of space: The volume with the most available space (=" + 600 +
            " B) is less than the block size (=" + blockSize + " B).",
        e.getMessage());
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:TestRoundRobinVolumeChoosingPolicy.java

示例4: getNextVolume

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
synchronized FSVolume getNextVolume(long blockSize) throws IOException {
  
  if(volumes.length < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }
  
  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.length) {
    curVolume = 0;
  }
  
  int startVolume = curVolume;
  
  while (true) {
    FSVolume volume = volumes[curVolume];
    curVolume = (curVolume + 1) % volumes.length;
    if (volume.getAvailable() > blockSize) { return volume; }
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Insufficient space for an additional block");
    }
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:24,代码来源:FSDataset.java

示例5: checkDiskError

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
/** Check if there is no space in disk 
 *  @param e that caused this checkDiskError call
 **/
protected void checkDiskError(Exception e ) throws IOException {
  
  LOG.warn("checkDiskError: exception: ", e);
  if (isNetworkRelatedException(e)) {
    LOG.info("Not checking disk as checkDiskError was called on a network" +
    		" related exception");	
    return;
  }
  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:19,代码来源:DataNode.java

示例6: chooseVolume

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
@Override
public synchronized V chooseVolume(final List<V> volumes, long blockSize)
    throws IOException {

  if(volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }
  
  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.size()) {
    curVolume = 0;
  }
  
  int startVolume = curVolume;
  long maxAvailable = 0;
  
  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) {
      return volume;
    }
    
    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }
    
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Out of space: "
          + "The volume with the most available space (=" + maxAvailable
          + " B) is less than the block size (=" + blockSize + " B).");
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:RoundRobinVolumeChoosingPolicy.java

示例7: run

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
@Override
public void run(DatanodeID id) throws DiskOutOfSpaceException {
  final DataTransferTest test = getDataTransferTest();
  if (test.isNotSuccessAndLastPipelineContains(index, id)) {
    final String s = toString(id);
    FiTestUtil.LOG.info(s);
    throw new DiskOutOfSpaceException(s);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:DataTransferTestUtil.java

示例8: getNextVolume

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
private FSVolume getNextVolume(long blockSize) throws IOException {
  FSVolume[] volumes = this.getVolumes();

  if(volumes.length < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }
  
  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if (curVolume >= volumes.length) {
    curVolume = 0;
  }

  int startVolume = curVolume;

  while (true) {
    FSVolume volume = volumes[curVolume];
    curVolume = (curVolume + 1) % volumes.length;
    if (volume.getAvailable() > blockSize) {
      return volume;
    }
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException(
          "Insufficient space for an additional block");
    }
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:28,代码来源:FSDataset.java

示例9: checkDiskError

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
/** Check if there is no space in disk 
 *  @param e that caused this checkDiskError call
 **/
protected void checkDiskError(Exception e ) throws IOException {
  if (e instanceof ClosedByInterruptException
      || e instanceof java.io.InterruptedIOException) {
    return;
  }
  LOG.warn("checkDiskError: exception: ", e);
  
  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:18,代码来源:DataNode.java

示例10: chooseVolume

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
@Override
public synchronized V chooseVolume(final List<V> volumes, final long blockSize
    ) throws IOException {
  if(volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }
  
  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if(curVolume >= volumes.size()) {
    curVolume = 0;
  }
  
  int startVolume = curVolume;
  long maxAvailable = 0;
  
  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) { return volume; }
    
    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }
    
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException("Out of space: "
          + "The volume with the most available space (=" + maxAvailable
          + " B) is less than the block size (=" + blockSize + " B).");
    }
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:34,代码来源:RoundRobinVolumeChoosingPolicy.java

示例11: createRbw

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
@Override // FsDatasetSpi
public synchronized ReplicaInPipeline createRbw(StorageType storageType,
    ExtendedBlock b, boolean allowLazyPersist) throws IOException {
  ReplicaInfo replicaInfo = volumeMap.get(b.getBlockPoolId(),
      b.getBlockId());
  if (replicaInfo != null) {
    throw new ReplicaAlreadyExistsException("Block " + b +
    " already exists in state " + replicaInfo.getState() +
    " and thus cannot be created.");
  }
  // create a new block
  FsVolumeImpl v;
  while (true) {
    try {
      if (allowLazyPersist) {
        // First try to place the block on a transient volume.
        v = volumes.getNextTransientVolume(b.getNumBytes());
        datanode.getMetrics().incrRamDiskBlocksWrite();
      } else {
        v = volumes.getNextVolume(storageType, b.getNumBytes());
      }
    } catch (DiskOutOfSpaceException de) {
      if (allowLazyPersist) {
        datanode.getMetrics().incrRamDiskBlocksWriteFallback();
        allowLazyPersist = false;
        continue;
      }
      throw de;
    }
    break;
  }
  // create an rbw file to hold block in the designated volume
  File f = v.createRbwFile(b.getBlockPoolId(), b.getLocalBlock());
  ReplicaBeingWritten newReplicaInfo = new ReplicaBeingWritten(b.getBlockId(), 
      b.getGenerationStamp(), v, f.getParentFile(), b.getNumBytes());
  volumeMap.add(b.getBlockPoolId(), newReplicaInfo);

  return newReplicaInfo;
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:40,代码来源:FsDatasetImpl.java

示例12: chooseVolume

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
@Override
public synchronized V chooseVolume(final List<V> volumes,
    final long blockSize) throws IOException {
  if (volumes.size() < 1) {
    throw new DiskOutOfSpaceException("No more available volumes");
  }
  
  // since volumes could've been removed because of the failure
  // make sure we are not out of bounds
  if (curVolume >= volumes.size()) {
    curVolume = 0;
  }
  
  int startVolume = curVolume;
  long maxAvailable = 0;
  
  while (true) {
    final V volume = volumes.get(curVolume);
    curVolume = (curVolume + 1) % volumes.size();
    long availableVolumeSize = volume.getAvailable();
    if (availableVolumeSize > blockSize) {
      return volume;
    }
    
    if (availableVolumeSize > maxAvailable) {
      maxAvailable = availableVolumeSize;
    }
    
    if (curVolume == startVolume) {
      throw new DiskOutOfSpaceException(
          "Out of space: " + "The volume with the most available space (=" +
              maxAvailable + " B) is less than the block size (=" +
              blockSize + " B).");
    }
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:37,代码来源:RoundRobinVolumeChoosingPolicy.java

示例13: checkDiskError

import org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException; //导入依赖的package包/类
/**
 * Check if there is no space in disk
 *
 * @param e
 *     that caused this checkDiskError call
 */
protected void checkDiskError(Exception e) throws IOException {
  
  LOG.warn("checkDiskError: exception: ", e);
  
  if (e.getMessage() != null &&
      e.getMessage().startsWith("No space left on device")) {
    throw new DiskOutOfSpaceException("No space left on device");
  } else {
    checkDiskError();
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:18,代码来源:DataNode.java


注:本文中的org.apache.hadoop.util.DiskChecker.DiskOutOfSpaceException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。