throw new IndexerModelException("Failed to delete indexer because it still has child data. Indexer: " + indexerName); if (t instanceof InterruptedException) Thread.currentThread().interrupt(); throw new IndexerModelException("Failed to delete indexer " + indexerName, t);
throw new IndexerModelException("Failed to delete indexer because it still has child data. Indexer: " + indexerName); if (t instanceof InterruptedException) Thread.currentThread().interrupt(); throw new IndexerModelException("Failed to delete indexer " + indexerName, t);
@Override public void addIndexer(IndexerDefinition indexer) throws IndexerExistsException, IndexerModelException, IndexerValidityException { assertValid(indexer); if (indexer.getIncrementalIndexingState() != IndexerDefinition.IncrementalIndexingState.DO_NOT_SUBSCRIBE) { indexer = new IndexerDefinitionBuilder().startFrom(indexer).subscriptionTimestamp(System.currentTimeMillis()).build(); } final String indexerPath = indexerCollectionPath + "/" + indexer.getName(); final byte[] data = IndexerDefinitionJsonSerDeser.INSTANCE.toJsonBytes(indexer); try { zk.retryOperation(new ZooKeeperOperation<String>() { @Override public String execute() throws KeeperException, InterruptedException { return zk.create(indexerPath, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } }); } catch (KeeperException.NodeExistsException e) { throw new IndexerExistsException(indexer.getName()); } catch (Exception e) { throw new IndexerModelException("Error creating indexer.", e); } }
@Override public void addIndexer(IndexerDefinition indexer) throws IndexerExistsException, IndexerModelException, IndexerValidityException { assertValid(indexer); if (indexer.getIncrementalIndexingState() != IndexerDefinition.IncrementalIndexingState.DO_NOT_SUBSCRIBE) { indexer = new IndexerDefinitionBuilder().startFrom(indexer).subscriptionTimestamp(System.currentTimeMillis()).build(); } final String indexerPath = indexerCollectionPath + "/" + indexer.getName(); final byte[] data = IndexerDefinitionJsonSerDeser.INSTANCE.toJsonBytes(indexer); try { zk.retryOperation(new ZooKeeperOperation<String>() { @Override public String execute() throws KeeperException, InterruptedException { return zk.create(indexerPath, data, CreateMode.PERSISTENT); } }); } catch (KeeperException.NodeExistsException e) { throw new IndexerExistsException(indexer.getName()); } catch (Exception e) { throw new IndexerModelException("Error creating indexer.", e); } }
if (indexer.getLifecycleState() == LifecycleState.DELETE_REQUESTED || indexer.getLifecycleState() == LifecycleState.DELETING) { throw new IndexerModelException("An indexer in state " + indexer.getLifecycleState() + " cannot be locked.");
if (indexer.getLifecycleState() == LifecycleState.DELETE_REQUESTED || indexer.getLifecycleState() == LifecycleState.DELETING) { throw new IndexerModelException("An indexer in state " + indexer.getLifecycleState() + " cannot be locked.");