Tabnine Logo
CachedCrudAssist
Code IndexAdd Tabnine to your IDE (free)

How to use
CachedCrudAssist
in
org.apache.kylin.metadata.cachesync

Best Java code snippets using org.apache.kylin.metadata.cachesync.CachedCrudAssist (Showing top 20 results out of 315)

origin: apache/kylin

public void reloadAll() throws IOException {
  try (AutoReadWriteLock.AutoLock lock = executableDigestMapLock.lockForWrite()) {
    executableDigestCrud.reloadAll();
  }
  try (AutoReadWriteLock.AutoLock lock = executableOutputDigestMapLock.lockForWrite()) {
    executableOutputDigestCrud.reloadAll();
  }
}
origin: apache/kylin

  @Override
  public void onEntityChange(Broadcaster broadcaster, String entity, Broadcaster.Event event, String cacheKey)
      throws IOException {
    try (AutoReadWriteLock.AutoLock l = lock.lockForWrite()) {
      if (event == Broadcaster.Event.DROP)
        userMap.removeLocal(cacheKey);
      else
        crud.reloadQuietly(cacheKey);
    }
  }
}
origin: apache/kylin

public void saveExternalFilter(ExternalFilterDesc desc) throws IOException {
  try (AutoLock lock = extFilterMapLock.lockForWrite()) {
    extFilterCrud.save(desc);
  }
}
origin: apache/kylin

private void updateTempStatementWithRetry(TempStatementEntity entity, int retry) throws IOException {
  try {
    crud.save(entity);
  } catch (WriteConflictException ise) {
    logger.warn("Write conflict to update temp statement" + entity.statementId + " at try " + retry
        + ", will retry...");
    if (retry >= 7) {
      logger.error("Retried 7 times till got error, abandoning...", ise);
      throw ise;
    }
    TempStatementEntity reload = crud.reload(entity.resourceName());
    entity = prepareToOverwrite(entity, reload);
    updateTempStatementWithRetry(entity, ++retry);
  }
}
origin: apache/kylin

public T save(T entity) throws IOException {
  Preconditions.checkArgument(entity != null);
  completeUuidIfNeeded(entity);
  Preconditions.checkArgument(entityType.isInstance(entity));
  String resName = entity.resourceName();
  Preconditions.checkArgument(resName != null && resName.length() > 0);
  if (checkCopyOnWrite) {
    if (entity.isCachedAndShared() || cache.get(resName) == entity) {
      throw new IllegalStateException("Copy-on-write violation! The updating entity " + entity
          + " is a shared object in " + entityType.getSimpleName() + " cache, which should not be.");
    }
  }
  String path = resourcePath(resName);
  logger.debug("Saving {} at {}", entityType.getSimpleName(), path);
  store.checkAndPutResource(path, entity, serializer);
  
  // just to trigger the event broadcast, the entity won't stay in cache
  cache.put(resName, entity);
  // keep the pass-in entity out of cache, the caller may use it for further update
  // return a reloaded new object
  return reload(resName);
}
origin: apache/kylin

private CubeManager(KylinConfig cfg) throws IOException {
  logger.info("Initializing CubeManager with config {}", cfg);
  this.config = cfg;
  this.cubeMap = new CaseInsensitiveStringCache<CubeInstance>(config, "cube");
  this.crud = new CachedCrudAssist<CubeInstance>(getStore(), ResourceStore.CUBE_RESOURCE_ROOT, CubeInstance.class,
      cubeMap) {
    @Override
    protected CubeInstance initEntityAfterReload(CubeInstance cube, String resourceName) {
      cube.init(config);
      for (CubeSegment segment : cube.getSegments()) {
        usedStorageLocation.put(segment.getUuid(), segment.getStorageLocationIdentifier());
      }
      return cube;
    }
  };
  this.crud.setCheckCopyOnWrite(true);
  // touch lower level metadata before registering my listener
  crud.reloadAll();
  Broadcaster.getInstance(config).registerListener(new CubeSyncListener(), "cube");
}
origin: apache/kylin

public void removeKafkaConfig(KafkaConfig kafkaConfig) throws IOException {
  try (AutoLock l = lock.lockForWrite()) {
    crud.delete(kafkaConfig);
  }
}
origin: apache/kylin

private TableACL loadTableACL(String project) throws IOException {
  TableACL acl = crud.reload(project);
  if (acl == null) {
    acl = newTableACL(project);
  }
  return acl;
}
origin: apache/kylin

