public static BlobManager getBlobManager(ZooKeeperItf zk, HBaseConnections hbaseConns) throws IOException { Configuration configuration = getHBaseConfiguration(zk); // Avoid HBase(Admin)/ZooKeeper connection leaks when using new Configuration objects each time. configuration = hbaseConns.getExisting(configuration); HBaseTableFactory hbaseTableFactory = new HBaseTableFactoryImpl(configuration); URI dfsUri = getDfsUri(zk); FileSystem fs = FileSystem.get(DfsUri.getBaseDfsUri(dfsUri), configuration); Path blobRootPath = new Path(DfsUri.getDfsPath(dfsUri)); BlobStoreAccess dfsBlobStoreAccess = new DFSBlobStoreAccess(fs, blobRootPath); BlobStoreAccess hbaseBlobStoreAccess = new HBaseBlobStoreAccess(configuration, true); BlobStoreAccess inlineBlobStoreAccess = new InlineBlobStoreAccess(); List<BlobStoreAccess> blobStoreAccesses = Arrays.asList(dfsBlobStoreAccess, hbaseBlobStoreAccess, inlineBlobStoreAccess); SizeBasedBlobStoreAccessFactory blobStoreAccessFactory = new SizeBasedBlobStoreAccessFactory(blobStoreAccesses, getBlobStoreAccessConfig(zk)); return new BlobManagerImpl(hbaseTableFactory, blobStoreAccessFactory, true); }
private void constructRepository(ServerNode server) throws IOException, InterruptedException, KeeperException, RepositoryException { AvroConverter remoteConverter = new AvroConverter(); IdGeneratorImpl idGenerator = new IdGeneratorImpl(); RemoteTypeManager typeManager = new RemoteTypeManager( parseAddressAndPort(server.lilyAddressAndPort), remoteConverter, idGenerator, zk, schemaCache); // TODO BlobManager can probably be shared across all repositories BlobManager blobManager = getBlobManager(zk, hbaseConnections); Configuration hbaseConf = getHBaseConfiguration(zk); hbaseConf = hbaseConnections.getExisting(hbaseConf); Repository repository = new RemoteRepository( parseAddressAndPort(server.lilyAddressAndPort), remoteConverter, typeManager, idGenerator, blobManager, hbaseConf); remoteConverter.setRepository(repository); if ("true".equals(System.getProperty("lilyclient.trace"))) { repository = TracingRepository.wrap(repository); } typeManager.start(); server.repository = repository; }