Package org.apache.flink.runtime.blob

Examples of org.apache.flink.runtime.blob.BlobClient


    final byte[] buf = new byte[128];

    try {
      server = new BlobServer();
      InetSocketAddress blobSocketAddress = new InetSocketAddress(server.getServerPort());
      BlobClient bc = new BlobClient(blobSocketAddress);

      keys.add(bc.put(buf));
      buf[0] += 1;
      keys.add(bc.put(buf));

      libraryCacheManager = new BlobLibraryCacheManager(server, GlobalConfiguration.getConfiguration());
      libraryCacheManager.registerJob(jid, keys);

      List<File> files = new ArrayList<File>();

      for (BlobKey key: keys){
        files.add(libraryCacheManager.getFile(key));
      }

      assertEquals(2, files.size());
      files.clear();

      libraryCacheManager.unregisterJob(jid);

      Thread.sleep(1500);

      int caughtExceptions = 0;

      for (BlobKey key : keys) {
        // the blob cache should no longer contain the files
        try {
          files.add(libraryCacheManager.getFile(key));
        } catch (IOException ioe) {
          caughtExceptions++;
        }
      }

      assertEquals(2, caughtExceptions);
     
      bc.close();
    }
    catch(Exception e){
      e.printStackTrace();
      fail(e.getMessage());
    }
View Full Code Here


    if (this.userJars.isEmpty()) {
      return;
    }

    BlobClient bc = null;
    try {

      bc = new BlobClient(serverAddress);

      for (final Iterator<Path> it = this.userJars.iterator(); it.hasNext();) {

        final Path jar = it.next();
        final FileSystem fs = jar.getFileSystem();
        FSDataInputStream is = null;
        try {
          is = fs.open(jar);
          final BlobKey key = bc.put(is);
          this.userJarBlobKeys.add(key);
        } finally {
          if (is != null) {
            is.close();
          }
        }
      }

    } finally {
      if (bc != null) {
        bc.close();
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.blob.BlobClient

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.