Scopri come trovare il carroattrezzi ideale per le tue necessità con la nostra guida completa. Ti forniremo consigli utili su come valutare i servizi offerti, confrontare prezzi e garantire un'assistenza di qualità. Non lasciarti sorprendere, leggi ora per essere sempre preparato!
Trova professionisti vicino a te
Trova professionisti
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.jackrabbit.oak.plugins.segment;
import java.util.concurrent.atomic.AtomicInteger;
/**
* A segment notifier that can be used to track how many times
* a segment was accessed and how many times it was modified
* during one cycle of an external process.
*/
class AccessTrackingSegmentNotifier implements SegmentNotifier {
private final AtomicInteger accessCount = new AtomicInteger();
private final AtomicInteger modificationCount = new AtomicInteger();
@Override
public void accessed(SegmentId id) {
accessCount.incrementAndGet();
}
@Override
public void modified(SegmentId id) {
modificationCount.incrementAndGet();
}
public int getAccessCount() {
return accessCount.get();
}
public int getModificationCount() {
return modificationCount.get();
}
public void reset() {
accessCount.set(0);
modificationCount.set(0);
}
}