Package tachyon.thrift

Examples of tachyon.thrift.NetAddress$NetAddressTupleSchemeFactory


          try {
            resolvedHost = NetworkUtils.resolveHostName(loc);
          } catch (UnknownHostException e) {
            resolvedHost = loc;
          }
          ret.add(new NetAddress(resolvedHost, -1, -1));
        }
      }
    }
    return ret;
  }
View Full Code Here


  public TachyonWorker getWorker() {
    return mWorker;
  }

  public NetAddress getWorkerAddress() {
    return new NetAddress(mLocalhostName, getWorkerPort(), getWorkerDataPort());
  }
View Full Code Here

  @Test
  public void getFqdnHostTest() throws UnknownHostException {
    Assert.assertEquals(NetworkUtils.getFqdnHost(new InetSocketAddress("localhost", 0)),
        "localhost");
    Assert.assertEquals(NetworkUtils.getFqdnHost(new NetAddress("localhost", 0, 0)), "localhost");
  }
View Full Code Here

  @Test
  public void generateClientBlockInfoTest() {
    BlockInfo tInfo =
        new BlockInfo(new InodeFile("t", 100, 0, Constants.DEFAULT_BLOCK_SIZE_BYTE,
            System.currentTimeMillis()), 300, 800);
    tInfo.addLocation(15, new NetAddress("abc", 1, 11));
    tInfo.addLocation(22, new NetAddress("def", 2, 21));
    tInfo.addLocation(29, new NetAddress("gh", 3, 31));
    ClientBlockInfo clientBlockInfo = tInfo.generateClientBlockInfo();
    Assert.assertEquals((long) Constants.DEFAULT_BLOCK_SIZE_BYTE * 300, clientBlockInfo.offset);
    Assert.assertEquals(800, clientBlockInfo.length);
    Assert.assertEquals(3, clientBlockInfo.locations.size());
  }
View Full Code Here

  @Test
  public void localtionTest() {
    BlockInfo tInfo =
        new BlockInfo(new InodeFile("t", 100, 0, Constants.DEFAULT_BLOCK_SIZE_BYTE,
            System.currentTimeMillis()), 300, 800);
    tInfo.addLocation(15, new NetAddress("abc", 1, 11));
    Assert.assertEquals(1, tInfo.getLocations().size());
    tInfo.addLocation(22, new NetAddress("def", 2, 21));
    Assert.assertEquals(2, tInfo.getLocations().size());
    tInfo.addLocation(29, new NetAddress("gh", 3, 31));
    Assert.assertEquals(3, tInfo.getLocations().size());
    tInfo.addLocation(15, new NetAddress("abc", 1, 11));
    Assert.assertEquals(3, tInfo.getLocations().size());
    tInfo.addLocation(22, new NetAddress("def", 2, 21));
    Assert.assertEquals(3, tInfo.getLocations().size());
    tInfo.addLocation(29, new NetAddress("gh", 3, 31));
    Assert.assertEquals(3, tInfo.getLocations().size());
    tInfo.removeLocation(15);
    Assert.assertEquals(2, tInfo.getLocations().size());
    tInfo.removeLocation(10);
    Assert.assertEquals(2, tInfo.getLocations().size());
View Full Code Here

  @Test
  public void inMemoryLocationsTest() throws IOException, BlockInfoException {
    InodeFile inodeFile = new InodeFile("testFile1", 1, 0, 1000, System.currentTimeMillis());
    List<NetAddress> testAddresses = new ArrayList<NetAddress>(3);
    testAddresses.add(new NetAddress("testhost1", 1000, 1001));
    testAddresses.add(new NetAddress("testhost2", 2000, 2001));
    testAddresses.add(new NetAddress("testhost3", 3000, 3001));
    inodeFile.addBlock(new BlockInfo(inodeFile, 0, 5));
    inodeFile.addLocation(0, 1, testAddresses.get(0));
    Assert.assertEquals(1, inodeFile.getBlockLocations(0).size());
    inodeFile.addLocation(0, 2, testAddresses.get(1));
    Assert.assertEquals(2, inodeFile.getBlockLocations(0).size());
View Full Code Here

  }

  @Test(expected = BlockInfoException.class)
  public void inMemoryLocationsTestWithBlockInfoException() throws IOException, BlockInfoException {
    InodeFile inodeFile = new InodeFile("testFile1", 1, 0, 1000, System.currentTimeMillis());
    inodeFile.addLocation(0, 1, new NetAddress("testhost1", 1000, 1001));
  }
View Full Code Here

  @Test
  public void inMemoryTest() throws BlockInfoException {
    InodeFile inodeFile = new InodeFile("testFile1", 1, 0, 1000, System.currentTimeMillis());
    inodeFile.addBlock(new BlockInfo(inodeFile, 0, 5));
    Assert.assertFalse(inodeFile.isFullyInMemory());
    inodeFile.addLocation(0, 1, new NetAddress("testhost1", 1000, 1001));
    Assert.assertTrue(inodeFile.isFullyInMemory());
    inodeFile.removeLocation(0, 1);
    Assert.assertFalse(inodeFile.isFullyInMemory());
    inodeFile.addLocation(0, 1, new NetAddress("testhost1", 1000, 1001));
    inodeFile.addLocation(0, 1, new NetAddress("testhost1", 1000, 1001));
    Assert.assertTrue(inodeFile.isFullyInMemory());
    inodeFile.removeLocation(0, 1);
    Assert.assertFalse(inodeFile.isFullyInMemory());
    inodeFile.addLocation(0, 1, new NetAddress("testhost1", 1000, 1001));
    inodeFile.addLocation(0, 2, new NetAddress("testhost1", 1000, 1001));
    Assert.assertTrue(inodeFile.isFullyInMemory());
    inodeFile.removeLocation(0, 1);
    Assert.assertTrue(inodeFile.isFullyInMemory());
  }
View Full Code Here

   * @return true if succeed, false otherwise
   * @throws IOException
   */
  private synchronized boolean connect() throws IOException {
    if (!mConnected) {
      NetAddress workerNetAddress = null;
      try {
        String localHostName = NetworkUtils.getLocalHostName();
        LOG.info("Trying to get local worker host : " + localHostName);
        workerNetAddress = mMasterClient.user_getWorker(false, localHostName);
        mIsLocal = true;
View Full Code Here

   * @throws BlockInfoException
   */
  public long registerWorker(NetAddress workerNetAddress, long totalBytes, long usedBytes,
      List<Long> currentBlockIds) throws BlockInfoException {
    long id = 0;
    NetAddress workerAddress = new NetAddress(workerNetAddress);
    LOG.info("registerWorker(): WorkerNetAddress: " + workerAddress);

    synchronized (mWorkers) {
      if (mWorkerAddressToId.containsKey(workerAddress)) {
        id = mWorkerAddressToId.get(workerAddress);
View Full Code Here

TOP

Related Classes of tachyon.thrift.NetAddress$NetAddressTupleSchemeFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.