Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* JBoss, Home of Professional Open Source.
* Copyright 2019, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.clustering.infinispan.client;
import java.net.SocketAddress;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.UnaryOperator;
import javax.management.ObjectName;
import jakarta.transaction.TransactionManager;
import org.infinispan.client.hotrod.CacheTopologyInfo;
import org.infinispan.client.hotrod.DataFormat;
import org.infinispan.client.hotrod.Flag;
import org.infinispan.client.hotrod.MetadataValue;
import org.infinispan.client.hotrod.RemoteCache;
import org.infinispan.client.hotrod.RemoteCacheManager;
import org.infinispan.client.hotrod.ServerStatistics;
import org.infinispan.client.hotrod.StreamingRemoteCache;
import org.infinispan.client.hotrod.configuration.Configuration;
import org.infinispan.client.hotrod.impl.ClientStatistics;
import org.infinispan.client.hotrod.impl.InternalRemoteCache;
import org.infinispan.client.hotrod.impl.RemoteCacheSupport;
import org.infinispan.client.hotrod.impl.operations.OperationsFactory;
import org.infinispan.client.hotrod.impl.operations.PingResponse;
import org.infinispan.client.hotrod.impl.operations.RetryAwareCompletionStage;
import org.infinispan.commons.util.CloseableIterator;
import org.infinispan.commons.util.CloseableIteratorCollection;
import org.infinispan.commons.util.CloseableIteratorSet;
import org.infinispan.commons.util.IntSet;
import org.infinispan.query.dsl.Query;
import org.reactivestreams.Publisher;
import org.wildfly.clustering.Registrar;
import org.wildfly.clustering.Registration;
import org.wildfly.clustering.infinispan.client.RemoteCacheContainer;
/**
* {@link RemoteCache} decorator that handles registration on {@link #start()} and deregistration on {@link #stop()}.
* @author Paul Ferraro
*/
public class ManagedRemoteCache extends RemoteCacheSupport implements InternalRemoteCache, UnaryOperator {
private final Registrar registrar;
private final AtomicReference registration;
private final RemoteCacheContainer container;
private final RemoteCacheManager manager;
private final InternalRemoteCache cache;
public ManagedRemoteCache(RemoteCacheContainer container, RemoteCacheManager manager, RemoteCache cache, Registrar registrar) {
this(container, manager, (InternalRemoteCache) cache, registrar, new AtomicReference<>());
}
private ManagedRemoteCache(RemoteCacheContainer container, RemoteCacheManager manager, InternalRemoteCache cache, Registrar registrar, AtomicReference registration) {
this.container = container;
this.manager = manager;
this.cache = cache;
this.registrar = registrar;
this.registration = registration;
}
@Override
public boolean isTransactional() {
return this.cache.isTransactional();
}
@Override
public TransactionManager getTransactionManager() {
return this.cache.getTransactionManager();
}
@Override
public void start() {
if (this.registration.getAndUpdate(this) == null) {
this.cache.start();
}
}
@Override
public Registration apply(Registration registration) {
return (registration == null) ? this.registrar.register(this.getName()) : registration;
}
@Override
public void stop() {
try (Registration registration = this.registration.getAndSet(null)) {
if (registration != null) {
this.cache.stop();
}
}
}
@Override
public RemoteCacheContainer getRemoteCacheContainer() {
return this.container;
}
@Deprecated
@Override
public RemoteCacheManager getRemoteCacheManager() {
return this.manager;
}
@Override
public void addClientListener(Object listener) {
this.cache.addClientListener(listener);
}
@Override
public void addClientListener(Object listener, Object[] filterFactoryParams, Object[] converterFactoryParams) {
this.cache.addClientListener(listener, filterFactoryParams, converterFactoryParams);
}
@Override
public ClientStatistics clientStatistics() {
return this.cache.clientStatistics();
}
@Override
public CloseableIteratorSet> entrySet(IntSet segments) {
return this.cache.entrySet(segments);
}
@Override
public T execute(String taskName, Map params) {
return this.cache.execute(taskName, params);
}
@Override
public CacheTopologyInfo getCacheTopologyInfo() {
return this.cache.getCacheTopologyInfo();
}
@Override
public DataFormat getDataFormat() {
return this.cache.getDataFormat();
}
@Deprecated
@Override
public Set