org.apache.jackrabbit.core.data.DataStore.close()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.apache.jackrabbit.core.data.DataStore.close()方法的一些代码示例,展示了DataStore.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataStore.close()方法的具体详情如下:
包路径:org.apache.jackrabbit.core.data.DataStore
类名称:DataStore
方法名:close

DataStore.close介绍

[英]Close the data store
[中]关闭数据存储

代码示例

代码示例来源:origin: org.apache.jackrabbit/oak-blob-plugins

@Override
public void close() throws DataStoreException {
  delegate.close();
  cache.invalidateAll();
  closeQuietly(tracker);
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public void close() throws DataStoreException {
  delegate.close();
  cache.invalidateAll();
  closeQuietly(tracker);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public void close() throws DataStoreException {
  delegate.close();
  cache.invalidateAll();
  closeQuietly(tracker);
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public void close() throws DataStoreException {
  existingMappings.clear();
  saveNewMappingsToFile();
  if (delegate != null) {
    delegate.close();
  }
}

代码示例来源:origin: org.apache.jackrabbit/oak-upgrade

@Override
public void close() throws DataStoreException {
  existingMappings.clear();
  saveNewMappingsToFile();
  if (delegate != null) {
    delegate.close();
  }
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-data

primaryDataStore.close();
} catch (DataStoreException e) {
  lastException = e;
  archiveDataStore.close();
} catch (DataStoreException e) {
  if (lastException != null) {

代码示例来源:origin: apache/jackrabbit-oak

@After
public void tearDown() {
  try {
    ds.close();
  } catch (DataStoreException e) {
    LOG.info("Error in close ds", e);
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Method to validate mixed scenario use of {@link DataStore}.
 */
protected void doTestSingleThread() throws Exception {
  ds = createDataStore();
  doTestMultiThreaded(ds, 1);
  ds.close();
}

代码示例来源:origin: apache/jackrabbit

/**
 * Method to validate mixed scenario use of {@link DataStore} in
 * multi-threaded concurrent environment.
 */
protected void doTestMultiThreaded() throws Exception {
  ds = createDataStore();
  doTestMultiThreaded(ds, 4);
  ds.close();
}

代码示例来源:origin: apache/jackrabbit

/**
   * Test robustness of {@link AsyncUploadCache} corruption.
   */
  public void testAsyncUploadCacheCorruption() {
    try {
      ds = createDataStore();
      File pendingUploads = new File(dataStoreDir + "/"
        + PENDIND_UPLOAD_FILE);
      FileOutputStream fos = new FileOutputStream(pendingUploads);
      IOUtils.write("garbage-data", fos);
      fos.close();

      File tobeDeletedFile = new File(dataStoreDir + "/"
        + TO_BE_DELETED_UPLOAD_FILE);
      fos = new FileOutputStream(tobeDeletedFile);
      IOUtils.write("garbage-data", fos);
      fos.close();
      ds.close();

      doAddRecordTest();
    } catch (Exception e) {
      LOG.error("error:", e);
      fail(e.getMessage());
    }
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public void dispose(DataStore dataStore) {
    if (dataStore == null) {
      return;
    }

    try {
      dataStore.close();
    } catch (DataStoreException e) {
      log.warn("Issue while disposing DataStore", e);
    }

    CloudBlobContainer container = containers.get(dataStore);
    if (container != null) {
      log.info("Removing Azure test blob container {}", container.getName());
      try {
        // For Azure, you can just delete the container and all
        // blobs it in will also be deleted
        container.delete();
      } catch (StorageException e) {
        log.warn("Unable to delete Azure Blob container {}", container.getName());
      }

      containers.remove(dataStore);
    }
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test if record can be accessed via
 * {@link DataStore#getRecordFromReference(String)}
 */
protected void doReferenceTest() throws Exception {
  ds = createDataStore();
  byte[] data = new byte[dataLength];
  randomGen.nextBytes(data);
  String reference;
  DataRecord record = ds.addRecord(new ByteArrayInputStream(data));
  reference = record.getReference();
  assertReference(data, reference, ds);
  ds.close();
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test {@link DataStore#addRecord(InputStream)} and assert length of added
 * record.
 */
protected void doAddRecordTest() throws Exception {
  ds = createDataStore();
  byte[] data = new byte[dataLength];
  randomGen.nextBytes(data);
  DataRecord rec = ds.addRecord(new ByteArrayInputStream(data));
  assertEquals(data.length, rec.getLength());
  assertRecord(data, rec);
  ds.close();
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test {@link DataStore#getAllIdentifiers()} and asserts all identifiers
 * are returned.
 */
protected void doGetAllIdentifiersTest() throws Exception {
  ds = createDataStore();
  List<DataIdentifier> list = new ArrayList<DataIdentifier>();
  Random random = randomGen;
  byte[] data = new byte[dataLength];
  random.nextBytes(data);
  DataRecord rec = ds.addRecord(new ByteArrayInputStream(data));
  list.add(rec.getIdentifier());
  data = new byte[dataLength];
  random.nextBytes(data);
  rec = ds.addRecord(new ByteArrayInputStream(data));
  list.add(rec.getIdentifier());
  data = new byte[dataLength];
  random.nextBytes(data);
  rec = ds.addRecord(new ByteArrayInputStream(data));
  list.add(rec.getIdentifier());
  Iterator<DataIdentifier> itr = ds.getAllIdentifiers();
  while (itr.hasNext()) {
    assertTrue("record found on list", list.remove(itr.next()));
  }
  assertEquals(0, list.size());
  ds.close();
}

代码示例来源:origin: apache/jackrabbit

void doTest(DataStore store) throws Exception {
  this.store = store;
  Random r = new Random();
  concurrentGcLoopStart();
  int len = 100;
  if (getTestScale() > 1) {
    len = 1000;
  }
  for (int i = 0; i < len && gcException == null; i++) {
    LOG.info("test " + i);
    byte[] data = new byte[3];
    r.nextBytes(data);
    DataRecord rec = store.addRecord(new ByteArrayInputStream(data));
    LOG.debug("  added " + rec.getIdentifier());
    if (r.nextBoolean()) {
      LOG.debug("  added " + rec.getIdentifier() + " -> keep reference");
      ids.add(rec.getIdentifier());
      store.getRecord(rec.getIdentifier());
    }
    if (r.nextInt(100) == 0) {
      LOG.debug("clear i: " + i);
      ids.clear();
    }
  }
  concurrentGcLoopStop();
  store.close();
}

代码示例来源:origin: apache/jackrabbit-oak

try {
  ds.close();
  props.remove(S3Constants.S3_ENCRYPTION);
  ds = createDataStore();
  Assert.assertEquals(data.length, rec.getLength());
  assertRecord(data, rec);
  ds.close();
  ds.close();
} catch (Exception e) {
  LOG.error("error:", e);

代码示例来源:origin: apache/jackrabbit

/**
 * Test {@link DataStore#getRecord(DataIdentifier)} and assert length and
 * inputstream.
 */
protected void doGetRecordTest() throws Exception {
  ds = createDataStore();
  byte[] data = new byte[dataLength];
  randomGen.nextBytes(data);
  DataRecord rec = ds.addRecord(new ByteArrayInputStream(data));
  rec = ds.getRecord(rec.getIdentifier());
  assertEquals(data.length, rec.getLength());
  assertRecord(data, rec);
  ds.close();
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test {@link MultiDataStoreAware#deleteRecord(DataIdentifier)}.
 */
protected void doDeleteRecordTest() throws Exception {
  ds = createDataStore();
  Random random = randomGen;
  byte[] data1 = new byte[dataLength];
  random.nextBytes(data1);
  DataRecord rec1 = ds.addRecord(new ByteArrayInputStream(data1));
  byte[] data2 = new byte[dataLength];
  random.nextBytes(data2);
  DataRecord rec2 = ds.addRecord(new ByteArrayInputStream(data2));
  byte[] data3 = new byte[dataLength];
  random.nextBytes(data3);
  DataRecord rec3 = ds.addRecord(new ByteArrayInputStream(data3));
  ((MultiDataStoreAware)ds).deleteRecord(rec2.getIdentifier());
  assertNull("rec2 should be null",
    ds.getRecordIfStored(rec2.getIdentifier()));
  assertEquals(new ByteArrayInputStream(data1),
    ds.getRecord(rec1.getIdentifier()).getStream());
  assertEquals(new ByteArrayInputStream(data3),
    ds.getRecord(rec3.getIdentifier()).getStream());
  ds.close();
}

代码示例来源:origin: apache/jackrabbit

assertEquals("rec3 touched", true, rec3.getLastModified() > updateTime);
assertEquals("rec4 touched", true, rec4.getLastModified() > updateTime);
ds.close();

代码示例来源:origin: apache/jackrabbit-oak

if (dataStore != null && dataStore instanceof S3DataStore) {
  try {
    dataStore.close();
  } catch (DataStoreException e) {
    log.warn("Issue while disposing DataStore", e);

相关文章