Search in sources :

Example 1 with AbstractDelegatingInternalDataContainer

use of org.infinispan.container.impl.AbstractDelegatingInternalDataContainer in project infinispan by infinispan.

the class ManualEvictionWithSizeBasedAndConcurrentOperationsInPrimaryOwnerTest method replaceControlledDataContainer.

private void replaceControlledDataContainer(final Latch latch) {
    InternalDataContainer current = TestingUtil.extractComponent(cache, InternalDataContainer.class);
    // noinspection unchecked
    InternalDataContainer controlledDataContainer = new AbstractDelegatingInternalDataContainer() {

        @Override
        protected InternalDataContainer delegate() {
            return current;
        }

        @Override
        public void evict(Object key) {
            latch.blockIfNeeded();
            super.evict(key);
        }

        @Override
        public CompletionStage<Void> evict(int segment, Object key) {
            latch.blockIfNeeded();
            return super.evict(segment, key);
        }
    };
    TestingUtil.replaceComponent(cache, InternalDataContainer.class, controlledDataContainer, true);
}
Also used : AbstractDelegatingInternalDataContainer(org.infinispan.container.impl.AbstractDelegatingInternalDataContainer) AbstractDelegatingInternalDataContainer(org.infinispan.container.impl.AbstractDelegatingInternalDataContainer) InternalDataContainer(org.infinispan.container.impl.InternalDataContainer)

Aggregations

AbstractDelegatingInternalDataContainer (org.infinispan.container.impl.AbstractDelegatingInternalDataContainer)1 InternalDataContainer (org.infinispan.container.impl.InternalDataContainer)1