public void delete(String username) {
  try (AutoReadWriteLock.AutoLock l = lock.lockForWrite()) {
    crud.delete(username.toUpperCase(Locale.ROOT));
  } catch (IOException e) {
    throw new RuntimeException("Can not delete user.", e);
  }
}
origin: apache/kylin

  cube = crud.save(cube);
} catch (WriteConflictException ise) {
  logger.warn("Write conflict to update cube {} at try {}, will retry...", cube.getName(), retry);
  cube = crud.reload(cube.getName());
  update.setCubeInstance(cube.latestCopyForWrite());
  return updateCubeWithRetry(update, ++retry);
origin: apache/kylin

this.executableDigestCrud.setCheckCopyOnWrite(true);
this.executableDigestCrud.reloadAll();
this.executableOutputDigestCrud.setCheckCopyOnWrite(true);
this.executableOutputDigestCrud.reloadAll();
Broadcaster.getInstance(config).registerListener(new JobSyncListener(), "execute");
Broadcaster.getInstance(config).registerListener(new JobOutputSyncListener(), "execute_output");
origin: apache/kylin

public HybridInstance reloadHybridInstance(String name) {
  try (AutoLock l = lock.lockForWrite()) {
    return crud.reload(name);
  }
}

origin: org.apache.kylin/kylin-core-metadata

public T save(T entity) throws IOException {
  Preconditions.checkArgument(entity != null);
  completeUuidIfNeeded(entity);
  Preconditions.checkArgument(entityType.isInstance(entity));
  String resName = entity.resourceName();
  Preconditions.checkArgument(resName != null && resName.length() > 0);
  if (checkCopyOnWrite) {
    if (entity.isCachedAndShared() || cache.get(resName) == entity) {
      throw new IllegalStateException("Copy-on-write violation! The updating entity " + entity
          + " is a shared object in " + entityType.getSimpleName() + " cache, which should not be.");
    }
  }
  String path = resourcePath(resName);
  logger.debug("Saving {} at {}", entityType.getSimpleName(), path);
  store.checkAndPutResource(path, entity, serializer);
  
  // just to trigger the event broadcast, the entity won't stay in cache
  cache.put(resName, entity);
  // keep the pass-in entity out of cache, the caller may use it for further update
  // return a reloaded new object
  return reload(resName);
}
origin: apache/kylin

  @Override
  public void onEntityChange(Broadcaster broadcaster, String entity, Event event, String cacheKey)
      throws IOException {
    try (AutoLock l = lock.lockForWrite()) {
      if (event == Event.DROP)
        kafkaMap.removeLocal(cacheKey);
      else
        crud.reloadQuietly(cacheKey);
    }
  }
}
origin: apache/kylin

public void reloadAllHybridInstance() throws IOException {
  try (AutoLock l = lock.lockForWrite()) {
    crud.reloadAll();
  }
}
origin: apache/kylin

public void saveSourceTable(TableDesc srcTable, String prj) throws IOException {
  try (AutoLock lock = srcTableMapLock.lockForWrite()) {
    srcTable.init(config, prj);
    srcTableCrud.save(srcTable);
  }
}
origin: apache/kylin

public void removeExternalFilter(String name) throws IOException {
  try (AutoLock lock = extFilterMapLock.lockForWrite()) {
    extFilterCrud.delete(name);
  }
}
origin: org.apache.kylin/kylin-core-metadata

private void updateTempStatementWithRetry(TempStatementEntity entity, int retry) throws IOException {
  try {
    crud.save(entity);
  } catch (WriteConflictException ise) {
    logger.warn("Write conflict to update temp statement" + entity.statementId + " at try " + retry
        + ", will retry...");
    if (retry >= 7) {
      logger.error("Retried 7 times till got error, abandoning...", ise);
      throw ise;
    }
    TempStatementEntity reload = crud.reload(entity.resourceName());
    entity = prepareToOverwrite(entity, reload);
    updateTempStatementWithRetry(entity, ++retry);
  }
}
origin: org.apache.kylin/kylin-core-cube

private CubeManager(KylinConfig cfg) throws IOException {
  logger.info("Initializing CubeManager with config {}", cfg);
  this.config = cfg;
  this.cubeMap = new CaseInsensitiveStringCache<CubeInstance>(config, "cube");
  this.crud = new CachedCrudAssist<CubeInstance>(getStore(), ResourceStore.CUBE_RESOURCE_ROOT, CubeInstance.class,
      cubeMap) {
    @Override
    protected CubeInstance initEntityAfterReload(CubeInstance cube, String resourceName) {
      cube.init(config);
      for (CubeSegment segment : cube.getSegments()) {
        usedStorageLocation.put(segment.getUuid(), segment.getStorageLocationIdentifier());
      }
      return cube;
    }
  };
  this.crud.setCheckCopyOnWrite(true);
  // touch lower level metadata before registering my listener
  crud.reloadAll();
  Broadcaster.getInstance(config).registerListener(new CubeSyncListener(), "cube");
}
origin: apache/kylin

public DataModelDesc reloadDataModel(String modelName) {
  try (AutoLock lock = modelMapLock.lockForWrite()) {
    return crud.reload(modelName);
  }
}
org.apache.kylin.metadata.cachesyncCachedCrudAssist

Most used methods

  • reloadAll
  • reloadQuietly
  • save
  • delete
  • reload
  • setCheckCopyOnWrite
  • completeUuidIfNeeded
  • copyForWrite
  • getSerializer
  • initEntityAfterReload
  • reloadAt
  • reloadQuietlyAt
  • reloadAt,
  • reloadQuietlyAt,
  • resourceName,
  • resourcePath

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JTable (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now