@Override public long performEntityCount() { //TODO, this really needs to be a task that writes this data somewhere since this will get //progressively slower as the system expands return (Long) getAllEntitiesObservable().countLong().toBlocking().last(); }
}, 10 ); observable.countLong().toBlocking().last();
@Override public Long call() throws Exception { GraphManager gm = factory.createEdgeManager( scope ); while ( !Thread.currentThread().isInterrupted() ) { //do a read to eventually trigger our group compaction. Take 2 pages of columns final long returnedEdgeCount = generator.doSearch( gm ) .doOnNext( edge -> readMeter.mark() ) .countLong().toBlocking().last(); logger.info( "Completed reading {} edges", returnedEdgeCount ); if ( writeCount != returnedEdgeCount ) { logger.warn( "Unexpected edge count returned!!! Expected {} but was {}", writeCount, returnedEdgeCount ); } assertEquals( "Expected to read same edge count", writeCount, returnedEdgeCount ); } return 0L; } }
}) .flatMap( edge -> manager.markEdge( edge )) .flatMap( edge -> manager.deleteEdge( edge ) ).countLong().toBlocking().last();
@Override public Observable<Long> evictAllExcept(final Source.SourceMatcher retainMatcher) { return getHolders() .doOnNext(new Action1<MultiSourcedDataHolder<InstanceInfo>>() { @Override public void call(MultiSourcedDataHolder<InstanceInfo> holder) { for (Source source : holder.getAllSources()) { if (!retainMatcher.match(source)) { holder.remove(source).subscribe(new NoOpSubscriber<MultiSourcedDataHolder.Status>()); } } } }) .countLong() .doOnError(new Action1<Throwable>() { @Override public void call(Throwable throwable) { logger.error("Error evicting registry", throwable); } }) .doOnCompleted(new Action0() { @Override public void call() { logger.info("Completed evicting registry"); } }); }
/** * Evict by sending to the evictionQueue instead of directly. */ @Override public Observable<Long> evictAllExcept(final Source.SourceMatcher retainMatcher) { return eurekaRegistry.getHolders() .doOnNext(new Action1<MultiSourcedDataHolder<InstanceInfo>>() { @Override public void call(MultiSourcedDataHolder<InstanceInfo> holder) { for (Source source : holder.getAllSources()) { if (!retainMatcher.match(source)) { evictionQueue.add(holder.get(source), source); } } } }) .countLong() .doOnError(new Action1<Throwable>() { @Override public void call(Throwable throwable) { logger.error("Error adding items to eviction queue", throwable); } }) .doOnCompleted(new Action0() { @Override public void call() { logger.info("Completed adding items to eviction queue"); } }); }