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


Java BatchDeleter.close方法代码示例

本文整理汇总了Java中org.apache.accumulo.core.client.BatchDeleter.close方法的典型用法代码示例。如果您正苦于以下问题:Java BatchDeleter.close方法的具体用法?Java BatchDeleter.close怎么用?Java BatchDeleter.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.accumulo.core.client.BatchDeleter的用法示例。


在下文中一共展示了BatchDeleter.close方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeElementFromIndex

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
/**
 * Remove the given element's properties from the index.
 * @param element
 */
public void removeElementFromIndex(Element element) {
  BatchDeleter deleter = null;

  try {
    deleter = getDeleter();
    deleter.setRanges(Collections.singleton(new Range()));

    IteratorSetting is = new IteratorSetting(10, "getEdgeFilter", RegExFilter.class);
    RegExFilter.setRegexs(is, null, null,
        "^"+Pattern.quote(element.getId().toString())+"$", null, false);
    deleter.addScanIterator(is);
    deleter.delete();
    deleter.close();
  } catch (Exception e) {
    throw new AccumuloGraphException(e);
  } finally {
    if (deleter != null) {
      deleter.close();
    }
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:26,代码来源:BaseIndexValuesTableWrapper.java

示例2: deleteVertex

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
/**
 * Remove the given vertex.
 * Note: This uses a BatchDeleter rather than {@link Mutator}
 * because it is more efficient.
 * @param vertex
 */
public void deleteVertex(Vertex vertex) {
  BatchDeleter deleter = null;

  try {
    deleter = getDeleter();
    deleter.setRanges(Arrays.asList(Range.exact((String) vertex.getId())));
    deleter.delete();

  } catch (Exception e) {
    throw new AccumuloGraphException(e);
  } finally {
    if (deleter != null) {
      deleter.close();
    }
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:23,代码来源:VertexTableWrapper.java

示例3: clearTable

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
public static void clearTable(Connector connector, String table) throws AccumuloException, TableNotFoundException, AccumuloSecurityException {

        Authorizations userAuths = connector.securityOperations().getUserAuthorizations(connector.whoami());

        BatchDeleter batchDelete = connector.createBatchDeleter(table, userAuths, 1, new BatchWriterConfig());
        batchDelete.setRanges(Collections.singleton(new Range()));
        batchDelete.delete();
        batchDelete.close();

        batchDelete = connector.createBatchDeleter(table, userAuths, 1, new BatchWriterConfig());
        batchDelete.setRanges(Collections.singleton(new Range()));
        batchDelete.delete();
        batchDelete.close();

        connector.tableOperations().compact(table, new Text("\u0000"), new Text("\uffff"), true, true);
    }
 
开发者ID:calrissian,项目名称:accumulo-recipes,代码行数:17,代码来源:AccumuloTestUtils.java

示例4: purge

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
private void purge(final String tableName, final String[] auths) throws TableNotFoundException, MutationsRejectedException {
    if (tableExists(tableName)) {
        logger.info("Purging accumulo table: " + tableName);
        final BatchDeleter batchDeleter = createBatchDeleter(tableName, new Authorizations(auths));
        try {
            batchDeleter.setRanges(Collections.singleton(new Range()));
            batchDeleter.delete();
        } finally {
            batchDeleter.close();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:13,代码来源:AccumuloRyaDAO.java

示例5: dropKeyIndex

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
public <T extends Element> void dropKeyIndex(String key, Class<T> elementClass) {
  // TODO Move below to somewhere appropriate.
  if (elementClass == null) {
    throw ExceptionFactory.classForElementCannotBeNull();
  }

  globals.getIndexMetadataWrapper().clearKeyMetadataEntry(key, elementClass);

  String table = null;
  if (elementClass.equals(Vertex.class)) {
    table = globals.getConfig().getVertexKeyIndexTableName();
  } else {
    table = globals.getConfig().getEdgeKeyIndexTableName();
  }
  BatchDeleter bd = null;
  try {
    bd = globals.getConfig().getConnector().createBatchDeleter(table, globals.getConfig().getAuthorizations(), globals.getConfig().getMaxWriteThreads(), globals.getConfig().getBatchWriterConfig());
    bd.setRanges(Collections.singleton(new Range()));
    bd.fetchColumnFamily(new Text(key));
    bd.delete();
  } catch (Exception e) {
    throw new AccumuloGraphException(e);
  } finally {
    if (bd != null)
      bd.close();
  }
  globals.checkedFlush();
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:30,代码来源:AccumuloGraph.java

示例6: deleteAll

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
public boolean deleteAll(
		final String tableName,
		final String columnFamily,
		final String... additionalAuthorizations ) {
	BatchDeleter deleter = null;
	try {
		deleter = createBatchDeleter(
				tableName,
				additionalAuthorizations);
		deleter.setRanges(Arrays.asList(new Range()));
		deleter.fetchColumnFamily(new Text(
				columnFamily));
		deleter.delete();
		return true;
	}
	catch (final TableNotFoundException | MutationsRejectedException e) {
		LOGGER.warn(
				"Unable to delete row from table [" + tableName + "].",
				e);
		return false;
	}
	finally {
		if (deleter != null) {
			deleter.close();
		}
	}

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:30,代码来源:BasicAccumuloOperations.java

示例7: deleteAll

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
protected boolean deleteAll(
		final String tableName,
		final String columnFamily,
		final String... additionalAuthorizations ) {
	BatchDeleter deleter = null;
	try {
		deleter = accumuloOperations.createBatchDeleter(
				tableName,
				additionalAuthorizations);

		deleter.setRanges(Arrays.asList(new Range()));
		deleter.fetchColumnFamily(new Text(
				columnFamily));
		deleter.delete();
		return true;
	}
	catch (final TableNotFoundException | MutationsRejectedException e) {
		LOGGER.warn(
				"Unable to delete row from table [" + tableName + "].",
				e);
		return false;
	}
	finally {
		if (deleter != null) {
			deleter.close();
		}
	}

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:31,代码来源:AccumuloDataStore.java

示例8: remove

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
public static void remove(Store id) throws TableNotFoundException, MutationsRejectedException {
  checkNotNull(id);
  
  BatchDeleter bd = null;
  try {
    bd = id.connector().createBatchDeleter(id.metadataTable(), id.auths(), id.readThreads(), id.writerConfig());
    bd.setRanges(Collections.singleton(Range.exact(id.uuid())));
    bd.delete();
  } finally {
    if (null != bd) {
      bd.close();
    }
  }
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:15,代码来源:PersistedStores.java

示例9: dropGraph

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
    public void dropGraph(final AccumuloRdfConfiguration conf, final RyaURI... graphs) throws RyaDAOException {
        BatchDeleter bd_spo = null;
        BatchDeleter bd_po = null;
        BatchDeleter bd_osp = null;

        try {
            bd_spo = createBatchDeleter(tableLayoutStrategy.getSpo(), conf.getAuthorizations());
            bd_po = createBatchDeleter(tableLayoutStrategy.getPo(), conf.getAuthorizations());
            bd_osp = createBatchDeleter(tableLayoutStrategy.getOsp(), conf.getAuthorizations());

            bd_spo.setRanges(Collections.singleton(new Range()));
            bd_po.setRanges(Collections.singleton(new Range()));
            bd_osp.setRanges(Collections.singleton(new Range()));

            for (final RyaURI graph : graphs){
                bd_spo.fetchColumnFamily(new Text(graph.getData()));
                bd_po.fetchColumnFamily(new Text(graph.getData()));
                bd_osp.fetchColumnFamily(new Text(graph.getData()));
            }

            bd_spo.delete();
            bd_po.delete();
            bd_osp.delete();

            //TODO indexers do not support delete-UnsupportedOperation Exception will be thrown
//            for (AccumuloIndex index : secondaryIndexers) {
//                index.dropGraph(graphs);
//            }

        } catch (final Exception e) {
            throw new RyaDAOException(e);
        } finally {
            if (bd_spo != null) {
                bd_spo.close();
            }
            if (bd_po != null) {
                bd_po.close();
            }
            if (bd_osp != null) {
                bd_osp.close();
            }
        }

    }
 
开发者ID:apache,项目名称:incubator-rya,代码行数:46,代码来源:AccumuloRyaDAO.java

示例10: delete

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
public boolean delete(
		final String tableName,
		final List<ByteArrayId> rowIds,
		final String columnFamily,
		final String columnQualifier,
		final String... authorizations ) {

	boolean success = true;
	BatchDeleter deleter = null;
	try {
		deleter = createBatchDeleter(
				tableName,
				authorizations);
		if ((columnFamily != null) && !columnFamily.isEmpty()) {
			if ((columnQualifier != null) && !columnQualifier.isEmpty()) {
				deleter.fetchColumn(
						new Text(
								columnFamily),
						new Text(
								columnQualifier));
			}
			else {
				deleter.fetchColumnFamily(new Text(
						columnFamily));
			}
		}
		final Set<ByteArrayId> removeSet = new HashSet<ByteArrayId>();
		final List<Range> rowRanges = new ArrayList<Range>();
		for (final ByteArrayId rowId : rowIds) {
			rowRanges.add(Range.exact(new Text(
					rowId.getBytes())));
			removeSet.add(new ByteArrayId(
					rowId.getBytes()));
		}
		deleter.setRanges(rowRanges);

		final Iterator<Map.Entry<Key, Value>> iterator = deleter.iterator();
		while (iterator.hasNext()) {
			final Entry<Key, Value> entry = iterator.next();
			removeSet.remove(new ByteArrayId(
					entry.getKey().getRowData().getBackingArray()));
		}

		if (removeSet.isEmpty()) {
			deleter.delete();
		}

		deleter.close();
	}
	catch (final TableNotFoundException | MutationsRejectedException e) {
		LOGGER.warn(
				"Unable to delete row from table [" + tableName + "].",
				e);
		if (deleter != null) {
			deleter.close();
		}
		success = false;
	}

	return success;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:63,代码来源:BasicAccumuloOperations.java

示例11: delete

import org.apache.accumulo.core.client.BatchDeleter; //导入方法依赖的package包/类
@Override
public void delete(Store id) throws TableNotFoundException, MutationsRejectedException, UnexpectedStateException {
  checkNotNull(id);

  Stopwatch sw = new Stopwatch().start();

  try {
    State s = PersistedStores.getState(id);

    if (!State.LOADING.equals(s) && !State.LOADED.equals(s)) {
      throw unexpectedState(id, new State[] {State.LOADING, State.LOADED}, s);
    }

    final State desiredState = State.DELETING;

    log.debug("Changing state for {} from {} to {}", new Object[] {id, s, desiredState});

    PersistedStores.setState(id, desiredState);

    // Delete of the Keys
    BatchDeleter bd = null;
    try {
      bd = id.connector().createBatchDeleter(id.dataTable(), id.auths(), id.readThreads(), id.writerConfig());
      bd.setRanges(Collections.singleton(Range.prefix(id.uuid())));

      bd.delete();
    } finally {
      if (null != bd) {
        bd.close();
      }
    }

    log.debug("Removing state for {}", id);

    PersistedStores.remove(id);
  } finally {
    sw.stop();
    id.tracer().addTiming("Cosmos:delete", sw.elapsed(TimeUnit.MILLISECONDS));

    // Be nice and when the client deletes these results, automatically flush the traces for them too
    id.sendTraces();
  }
}
 
开发者ID:joshelser,项目名称:cosmos,代码行数:44,代码来源:CosmosImpl.java


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