repo
stringlengths 1
191
⌀ | file
stringlengths 23
351
| code
stringlengths 0
5.32M
| file_length
int64 0
5.32M
| avg_line_length
float64 0
2.9k
| max_line_length
int64 0
288k
| extension_type
stringclasses 1
value |
|---|---|---|---|---|---|---|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/group/CacheGroupServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.group;
import org.wildfly.clustering.group.Group;
import org.wildfly.clustering.server.service.CacheCapabilityServiceConfiguratorFactory;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.extension.clustering.server.CacheRequirementServiceConfiguratorProvider;
/**
* Provides the requisite builders for a cache-based {@link Group}.
* @author Paul Ferraro
*/
public class CacheGroupServiceConfiguratorProvider extends CacheRequirementServiceConfiguratorProvider<Group> {
protected CacheGroupServiceConfiguratorProvider(CacheCapabilityServiceConfiguratorFactory<Group> factory) {
super(ClusteringCacheRequirement.GROUP, factory);
}
}
| 1,767
| 44.333333
| 111
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/group/LocalGroupServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.group;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.group.Group;
/**
* Provides the requisite builders for a non-clustered {@link Group} service.
* @author Paul Ferraro
*/
@MetaInfServices(org.wildfly.clustering.server.service.LocalGroupServiceConfiguratorProvider.class)
public class LocalGroupServiceConfiguratorProvider extends GroupServiceConfiguratorProvider implements org.wildfly.clustering.server.service.LocalGroupServiceConfiguratorProvider {
public LocalGroupServiceConfiguratorProvider() {
super((name, group) -> new LocalGroupServiceConfigurator(name));
}
}
| 1,685
| 43.368421
| 180
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/dispatcher/LocalCommandDispatcherFactoryServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.dispatcher;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.as.clustering.function.Functions;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.msc.Service;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
import org.wildfly.clustering.group.Group;
import org.wildfly.clustering.server.dispatcher.CommandDispatcherFactory;
import org.wildfly.clustering.server.infinispan.dispatcher.LocalCommandDispatcherFactory;
import org.wildfly.clustering.server.service.ClusteringRequirement;
import org.wildfly.clustering.service.FunctionalService;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SimpleServiceNameProvider;
import org.wildfly.clustering.service.SupplierDependency;
/**
* Builds a non-clustered {@link org.wildfly.clustering.dispatcher.CommandDispatcherFactory} service.
* @author Paul Ferraro
*/
public class LocalCommandDispatcherFactoryServiceConfigurator extends SimpleServiceNameProvider implements CapabilityServiceConfigurator, Supplier<CommandDispatcherFactory> {
private final String groupName;
private volatile SupplierDependency<Group> group;
public LocalCommandDispatcherFactoryServiceConfigurator(ServiceName name, String groupName) {
super(name);
this.groupName = groupName;
}
@Override
public CommandDispatcherFactory get() {
return new LocalCommandDispatcherFactory(this.group.get());
}
@Override
public ServiceConfigurator configure(CapabilityServiceSupport support) {
this.group = new ServiceSupplierDependency<>(ClusteringRequirement.GROUP.getServiceName(support, this.groupName));
return this;
}
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = target.addService(this.getServiceName());
Consumer<CommandDispatcherFactory> factory = this.group.register(builder).provides(this.getServiceName());
Service service = new FunctionalService<>(factory, Functions.identity(), this);
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
}
| 3,533
| 43.734177
| 174
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/dispatcher/ChannelCommandDispatcherFactoryServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.extension.clustering.server.dispatcher;
import java.time.Duration;
import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.as.clustering.function.Consumers;
import org.jboss.as.clustering.function.Functions;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.as.server.Services;
import org.jboss.marshalling.ClassResolver;
import org.jboss.marshalling.MarshallingConfiguration;
import org.jboss.marshalling.ModularClassResolver;
import org.jboss.modules.Module;
import org.jboss.modules.ModuleLoader;
import org.jboss.msc.Service;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
import org.jgroups.JChannel;
import org.jgroups.Message;
import org.wildfly.clustering.dispatcher.CommandDispatcherFactory;
import org.wildfly.clustering.jgroups.spi.ChannelFactory;
import org.wildfly.clustering.jgroups.spi.JGroupsRequirement;
import org.wildfly.clustering.marshalling.jboss.DynamicClassTable;
import org.wildfly.clustering.marshalling.jboss.DynamicExternalizerObjectTable;
import org.wildfly.clustering.marshalling.jboss.JBossByteBufferMarshaller;
import org.wildfly.clustering.marshalling.jboss.SimpleMarshallingConfigurationRepository;
import org.wildfly.clustering.marshalling.protostream.ModuleClassLoaderMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamByteBufferMarshaller;
import org.wildfly.clustering.marshalling.protostream.SerializationContextBuilder;
import org.wildfly.clustering.marshalling.spi.ByteBufferMarshaller;
import org.wildfly.clustering.server.infinispan.dispatcher.AutoCloseableCommandDispatcherFactory;
import org.wildfly.clustering.server.infinispan.dispatcher.ChannelCommandDispatcherFactory;
import org.wildfly.clustering.server.infinispan.dispatcher.ChannelCommandDispatcherFactoryConfiguration;
import org.wildfly.clustering.service.AsyncServiceConfigurator;
import org.wildfly.clustering.service.CompositeDependency;
import org.wildfly.clustering.service.FunctionalService;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SimpleServiceNameProvider;
import org.wildfly.clustering.service.SupplierDependency;
import org.wildfly.security.manager.WildFlySecurityManager;
/**
* Builds a channel-based {@link org.wildfly.clustering.dispatcher.CommandDispatcherFactory} service.
* @author Paul Ferraro
*/
public class ChannelCommandDispatcherFactoryServiceConfigurator extends SimpleServiceNameProvider implements CapabilityServiceConfigurator, ChannelCommandDispatcherFactoryConfiguration, Supplier<AutoCloseableCommandDispatcherFactory>, Function<ClassLoader, ByteBufferMarshaller>, Predicate<Message> {
enum MarshallingVersion implements Function<Map.Entry<ClassResolver, ClassLoader>, MarshallingConfiguration> {
VERSION_1() {
@Override
public MarshallingConfiguration apply(Map.Entry<ClassResolver, ClassLoader> entry) {
MarshallingConfiguration config = new MarshallingConfiguration();
ClassLoader userLoader = entry.getValue();
ClassLoader loader = WildFlySecurityManager.getClassLoaderPrivileged(ChannelCommandDispatcherFactory.class);
List<ClassLoader> loaders = userLoader.equals(loader) ? List.of(userLoader) : List.of(userLoader, loader);
config.setClassResolver(entry.getKey());
config.setClassTable(new DynamicClassTable(loaders));
config.setObjectTable(new DynamicExternalizerObjectTable(loaders));
return config;
}
},
;
static final MarshallingVersion CURRENT = VERSION_1;
}
private final String group;
private volatile SupplierDependency<ChannelFactory> channelFactory;
private volatile SupplierDependency<JChannel> channel;
private volatile SupplierDependency<Module> module;
private volatile Supplier<ModuleLoader> loader;
private volatile Duration timeout = Duration.ofMinutes(1);
public ChannelCommandDispatcherFactoryServiceConfigurator(ServiceName name, String group) {
super(name);
this.group = group;
}
@Override
public AutoCloseableCommandDispatcherFactory get() {
return new ChannelCommandDispatcherFactory(this);
}
@Override
public ServiceConfigurator configure(CapabilityServiceSupport support) {
this.channel = new ServiceSupplierDependency<>(JGroupsRequirement.CHANNEL.getServiceName(support, this.group));
this.channelFactory = new ServiceSupplierDependency<>(JGroupsRequirement.CHANNEL_SOURCE.getServiceName(support, this.group));
this.module = new ServiceSupplierDependency<>(JGroupsRequirement.CHANNEL_MODULE.getServiceName(support, this.group));
return this;
}
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = new AsyncServiceConfigurator(this.getServiceName()).build(target);
this.loader = builder.requires(Services.JBOSS_SERVICE_MODULE_LOADER);
Consumer<CommandDispatcherFactory> factory = new CompositeDependency(this.channel, this.channelFactory, this.module).register(builder).provides(this.getServiceName());
Service service = new FunctionalService<>(factory, Functions.identity(), this, Consumers.close());
return builder.setInstance(service).setInitialMode(ServiceController.Mode.PASSIVE);
}
public ChannelCommandDispatcherFactoryServiceConfigurator timeout(Duration timeout) {
this.timeout = timeout;
return this;
}
@Override
public Function<ClassLoader, ByteBufferMarshaller> getMarshallerFactory() {
return this;
}
@Override
public ByteBufferMarshaller apply(ClassLoader loader) {
ModuleLoader moduleLoader = this.loader.get();
try {
return new ProtoStreamByteBufferMarshaller(new SerializationContextBuilder(new ModuleClassLoaderMarshaller(moduleLoader)).require(loader).build());
} catch (NoSuchElementException e) {
return new JBossByteBufferMarshaller(new SimpleMarshallingConfigurationRepository(MarshallingVersion.class, MarshallingVersion.CURRENT, new AbstractMap.SimpleImmutableEntry<>(ModularClassResolver.getInstance(moduleLoader), loader)), loader);
}
}
@Override
public JChannel getChannel() {
return this.channel.get();
}
@Override
public ByteBufferMarshaller getMarshaller() {
return new ProtoStreamByteBufferMarshaller(new SerializationContextBuilder(new ModuleClassLoaderMarshaller(this.loader.get())).load(this.module.get().getClassLoader()).build());
}
@Override
public Duration getTimeout() {
return this.timeout;
}
@Override
public Predicate<Message> getUnknownForkPredicate() {
return this;
}
@Override
public boolean test(Message response) {
return this.channelFactory.get().isUnknownForkResponse(response);
}
}
| 8,493
| 46.719101
| 300
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/dispatcher/LocalCommandDispatcherFactoryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.dispatcher;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.server.service.LocalGroupServiceConfiguratorProvider;
/**
* Provides the requisite builders for creating a non-clustered {@link org.wildfly.clustering.dispatcher.CommandDispatcherFactory}.
* @author Paul Ferraro
*/
@MetaInfServices(LocalGroupServiceConfiguratorProvider.class)
public class LocalCommandDispatcherFactoryServiceConfiguratorProvider extends CommandDispatcherFactoryServiceConfiguratorProvider implements LocalGroupServiceConfiguratorProvider {
public LocalCommandDispatcherFactoryServiceConfiguratorProvider() {
super(LocalCommandDispatcherFactoryServiceConfigurator::new);
}
}
| 1,763
| 45.421053
| 180
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/dispatcher/CommandDispatcherFactoryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.dispatcher;
import org.wildfly.clustering.dispatcher.CommandDispatcherFactory;
import org.wildfly.clustering.server.service.ClusteringRequirement;
import org.wildfly.clustering.server.service.GroupCapabilityServiceConfiguratorFactory;
import org.wildfly.extension.clustering.server.GroupJndiNameFactory;
import org.wildfly.extension.clustering.server.GroupRequirementServiceConfiguratorProvider;
/**
* Provides the requisite builders for creating a {@link org.wildfly.clustering.dispatcher.CommandDispatcherFactory} created from a specified factory..
* @author Paul Ferraro
*/
public class CommandDispatcherFactoryServiceConfiguratorProvider extends GroupRequirementServiceConfiguratorProvider<CommandDispatcherFactory> {
protected CommandDispatcherFactoryServiceConfiguratorProvider(GroupCapabilityServiceConfiguratorFactory<CommandDispatcherFactory> factory) {
super(ClusteringRequirement.COMMAND_DISPATCHER_FACTORY, factory, GroupJndiNameFactory.COMMAND_DISPATCHER_FACTORY);
}
}
| 2,075
| 50.9
| 151
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/dispatcher/ChannelCommandDispatcherFactoryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.dispatcher;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.server.service.DistributedGroupServiceConfiguratorProvider;
/**
* Provides the requisite builders for creating a channel-based {@link org.wildfly.clustering.dispatcher.CommandDispatcherFactory}.
* @author Paul Ferraro
*/
@MetaInfServices(DistributedGroupServiceConfiguratorProvider.class)
public class ChannelCommandDispatcherFactoryServiceConfiguratorProvider extends CommandDispatcherFactoryServiceConfiguratorProvider implements DistributedGroupServiceConfiguratorProvider {
public ChannelCommandDispatcherFactoryServiceConfiguratorProvider() {
super(ChannelCommandDispatcherFactoryServiceConfigurator::new);
}
}
| 1,787
| 46.052632
| 188
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/dispatcher/IdentityCommandDispatcherFactoryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, 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.wildfly.extension.clustering.server.dispatcher;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.server.service.ClusteringRequirement;
import org.wildfly.clustering.server.service.IdentityGroupServiceConfiguratorProvider;
import org.wildfly.extension.clustering.server.GroupJndiNameFactory;
import org.wildfly.extension.clustering.server.IdentityGroupRequirementServiceConfiguratorProvider;
/**
* @author Paul Ferraro
*/
@MetaInfServices(IdentityGroupServiceConfiguratorProvider.class)
public class IdentityCommandDispatcherFactoryServiceConfiguratorProvider extends IdentityGroupRequirementServiceConfiguratorProvider {
public IdentityCommandDispatcherFactoryServiceConfiguratorProvider() {
super(ClusteringRequirement.COMMAND_DISPATCHER_FACTORY, GroupJndiNameFactory.COMMAND_DISPATCHER_FACTORY);
}
}
| 1,876
| 44.780488
| 134
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/registry/FunctionalRegistryFactoryServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.extension.clustering.server.registry;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.msc.Service;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
import org.wildfly.clustering.registry.Registry;
import org.wildfly.clustering.registry.RegistryFactory;
import org.wildfly.clustering.server.infinispan.registry.FunctionalRegistryFactory;
import org.wildfly.clustering.service.Dependency;
import org.wildfly.clustering.service.SimpleServiceNameProvider;
/**
* @author Paul Ferraro
*/
public abstract class FunctionalRegistryFactoryServiceConfigurator<K, V> extends SimpleServiceNameProvider implements CapabilityServiceConfigurator, BiFunction<Map.Entry<K, V>, Runnable, Registry<K, V>>, Dependency {
public FunctionalRegistryFactoryServiceConfigurator(ServiceName name) {
super(name);
}
@Override
public final ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = target.addService(this.getServiceName());
Consumer<RegistryFactory<K, V>> factory = this.register(builder).provides(this.getServiceName());
Service service = Service.newInstance(factory, new FunctionalRegistryFactory<>(this));
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
}
| 2,581
| 43.517241
| 216
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/registry/LocalRegistryFactoryServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.registry;
import java.util.Map;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
import org.wildfly.clustering.group.Group;
import org.wildfly.clustering.registry.Registry;
import org.wildfly.clustering.registry.RegistryFactory;
import org.wildfly.clustering.server.infinispan.registry.LocalRegistry;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SupplierDependency;
/**
* Builds a non-clustered {@link RegistryFactory}.
* @author Paul Ferraro
* @param <K> the registry key type
* @param <V> the registry value type
*/
public class LocalRegistryFactoryServiceConfigurator<K, V> extends FunctionalRegistryFactoryServiceConfigurator<K, V> {
private final String containerName;
private final String cacheName;
private volatile SupplierDependency<Group> group;
public LocalRegistryFactoryServiceConfigurator(ServiceName name, String containerName, String cacheName) {
super(name);
this.containerName = containerName;
this.cacheName = cacheName;
}
@Override
public Registry<K, V> apply(Map.Entry<K, V> entry, Runnable closeTask) {
return new LocalRegistry<>(this.group.get(), entry, closeTask);
}
@Override
public ServiceConfigurator configure(CapabilityServiceSupport support) {
this.group = new ServiceSupplierDependency<>(ClusteringCacheRequirement.GROUP.getServiceName(support, this.containerName, this.cacheName));
return this;
}
@Override
public <T> ServiceBuilder<T> register(ServiceBuilder<T> builder) {
return this.group.register(builder);
}
}
| 2,940
| 39.287671
| 147
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/registry/LocalRegistryFactoryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.registry;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.registry.RegistryFactory;
import org.wildfly.clustering.server.service.LocalCacheServiceConfiguratorProvider;
import org.wildfly.clustering.server.service.registry.LocalRegistryServiceConfiguratorProvider;
/**
* Provides the requisite builders for a non-clustered {@link RegistryFactory}.
* @author Paul Ferraro
*/
@MetaInfServices({ LocalCacheServiceConfiguratorProvider.class, LocalRegistryServiceConfiguratorProvider.class })
public class LocalRegistryFactoryServiceConfiguratorProvider extends RegistryFactoryServiceConfiguratorProvider implements LocalRegistryServiceConfiguratorProvider {
public LocalRegistryFactoryServiceConfiguratorProvider() {
super(LocalRegistryFactoryServiceConfigurator::new);
}
}
| 1,880
| 46.025
| 165
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/registry/CacheRegistryFactoryServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.extension.clustering.server.registry;
import java.util.Map;
import org.infinispan.Cache;
import org.infinispan.remoting.transport.Address;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
import org.wildfly.clustering.infinispan.service.InfinispanCacheRequirement;
import org.wildfly.clustering.registry.Registry;
import org.wildfly.clustering.registry.RegistryFactory;
import org.wildfly.clustering.server.group.Group;
import org.wildfly.clustering.server.infinispan.registry.CacheRegistry;
import org.wildfly.clustering.server.infinispan.registry.CacheRegistryConfiguration;
import org.wildfly.clustering.server.infinispan.registry.LocalRegistry;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.clustering.service.CompositeDependency;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SupplierDependency;
/**
* Builds a clustered {@link RegistryFactory}.
* @author Paul Ferraro
*/
public class CacheRegistryFactoryServiceConfigurator<K, V> extends FunctionalRegistryFactoryServiceConfigurator<K, V> implements CacheRegistryConfiguration<K, V> {
private final String containerName;
private final String cacheName;
private volatile SupplierDependency<Group<Address>> group;
private volatile SupplierDependency<Cache<?, ?>> cache;
public CacheRegistryFactoryServiceConfigurator(ServiceName name, String containerName, String cacheName) {
super(name);
this.containerName = containerName;
this.cacheName = cacheName;
}
@Override
public Registry<K, V> apply(Map.Entry<K, V> entry, Runnable closeTask) {
Cache<?, ?> cache = this.cache.get();
return cache.getCacheConfiguration().clustering().cacheMode().isClustered() ? new CacheRegistry<>(this, entry, closeTask) : new LocalRegistry<>(this.group.get(), entry, closeTask);
}
@Override
public ServiceConfigurator configure(CapabilityServiceSupport support) {
this.cache = new ServiceSupplierDependency<>(InfinispanCacheRequirement.CACHE.getServiceName(support, this.containerName, this.cacheName));
this.group = new ServiceSupplierDependency<>(ClusteringCacheRequirement.GROUP.getServiceName(support, this.containerName, this.cacheName));
return this;
}
@Override
public <T> ServiceBuilder<T> register(ServiceBuilder<T> builder) {
return new CompositeDependency(this.cache, this.group).register(builder);
}
@Override
public Group<Address> getGroup() {
return this.group.get();
}
@SuppressWarnings("unchecked")
@Override
public <KK, VV> Cache<KK, VV> getCache() {
return (Cache<KK, VV>) this.cache.get();
}
}
| 3,947
| 42.384615
| 188
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/registry/IdentityRegistryFactoryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, 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.wildfly.extension.clustering.server.registry;
import java.util.List;
import org.jboss.as.clustering.controller.IdentityCapabilityServiceConfigurator;
import org.jboss.as.controller.OperationContext;
import org.jboss.msc.service.ServiceName;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.clustering.server.service.IdentityCacheServiceConfiguratorProvider;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.common.iteration.CompositeIterable;
import org.wildfly.extension.clustering.server.IdentityCacheRequirementServiceConfiguratorProvider;
/**
* @author Paul Ferraro
*/
@MetaInfServices(IdentityCacheServiceConfiguratorProvider.class)
public class IdentityRegistryFactoryServiceConfiguratorProvider extends IdentityCacheRequirementServiceConfiguratorProvider {
public IdentityRegistryFactoryServiceConfiguratorProvider() {
super(ClusteringCacheRequirement.REGISTRY_FACTORY);
}
@Override
public Iterable<ServiceConfigurator> getServiceConfigurators(OperationContext context, String containerName, String cacheName, String targetCacheName) {
Iterable<ServiceConfigurator> configurators = super.getServiceConfigurators(context, containerName, cacheName, targetCacheName);
ServiceName registryServiceName = ClusteringCacheRequirement.REGISTRY.getServiceName(context, containerName, cacheName);
ServiceName registryEntryServiceName = ClusteringCacheRequirement.REGISTRY_ENTRY.getServiceName(context, containerName, cacheName);
ServiceConfigurator registryConfigurator = new IdentityCapabilityServiceConfigurator<>(registryServiceName, ClusteringCacheRequirement.REGISTRY, containerName, targetCacheName).configure(context);
ServiceConfigurator registryEntryConfigurator = new IdentityCapabilityServiceConfigurator<>(registryEntryServiceName, ClusteringCacheRequirement.REGISTRY_ENTRY, containerName, targetCacheName).configure(context);
return new CompositeIterable<>(configurators, List.of(registryConfigurator, registryEntryConfigurator));
}
}
| 3,172
| 53.706897
| 220
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/registry/CacheRegistryFactoryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.registry;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.registry.RegistryFactory;
import org.wildfly.clustering.server.service.DistributedCacheServiceConfiguratorProvider;
import org.wildfly.clustering.server.service.registry.DistributedRegistryServiceConfiguratorProvider;
/**
* Provides the requisite builders for a clustered {@link RegistryFactory}.
* @author Paul Ferraro
*/
@MetaInfServices({ DistributedCacheServiceConfiguratorProvider.class, DistributedRegistryServiceConfiguratorProvider.class })
public class CacheRegistryFactoryServiceConfiguratorProvider extends RegistryFactoryServiceConfiguratorProvider implements DistributedRegistryServiceConfiguratorProvider {
public CacheRegistryFactoryServiceConfiguratorProvider() {
super(CacheRegistryFactoryServiceConfigurator::new);
}
}
| 1,906
| 46.675
| 171
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/registry/RegistryServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.registry;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.as.clustering.function.Consumers;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.msc.Service;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
import org.wildfly.clustering.registry.Registry;
import org.wildfly.clustering.registry.RegistryFactory;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.clustering.service.AsyncServiceConfigurator;
import org.wildfly.clustering.service.CompositeDependency;
import org.wildfly.clustering.service.FunctionalService;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SimpleServiceNameProvider;
import org.wildfly.clustering.service.SupplierDependency;
/**
* Builds a {@link Registry} service.
* @author Paul Ferraro
*/
public class RegistryServiceConfigurator<K, V> extends SimpleServiceNameProvider implements CapabilityServiceConfigurator, Supplier<Registry<K, V>> {
private final String containerName;
private final String cacheName;
private volatile SupplierDependency<RegistryFactory<K, V>> factory;
private volatile SupplierDependency<Map.Entry<K, V>> entry;
public RegistryServiceConfigurator(ServiceName name, String containerName, String cacheName) {
super(name);
this.containerName = containerName;
this.cacheName = cacheName;
}
@Override
public Registry<K, V> get() {
return this.factory.get().createRegistry(this.entry.get());
}
@Override
public ServiceConfigurator configure(CapabilityServiceSupport support) {
this.factory = new ServiceSupplierDependency<>(ClusteringCacheRequirement.REGISTRY_FACTORY.getServiceName(support, this.containerName, this.cacheName));
this.entry = new ServiceSupplierDependency<>(ClusteringCacheRequirement.REGISTRY_ENTRY.getServiceName(support, this.containerName, this.cacheName));
return this;
}
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = new AsyncServiceConfigurator(this.getServiceName()).build(target);
Consumer<Registry<K, V>> registry = new CompositeDependency(this.factory, this.entry).register(builder).provides(this.getServiceName());
Service service = new FunctionalService<>(registry, Function.identity(), this, Consumers.close());
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
}
| 3,953
| 44.448276
| 160
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/registry/RegistryFactoryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.registry;
import java.util.List;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.msc.service.ServiceName;
import org.wildfly.clustering.registry.RegistryFactory;
import org.wildfly.clustering.server.service.CacheCapabilityServiceConfiguratorFactory;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.common.iteration.CompositeIterable;
import org.wildfly.extension.clustering.server.CacheJndiNameFactory;
import org.wildfly.extension.clustering.server.CacheRequirementServiceConfiguratorProvider;
/**
* Provides the requisite builders for a clustered {@link RegistryFactory} created from the specified factory.
* @author Paul Ferraro
*/
public class RegistryFactoryServiceConfiguratorProvider extends CacheRequirementServiceConfiguratorProvider<RegistryFactory<Object, Object>> {
protected RegistryFactoryServiceConfiguratorProvider(CacheCapabilityServiceConfiguratorFactory<RegistryFactory<Object, Object>> factory) {
super(ClusteringCacheRequirement.REGISTRY_FACTORY, factory, CacheJndiNameFactory.REGISTRY_FACTORY);
}
@Override
public Iterable<ServiceConfigurator> getServiceConfigurators(CapabilityServiceSupport support, String containerName, String cacheName) {
Iterable<ServiceConfigurator> configurators = super.getServiceConfigurators(support, containerName, cacheName);
ServiceName name = ClusteringCacheRequirement.REGISTRY.getServiceName(support, containerName, cacheName);
ServiceConfigurator configurator = new RegistryServiceConfigurator<>(name, containerName, cacheName).configure(support);
return new CompositeIterable<>(configurators, List.of(configurator));
}
}
| 2,858
| 51.944444
| 142
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/provider/LocalServiceProviderRegistryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.provider;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.server.service.LocalCacheServiceConfiguratorProvider;
/**
* Provides the requisite builders for a non-clustered {@link ServiceProviderRegistrationFactory}.
* @author Paul Ferraro
*/
@MetaInfServices(LocalCacheServiceConfiguratorProvider.class)
public class LocalServiceProviderRegistryServiceConfiguratorProvider extends ServiceProviderRegistryServiceConfiguratorProvider implements LocalCacheServiceConfiguratorProvider {
public LocalServiceProviderRegistryServiceConfiguratorProvider() {
super(LocalServiceProviderRegistryServiceConfigurator::new);
}
}
| 1,724
| 44.394737
| 178
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/provider/CacheServiceProviderRegistryServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.extension.clustering.server.provider;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.infinispan.Cache;
import org.infinispan.remoting.transport.Address;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.as.clustering.function.Consumers;
import org.jboss.as.clustering.function.Functions;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.msc.Service;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
import org.wildfly.clustering.infinispan.service.InfinispanCacheRequirement;
import org.wildfly.clustering.provider.ServiceProviderRegistry;
import org.wildfly.clustering.server.dispatcher.CommandDispatcherFactory;
import org.wildfly.clustering.server.group.Group;
import org.wildfly.clustering.server.infinispan.provider.AutoCloseableServiceProviderRegistry;
import org.wildfly.clustering.server.infinispan.provider.CacheServiceProviderRegistry;
import org.wildfly.clustering.server.infinispan.provider.CacheServiceProviderRegistryConfiguration;
import org.wildfly.clustering.server.infinispan.provider.LocalServiceProviderRegistry;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.clustering.server.service.ClusteringRequirement;
import org.wildfly.clustering.service.AsyncServiceConfigurator;
import org.wildfly.clustering.service.CompositeDependency;
import org.wildfly.clustering.service.FunctionalService;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SimpleServiceNameProvider;
import org.wildfly.clustering.service.SupplierDependency;
/**
* Builds a clustered {@link ServiceProviderRegistrationFactory} service.
* @author Paul Ferraro
*/
public class CacheServiceProviderRegistryServiceConfigurator<T> extends SimpleServiceNameProvider implements CapabilityServiceConfigurator, CacheServiceProviderRegistryConfiguration<T>, Supplier<AutoCloseableServiceProviderRegistry<T>> {
private final String containerName;
private final String cacheName;
private volatile SupplierDependency<CommandDispatcherFactory> dispatcherFactory;
private volatile SupplierDependency<Group<Address>> group;
private volatile SupplierDependency<Cache<?, ?>> cache;
public CacheServiceProviderRegistryServiceConfigurator(ServiceName name, String containerName, String cacheName) {
super(name);
this.containerName = containerName;
this.cacheName = cacheName;
}
@Override
public AutoCloseableServiceProviderRegistry<T> get() {
Cache<?, ?> cache = this.cache.get();
return cache.getCacheConfiguration().clustering().cacheMode().isClustered() ? new CacheServiceProviderRegistry<>(this) : new LocalServiceProviderRegistry<>(this.group.get());
}
@Override
public ServiceConfigurator configure(CapabilityServiceSupport support) {
this.cache = new ServiceSupplierDependency<>(InfinispanCacheRequirement.CACHE.getServiceName(support, this.containerName, this.cacheName));
this.dispatcherFactory = new ServiceSupplierDependency<>(ClusteringRequirement.COMMAND_DISPATCHER_FACTORY.getServiceName(support, this.containerName));
this.group = new ServiceSupplierDependency<>(ClusteringCacheRequirement.GROUP.getServiceName(support, this.containerName, this.cacheName));
return this;
}
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = new AsyncServiceConfigurator(this.getServiceName()).build(target);
Consumer<ServiceProviderRegistry<T>> registry = new CompositeDependency(this.cache, this.dispatcherFactory, this.group).register(builder).provides(this.getServiceName());
Service service = new FunctionalService<>(registry, Functions.identity(), this, Consumers.close());
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
@Override
public Object getId() {
return this.getServiceName();
}
@Override
public Group<Address> getGroup() {
return this.group.get();
}
@SuppressWarnings("unchecked")
@Override
public <K, V> Cache<K, V> getCache() {
return (Cache<K, V>) this.cache.get();
}
@Override
public CommandDispatcherFactory getCommandDispatcherFactory() {
return this.dispatcherFactory.get();
}
}
| 5,656
| 46.940678
| 237
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/provider/CacheServiceProviderRegistryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.provider;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.server.service.DistributedCacheServiceConfiguratorProvider;
/**
* Provides the requisite builders for a clustered {@link ServiceProviderRegistrationFactory}.
* @author Paul Ferraro
*/
@MetaInfServices(DistributedCacheServiceConfiguratorProvider.class)
public class CacheServiceProviderRegistryServiceConfiguratorProvider extends ServiceProviderRegistryServiceConfiguratorProvider implements DistributedCacheServiceConfiguratorProvider {
public CacheServiceProviderRegistryServiceConfiguratorProvider() {
super(CacheServiceProviderRegistryServiceConfigurator::new);
}
}
| 1,738
| 44.763158
| 184
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/provider/ServiceProviderRegistryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.provider;
import org.wildfly.clustering.provider.ServiceProviderRegistry;
import org.wildfly.clustering.server.service.CacheCapabilityServiceConfiguratorFactory;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.extension.clustering.server.CacheJndiNameFactory;
import org.wildfly.extension.clustering.server.CacheRequirementServiceConfiguratorProvider;
/**
* Provides the requisite builders for a {@link ServiceProviderRegistrationFactory} created from the specified factory.
* @author Paul Ferraro
*/
public class ServiceProviderRegistryServiceConfiguratorProvider extends CacheRequirementServiceConfiguratorProvider<ServiceProviderRegistry<Object>> {
public ServiceProviderRegistryServiceConfiguratorProvider(CacheCapabilityServiceConfiguratorFactory<ServiceProviderRegistry<Object>> factory) {
super(ClusteringCacheRequirement.SERVICE_PROVIDER_REGISTRY, factory, CacheJndiNameFactory.SERVICE_PROVIDER_REGISTRY);
}
}
| 2,055
| 50.4
| 150
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/provider/LocalServiceProviderRegistryServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.extension.clustering.server.provider;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.jboss.msc.Service;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
import org.wildfly.clustering.group.Group;
import org.wildfly.clustering.provider.ServiceProviderRegistry;
import org.wildfly.clustering.server.infinispan.provider.LocalServiceProviderRegistry;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.clustering.service.FunctionalService;
import org.wildfly.clustering.service.ServiceConfigurator;
import org.wildfly.clustering.service.ServiceSupplierDependency;
import org.wildfly.clustering.service.SimpleServiceNameProvider;
import org.wildfly.clustering.service.SupplierDependency;
/**
* Builds a non-clustered {@link ServiceProviderRegistrationFactory} service.
* @author Paul Ferraro
*/
public class LocalServiceProviderRegistryServiceConfigurator<T> extends SimpleServiceNameProvider implements CapabilityServiceConfigurator, Supplier<ServiceProviderRegistry<T>> {
private final String containerName;
private final String cacheName;
private volatile SupplierDependency<Group> group;
public LocalServiceProviderRegistryServiceConfigurator(ServiceName name, String containerName, String cacheName) {
super(name);
this.containerName = containerName;
this.cacheName = cacheName;
}
@Override
public ServiceProviderRegistry<T> get() {
return new LocalServiceProviderRegistry<>(this.group.get());
}
@Override
public ServiceConfigurator configure(CapabilityServiceSupport support) {
this.group = new ServiceSupplierDependency<>(ClusteringCacheRequirement.GROUP.getServiceName(support, this.containerName, this.cacheName));
return this;
}
@Override
public ServiceBuilder<?> build(ServiceTarget target) {
ServiceBuilder<?> builder = target.addService(this.getServiceName());
Consumer<ServiceProviderRegistry<T>> registry = this.group.register(builder).provides(this.getServiceName());
Service service = new FunctionalService<>(registry, Function.identity(), this);
return builder.setInstance(service).setInitialMode(ServiceController.Mode.ON_DEMAND);
}
}
| 3,624
| 43.753086
| 178
|
java
|
null |
wildfly-main/clustering/server/extension/src/main/java/org/wildfly/extension/clustering/server/provider/IdentityServiceProviderRegistryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, 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.wildfly.extension.clustering.server.provider;
import org.jboss.as.clustering.naming.JndiNameFactory;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.server.service.ClusteringCacheRequirement;
import org.wildfly.clustering.server.service.IdentityCacheServiceConfiguratorProvider;
import org.wildfly.extension.clustering.server.IdentityCacheRequirementServiceConfiguratorProvider;
/**
* @author Paul Ferraro
*/
@MetaInfServices(IdentityCacheServiceConfiguratorProvider.class)
public class IdentityServiceProviderRegistryServiceConfiguratorProvider extends IdentityCacheRequirementServiceConfiguratorProvider {
public IdentityServiceProviderRegistryServiceConfiguratorProvider() {
super(ClusteringCacheRequirement.SERVICE_PROVIDER_REGISTRY, (containerName, cacheName) -> JndiNameFactory.createJndiName(JndiNameFactory.DEFAULT_JNDI_NAMESPACE, "clustering", "providers", containerName, cacheName));
}
}
| 1,973
| 47.146341
| 223
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/IdentityCacheServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.service;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.wildfly.clustering.service.ServiceConfigurator;
/**
* @author Paul Ferraro
*/
public interface IdentityCacheServiceConfiguratorProvider {
Iterable<ServiceConfigurator> getServiceConfigurators(CapabilityServiceSupport support, String containerName, String cacheName, String targetCacheName);
default Iterable<ServiceConfigurator> getServiceConfigurators(OperationContext context, String containerName, String cacheName, String targetCacheName) {
return this.getServiceConfigurators(context.getCapabilityServiceSupport(), containerName, cacheName, targetCacheName);
}
}
| 1,792
| 44.974359
| 157
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/LocalCacheServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.service;
/**
* @author Paul Ferraro
*/
public interface LocalCacheServiceConfiguratorProvider extends CacheServiceConfiguratorProvider {
}
| 1,205
| 37.903226
| 97
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/ClusteringCacheRequirement.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2016, 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.wildfly.clustering.server.service;
import org.jboss.as.clustering.controller.BinaryRequirementServiceNameFactory;
import org.jboss.as.clustering.controller.BinaryServiceNameFactory;
import org.jboss.as.clustering.controller.DefaultableBinaryServiceNameFactoryProvider;
import org.jboss.as.clustering.controller.UnaryServiceNameFactory;
import org.wildfly.clustering.service.BinaryRequirement;
import org.wildfly.clustering.service.DefaultableBinaryRequirement;
import org.wildfly.clustering.service.UnaryRequirement;
/**
* @author Paul Ferraro
*/
public enum ClusteringCacheRequirement implements DefaultableBinaryRequirement, DefaultableBinaryServiceNameFactoryProvider {
GROUP("org.wildfly.clustering.cache.group", ClusteringDefaultCacheRequirement.GROUP),
REGISTRY("org.wildfly.clustering.cache.registry", ClusteringDefaultCacheRequirement.REGISTRY),
REGISTRY_ENTRY("org.wildfly.clustering.cache.registry-entry", ClusteringDefaultCacheRequirement.REGISTRY_ENTRY),
REGISTRY_FACTORY("org.wildfly.clustering.cache.registry-factory", ClusteringDefaultCacheRequirement.REGISTRY_FACTORY),
SERVICE_PROVIDER_REGISTRY("org.wildfly.clustering.cache.service-provider-registry", ClusteringDefaultCacheRequirement.SERVICE_PROVIDER_REGISTRY),
;
private final String name;
private final BinaryServiceNameFactory factory = new BinaryRequirementServiceNameFactory(this);
private final ClusteringDefaultCacheRequirement defaultRequirement;
ClusteringCacheRequirement(BinaryRequirement requirement, ClusteringDefaultCacheRequirement defaultRequirement) {
this(requirement.getName(), defaultRequirement);
}
ClusteringCacheRequirement(String name, ClusteringDefaultCacheRequirement defaultRequirement) {
this.name = name;
this.defaultRequirement = defaultRequirement;
}
@Override
public String getName() {
return this.name;
}
@Override
public UnaryRequirement getDefaultRequirement() {
return this.defaultRequirement;
}
@Override
public BinaryServiceNameFactory getServiceNameFactory() {
return this.factory;
}
@Override
public UnaryServiceNameFactory getDefaultServiceNameFactory() {
return this.defaultRequirement;
}
}
| 3,304
| 43.066667
| 149
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/DistributedGroupServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.service;
/**
* @author Paul Ferraro
*/
public interface DistributedGroupServiceConfiguratorProvider extends GroupServiceConfiguratorProvider {
}
| 1,211
| 38.096774
| 103
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/ProvidedCacheServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2022, 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.wildfly.clustering.server.service;
import java.util.ServiceLoader;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.as.clustering.controller.CompositeCapabilityServiceConfigurator;
import org.wildfly.clustering.service.ServiceConfigurator;
/**
* A {@link CapabilityServiceConfigurator} facade for collecting, configuring, and building; or removing; a set of {@link ServiceConfigurator} instances acquired from a {@link CacheServiceConfiguratorProvider}.
* @author Paul Ferraro
*/
public class ProvidedCacheServiceConfigurator<P extends CacheServiceConfiguratorProvider> extends CompositeCapabilityServiceConfigurator {
public ProvidedCacheServiceConfigurator(Class<P> providerClass, String containerName, String cacheName) {
super((support, consumer) -> {
for (P provider : ServiceLoader.load(providerClass, providerClass.getClassLoader())) {
for (ServiceConfigurator configurator : provider.getServiceConfigurators(support, containerName, cacheName)) {
consumer.accept(configurator);
}
}
});
}
}
| 2,181
| 45.425532
| 210
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/GroupServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.service;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.wildfly.clustering.service.ServiceConfigurator;
/**
* @author Paul Ferraro
*/
public interface GroupServiceConfiguratorProvider {
Iterable<ServiceConfigurator> getServiceConfigurators(CapabilityServiceSupport support, String group);
default Iterable<ServiceConfigurator> getServiceConfigurators(OperationContext context, String group) {
return this.getServiceConfigurators(context.getCapabilityServiceSupport(), group);
}
}
| 1,648
| 41.282051
| 107
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/IdentityGroupServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.service;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.wildfly.clustering.service.ServiceConfigurator;
/**
* @author Paul Ferraro
*/
public interface IdentityGroupServiceConfiguratorProvider {
Iterable<ServiceConfigurator> getServiceConfigurators(CapabilityServiceSupport support, String group, String targetGroup);
default Iterable<ServiceConfigurator> getServiceConfigurators(OperationContext context, String group, String targetGroup) {
return this.getServiceConfigurators(context.getCapabilityServiceSupport(), group, targetGroup);
}
}
| 1,709
| 42.846154
| 127
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/CacheServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.service;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.capability.CapabilityServiceSupport;
import org.wildfly.clustering.service.ServiceConfigurator;
/**
* @author Paul Ferraro
*/
public interface CacheServiceConfiguratorProvider {
Iterable<ServiceConfigurator> getServiceConfigurators(CapabilityServiceSupport support, String containerName, String cacheName);
default Iterable<ServiceConfigurator> getServiceConfigurators(OperationContext context, String containerName, String cacheName) {
return this.getServiceConfigurators(context.getCapabilityServiceSupport(), containerName, cacheName);
}
}
| 1,719
| 43.102564
| 133
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/CacheCapabilityServiceConfiguratorFactory.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.clustering.server.service;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.msc.service.ServiceName;
/**
* Builds a service for a cache.
* @author Paul Ferraro
*/
public interface CacheCapabilityServiceConfiguratorFactory<T> {
CapabilityServiceConfigurator createServiceConfigurator(ServiceName name, String containerName, String cacheName);
}
| 1,438
| 40.114286
| 118
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/ProvidedIdentityCacheServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2022, 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.wildfly.clustering.server.service;
import java.util.ServiceLoader;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.as.clustering.controller.CompositeCapabilityServiceConfigurator;
import org.wildfly.clustering.service.ServiceConfigurator;
/**
* A {@link CapabilityServiceConfigurator} facade for collecting, configuring, and building; or removing; a set of {@link ServiceConfigurator} instances acquired from a {@link IdentityCacheServiceConfiguratorProvider}.
* @author Paul Ferraro
*/
public class ProvidedIdentityCacheServiceConfigurator extends CompositeCapabilityServiceConfigurator {
public ProvidedIdentityCacheServiceConfigurator(String containerName, String cacheName, String targetCacheName) {
super((support, consumer) -> {
for (IdentityCacheServiceConfiguratorProvider provider : ServiceLoader.load(IdentityCacheServiceConfiguratorProvider.class, IdentityCacheServiceConfiguratorProvider.class.getClassLoader())) {
for (ServiceConfigurator configurator : provider.getServiceConfigurators(support, containerName, cacheName, targetCacheName)) {
consumer.accept(configurator);
}
}
});
}
}
| 2,283
| 47.595745
| 218
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/ClusteringDefaultRequirement.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2016, 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.wildfly.clustering.server.service;
import org.jboss.as.clustering.controller.RequirementServiceNameFactory;
import org.jboss.as.clustering.controller.ServiceNameFactory;
import org.jboss.as.clustering.controller.ServiceNameFactoryProvider;
import org.wildfly.clustering.server.dispatcher.CommandDispatcherFactory;
import org.wildfly.clustering.server.group.Group;
import org.wildfly.clustering.service.Requirement;
/**
* @author Paul Ferraro
*/
public enum ClusteringDefaultRequirement implements Requirement, ServiceNameFactoryProvider {
COMMAND_DISPATCHER_FACTORY("org.wildfly.clustering.default-command-dispatcher-factory", CommandDispatcherFactory.class),
GROUP("org.wildfly.clustering.default-group", Group.class),
;
private final String name;
private final Class<?> type;
private final ServiceNameFactory factory = new RequirementServiceNameFactory(this);
ClusteringDefaultRequirement(String name, Class<?> type) {
this.name = name;
this.type = type;
}
@Override
public String getName() {
return this.name;
}
@Override
public Class<?> getType() {
return this.type;
}
@Override
public ServiceNameFactory getServiceNameFactory() {
return this.factory;
}
}
| 2,311
| 36.290323
| 124
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/ClusteringDefaultCacheRequirement.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2016, 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.wildfly.clustering.server.service;
import java.util.Map;
import org.jboss.as.clustering.controller.UnaryRequirementServiceNameFactory;
import org.jboss.as.clustering.controller.UnaryServiceNameFactory;
import org.jboss.as.clustering.controller.UnaryServiceNameFactoryProvider;
import org.wildfly.clustering.group.Group;
import org.wildfly.clustering.provider.ServiceProviderRegistry;
import org.wildfly.clustering.registry.Registry;
import org.wildfly.clustering.registry.RegistryFactory;
import org.wildfly.clustering.service.UnaryRequirement;
/**
* @author Paul Ferraro
*/
public enum ClusteringDefaultCacheRequirement implements UnaryRequirement, UnaryServiceNameFactoryProvider {
GROUP("org.wildfly.clustering.cache.default-group", Group.class),
REGISTRY("org.wildfly.clustering.cache.default-registry", Registry.class),
REGISTRY_ENTRY("org.wildfly.clustering.cache.default-registry-entry", Map.Entry.class),
REGISTRY_FACTORY("org.wildfly.clustering.cache.default-registry-factory", RegistryFactory.class),
SERVICE_PROVIDER_REGISTRY("org.wildfly.clustering.cache.default-service-provider-registry", ServiceProviderRegistry.class),
;
private final String name;
private final Class<?> type;
private final UnaryServiceNameFactory factory = new UnaryRequirementServiceNameFactory(this);
ClusteringDefaultCacheRequirement(UnaryRequirement requirement) {
this(requirement.getName(), requirement.getType());
}
ClusteringDefaultCacheRequirement(String name, Class<?> type) {
this.name = name;
this.type = type;
}
@Override
public String getName() {
return this.name;
}
@Override
public Class<?> getType() {
return this.type;
}
@Override
public UnaryServiceNameFactory getServiceNameFactory() {
return this.factory;
}
}
| 2,896
| 38.684932
| 127
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/ProvidedIdentityGroupServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2022, 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.wildfly.clustering.server.service;
import java.util.ServiceLoader;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.as.clustering.controller.CompositeCapabilityServiceConfigurator;
import org.wildfly.clustering.service.ServiceConfigurator;
/**
* A {@link CapabilityServiceConfigurator} facade for collecting, configuring, and building; or removing; a set of {@link ServiceConfigurator} instances acquired from a {@link IdentityGroupServiceConfiguratorProvider}.
* @author Paul Ferraro
*/
public class ProvidedIdentityGroupServiceConfigurator extends CompositeCapabilityServiceConfigurator {
public ProvidedIdentityGroupServiceConfigurator(String group, String targetGroup) {
super((support, consumer) -> {
for (IdentityGroupServiceConfiguratorProvider provider : ServiceLoader.load(IdentityGroupServiceConfiguratorProvider.class, IdentityGroupServiceConfiguratorProvider.class.getClassLoader())) {
for (ServiceConfigurator configurator : provider.getServiceConfigurators(support, group, targetGroup)) {
consumer.accept(configurator);
}
}
});
}
}
| 2,230
| 46.468085
| 218
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/DistributedCacheServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.service;
/**
* @author Paul Ferraro
*/
public interface DistributedCacheServiceConfiguratorProvider extends CacheServiceConfiguratorProvider {
}
| 1,211
| 38.096774
| 103
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/LocalGroupServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.service;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
/**
* @author Paul Ferraro
*/
public interface LocalGroupServiceConfiguratorProvider extends GroupServiceConfiguratorProvider {
/**
* Identifies the name of the local group.
*/
String LOCAL = ModelDescriptionConstants.LOCAL;
}
| 1,391
| 37.666667
| 97
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/ProvidedGroupServiceConfigurator.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2022, 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.wildfly.clustering.server.service;
import java.util.ServiceLoader;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.as.clustering.controller.CompositeCapabilityServiceConfigurator;
import org.wildfly.clustering.service.ServiceConfigurator;
/**
* A {@link CapabilityServiceConfigurator} facade for collecting, configuring, and building; or removing; a set of {@link ServiceConfigurator} instances acquired from a {@link GroupServiceConfiguratorProvider}.
* @author Paul Ferraro
*/
public class ProvidedGroupServiceConfigurator<P extends GroupServiceConfiguratorProvider> extends CompositeCapabilityServiceConfigurator {
public ProvidedGroupServiceConfigurator(Class<P> providerClass, String group) {
super((support, consumer) -> {
for (P provider : ServiceLoader.load(providerClass, providerClass.getClassLoader())) {
for (ServiceConfigurator configurator : provider.getServiceConfigurators(support, group)) {
consumer.accept(configurator);
}
}
});
}
}
| 2,136
| 44.468085
| 210
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/ClusteringRequirement.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2016, 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.wildfly.clustering.server.service;
import org.jboss.as.clustering.controller.DefaultableUnaryServiceNameFactoryProvider;
import org.jboss.as.clustering.controller.ServiceNameFactory;
import org.jboss.as.clustering.controller.UnaryRequirementServiceNameFactory;
import org.jboss.as.clustering.controller.UnaryServiceNameFactory;
import org.wildfly.clustering.service.DefaultableUnaryRequirement;
import org.wildfly.clustering.service.Requirement;
/**
* @author Paul Ferraro
*/
public enum ClusteringRequirement implements DefaultableUnaryRequirement, DefaultableUnaryServiceNameFactoryProvider {
COMMAND_DISPATCHER_FACTORY("org.wildfly.clustering.command-dispatcher-factory", ClusteringDefaultRequirement.COMMAND_DISPATCHER_FACTORY),
GROUP("org.wildfly.clustering.group", ClusteringDefaultRequirement.GROUP),
;
private final String name;
private final UnaryServiceNameFactory factory = new UnaryRequirementServiceNameFactory(this);
private final ClusteringDefaultRequirement defaultRequirement;
ClusteringRequirement(String name, ClusteringDefaultRequirement defaultRequirement) {
this.name = name;
this.defaultRequirement = defaultRequirement;
}
@Override
public String getName() {
return this.name;
}
@Override
public Requirement getDefaultRequirement() {
return this.defaultRequirement;
}
@Override
public UnaryServiceNameFactory getServiceNameFactory() {
return this.factory;
}
@Override
public ServiceNameFactory getDefaultServiceNameFactory() {
return this.defaultRequirement;
}
}
| 2,659
| 38.117647
| 141
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/GroupCapabilityServiceConfiguratorFactory.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.clustering.server.service;
import org.jboss.as.clustering.controller.CapabilityServiceConfigurator;
import org.jboss.msc.service.ServiceName;
/**
* Builds a group-based service.
* @author Paul Ferraro
*/
public interface GroupCapabilityServiceConfiguratorFactory<T> {
CapabilityServiceConfigurator createServiceConfigurator(ServiceName name, String group);
}
| 1,411
| 40.529412
| 92
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/group/LocalCacheGroupServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2022, 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.wildfly.clustering.server.service.group;
import org.wildfly.clustering.server.group.Group;
import org.wildfly.clustering.server.service.LocalCacheServiceConfiguratorProvider;
/**
* Provides service configurators for a local cache {@link Group}.
* @author Paul Ferraro
*/
public interface LocalCacheGroupServiceConfiguratorProvider extends LocalCacheServiceConfiguratorProvider {
}
| 1,423
| 39.685714
| 107
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/group/DistributedCacheGroupServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2022, 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.wildfly.clustering.server.service.group;
import org.wildfly.clustering.server.group.Group;
import org.wildfly.clustering.server.service.DistributedCacheServiceConfiguratorProvider;
/**
* Provides service configurators for a distributed cache {@link Group}.
* @author Paul Ferraro
*/
public interface DistributedCacheGroupServiceConfiguratorProvider extends DistributedCacheServiceConfiguratorProvider {
}
| 1,447
| 40.371429
| 119
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/registry/LocalRegistryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2022, 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.wildfly.clustering.server.service.registry;
import org.wildfly.clustering.server.service.LocalCacheServiceConfiguratorProvider;
/**
* Provides service configurators for a local {@link org.wildfly.clustering.registry.Registry}.
* @author Paul Ferraro
*/
public interface LocalRegistryServiceConfiguratorProvider extends LocalCacheServiceConfiguratorProvider {
}
| 1,403
| 40.294118
| 105
|
java
|
null |
wildfly-main/clustering/server/service/src/main/java/org/wildfly/clustering/server/service/registry/DistributedRegistryServiceConfiguratorProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2022, 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.wildfly.clustering.server.service.registry;
import org.wildfly.clustering.server.service.DistributedCacheServiceConfiguratorProvider;
/**
* Provides service configurators for a distributed {@link org.wildfly.clustering.registry.Registry}.
* @author Paul Ferraro
*/
public interface DistributedRegistryServiceConfiguratorProvider extends DistributedCacheServiceConfiguratorProvider {
}
| 1,427
| 41
| 117
|
java
|
null |
wildfly-main/clustering/server/spi/src/main/java/org/wildfly/clustering/server/NodeFactory.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.server;
import org.wildfly.clustering.group.Node;
/**
* @author Paul Ferraro
*/
public interface NodeFactory<A> {
Node createNode(A address);
}
| 1,208
| 34.558824
| 70
|
java
|
null |
wildfly-main/clustering/server/spi/src/main/java/org/wildfly/clustering/server/group/Group.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.server.group;
import org.wildfly.clustering.server.NodeFactory;
/**
* {@link Group} that can create {@link org.wildfly.clustering.group.Node} instances.
* @author Paul Ferraro
* @param <A> address type
*/
public interface Group<A> extends org.wildfly.clustering.group.Group, NodeFactory<A> {
}
| 1,355
| 38.882353
| 86
|
java
|
null |
wildfly-main/clustering/server/spi/src/main/java/org/wildfly/clustering/server/dispatcher/CommandDispatcherFactory.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2020, 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.wildfly.clustering.server.dispatcher;
import org.wildfly.clustering.dispatcher.CommandDispatcher;
import org.wildfly.security.manager.WildFlySecurityManager;
/**
* @author Paul Ferraro
*/
public interface CommandDispatcherFactory extends org.wildfly.clustering.dispatcher.CommandDispatcherFactory {
@Override
default <C> CommandDispatcher<C> createCommandDispatcher(Object id, C context) {
return this.createCommandDispatcher(id, context, WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
}
<C> CommandDispatcher<C> createCommandDispatcher(Object id, C context, ClassLoader loader);
}
| 1,667
| 40.7
| 122
|
java
|
null |
wildfly-main/clustering/server/api/src/test/java/org/wildfly/clustering/dispatcher/TestCommandDispatcher.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.dispatcher;
import java.util.Map;
import java.util.concurrent.CompletionStage;
import org.wildfly.clustering.group.Node;
/**
* {@link CommandDispatcher} that delegates to a mock dispatcher.
* @author Paul Ferraro
*/
public class TestCommandDispatcher<C> implements CommandDispatcher<C> {
private final CommandDispatcher<C> dispatcher;
public TestCommandDispatcher(CommandDispatcher<C> dispatcher) {
this.dispatcher = dispatcher;
}
@Override
public C getContext() {
return this.dispatcher.getContext();
}
@Override
public <R> CompletionStage<R> executeOnMember(Command<R, ? super C> command, Node member) throws CommandDispatcherException {
return this.dispatcher.executeOnMember(command, member);
}
@Override
public <R> Map<Node, CompletionStage<R>> executeOnGroup(Command<R, ? super C> command, Node... excludedMembers) throws CommandDispatcherException {
return this.dispatcher.executeOnGroup(command, excludedMembers);
}
@Override
public void close() {
this.dispatcher.close();
}
}
| 2,152
| 33.725806
| 151
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/Registrar.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering;
/**
* Defines the contract for registration-capable objects, e.g. for listener registration.
* @author Paul Ferraro
* @param <T> the type of object to be registered
*/
public interface Registrar<T> {
/**
* Registers an object. The object is unregistered when the generated {@link Registration} is closed.
* @param object an object to register
* @return an object registration.
*/
Registration register(T object);
}
| 1,505
| 38.631579
| 106
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/Registration.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering;
/**
* Encapsulates a registration.
* @author Paul Ferraro
*/
public interface Registration extends AutoCloseable {
/**
* Removes this registration from the associated {@link Registrar}, after which this object is no longer functional.
*/
@Override
void close();
}
| 1,346
| 36.416667
| 120
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/group/package-info.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.
*/
/**
* Public clustering API which represent cluster group and its members.
*/
package org.wildfly.clustering.group;
| 1,142
| 41.333333
| 71
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/group/Group.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.group;
import org.wildfly.clustering.Registrar;
/**
* Represents a groups of nodes.
*
* @author Paul Ferraro
*/
public interface Group extends Registrar<GroupListener> {
/**
* Returns the logical name of this group.
*
* @return the group name
*/
String getName();
/**
* Returns the local member.
*
* @return the local member
*/
Node getLocalMember();
/**
* Gets the current membership of this group
* @return the group membership
*/
Membership getMembership();
/**
* Indicates whether or not this is a singleton group. The membership of a singleton group contains only the local member and never changes.
* @return true, if this is a singleton group, false otherwise.
*/
boolean isSingleton();
}
| 1,863
| 30.59322
| 145
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/group/Node.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.group;
import java.net.InetSocketAddress;
/**
* Identifies a member of a cluster.
*
* @author Paul Ferraro
*/
public interface Node {
/**
* Returns the logical name of this node.
*
* @return a unique name
*/
String getName();
/**
* Returns the unique socking binding address of this node.
*
* @return a socket binding address, or null if this node is a member of a singleton group.
*/
InetSocketAddress getSocketAddress();
}
| 1,542
| 32.543478
| 95
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/group/GroupListener.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.group;
/**
* Listener for {@link Group} membership changes.
* @author Paul Ferraro
*/
public interface GroupListener {
/**
* Indicates that the membership of the group has changed.
*
* @param previousMembership previous group membership
* @param membership new group membership
* @param merged indicates whether the membership change is the result of a merge view
*/
void membershipChanged(Membership previousMembership, Membership membership, boolean merged);
}
| 1,560
| 39.025641
| 97
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/group/Membership.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.group;
import java.util.List;
/**
* Encapsulates an immutable membership of a group.
* @author Paul Ferraro
*/
public interface Membership {
/**
* Indicates whether or not the local node is the coordinator of this group membership.
* Semantically equivalent to:
* {@code group.getLocalNode().equals(#getCoordinator())}
*
* @return true, if we are the group membership coordinator, false otherwise
*/
boolean isCoordinator();
/**
* Returns the coordinator node of this group membership.
* All nodes of this membership will always agree on which node is the coordinator.
*
* @return the group coordinator node
*/
Node getCoordinator();
/**
* Returns the nodes that comprise this group membership.
* The membership order will be consistent on each node in the group.
*
* @return a list of nodes ordered by descending age.
*/
List<Node> getMembers();
}
| 2,015
| 34.368421
| 91
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/dispatcher/package-info.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.
*/
/**
* Public clustering API which facilitates remote command execution
* on the cluster.
*/
package org.wildfly.clustering.dispatcher;
| 1,162
| 40.535714
| 70
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/dispatcher/Command.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.dispatcher;
import java.io.Serializable;
/**
* A command to invoke remotely.
*
* @param <C> the command context type
* @param <R> the command return type
* @author Paul Ferraro
*/
public interface Command<R, C> extends Serializable {
/**
* Execute this command with the specified context.
*
* @param context the execution context
* @return the result of this command
* @throws Exception exception that occurred during execution
*/
R execute(C context) throws Exception;
}
| 1,573
| 34.772727
| 70
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/dispatcher/CommandDispatcher.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.dispatcher;
import java.util.Map;
import java.util.concurrent.CompletionStage;
import org.wildfly.clustering.group.Node;
/**
* Dispatches commands for execution on a group.
*
* @param <C> the command context type
* @author Paul Ferraro
*/
public interface CommandDispatcher<C> extends AutoCloseable {
/**
* Returns the context with which this dispatcher was created.
* @return a command execution context
*/
C getContext();
/**
* Executes the specified command on the specified group member.
* If the member has no corresponding dispatcher, the returned completion stage throws a {@link java.util.concurrent.CancellationException}.
*
* @param <R> the command execution return type
* @param command the command to execute
* @param member the group member on which to execute the command
* @return the future result of the command execution
* @throws CommandDispatcherException if the command could not be sent
*/
<R> CompletionStage<R> executeOnMember(Command<R, ? super C> command, Node member) throws CommandDispatcherException;
/**
* Executes the specified command on all members of the group, optionally excluding some members.
* If a given member has no corresponding dispatcher, its completion stage throws a {@link java.util.concurrent.CancellationException}.
*
* @param <R> the command execution return type
* @param command the command to execute
* @param excludedMembers the members to be excluded from group command execution
* @return a completion stage per member of the group on which the command was executed
* @throws CommandDispatcherException if the command could not be sent
*/
<R> Map<Node, CompletionStage<R>> executeOnGroup(Command<R, ? super C> command, Node... excludedMembers) throws CommandDispatcherException;
/**
* Closes any resources used by this dispatcher.
* Once closed, a dispatcher can no longer execute commands.
*/
@Override
void close();
}
| 3,099
| 40.891892
| 144
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/dispatcher/CommandDispatcherException.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2016, 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.wildfly.clustering.dispatcher;
/**
* Indicates a failure to dispatch a command.
* @author Paul Ferraro
*/
public class CommandDispatcherException extends Exception {
private static final long serialVersionUID = 3984965224844057380L;
/**
* Creates a new CommandDispatcherException using the specified cause.
* @param cause the cause of this exception.
*/
public CommandDispatcherException(Throwable cause) {
super(cause);
}
}
| 1,505
| 36.65
| 74
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/dispatcher/CommandDispatcherFactory.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.dispatcher;
import org.wildfly.clustering.group.Group;
/**
* Factory for creating a command dispatcher.
*
* @author Paul Ferraro
*/
public interface CommandDispatcherFactory {
/**
* Returns the group upon which the this command dispatcher operates.
*
* @return a group
*/
Group getGroup();
/**
* Creates a new command dispatcher using the specified identifier and context..
* The resulting {@link CommandDispatcher} will communicate with those dispatchers within the group sharing the same identifier.
*
* @param id a unique identifier for this dispatcher
* @param context the context used for executing commands
* @return a new command dispatcher
*/
<C> CommandDispatcher<C> createCommandDispatcher(Object id, C context);
}
| 1,863
| 36.28
| 132
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/registry/package-info.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.
*/
/**
* Public clustering API for clustered registry that stores a unique key/value pair per node.
*/
package org.wildfly.clustering.registry;
| 1,167
| 42.259259
| 93
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/registry/Registry.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.registry;
import java.util.Map;
import org.wildfly.clustering.Registrar;
import org.wildfly.clustering.group.Group;
import org.wildfly.clustering.group.Node;
/**
* Clustered registry abstraction that stores a unique key/value per node.
*
* @param <K> the type of the registry entry key
* @param <V> the type of the registry entry value
* @author Paul Ferraro
*/
public interface Registry<K, V> extends Registrar<RegistryListener<K, V>>, AutoCloseable {
/**
* Returns the group associated with this factory.
*
* @return a group
*/
Group getGroup();
/**
* Returns all registry entries in this group.
*
* @return a map for entries
*/
Map<K, V> getEntries();
/**
* Returns the registry entry for the specified node.
*
* @param node a node
* @return the node's registry entry, or null if undefined
*/
Map.Entry<K, V> getEntry(Node node);
/**
* Removes our entry from the registry.
* Once closed, the registry can no longer be accessed.
*/
@Override
void close();
}
| 2,144
| 30.086957
| 90
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/registry/RegistryListener.java
|
/*
* Copyright 2016 Red Hat, Inc.
*
* Licensed 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.wildfly.clustering.registry;
import java.util.Map;
/**
* Listener for added, updated and removed entries.
* @author Paul Ferraro
* @param <K> the registration key
* @param <V> the registration value
*/
public interface RegistryListener<K, V> {
/**
* Called when new entries have been added.
*
* @param added a map of entries that have been added
*/
void addedEntries(Map<K, V> added);
/**
* Called when existing entries have been updated.
*
* @param updated a map of entries that have been updated
*/
void updatedEntries(Map<K, V> updated);
/**
* Called when entries have been removed.
*
* @param removed a map of entries that have been removed
*/
void removedEntries(Map<K, V> removed);
}
| 1,391
| 27.408163
| 75
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/registry/RegistryFactory.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.registry;
import java.util.Map;
/**
* Factory for creating a clustered registry.
*
* @param <K> the type of the registry entry key
* @param <V> the type of the registry entry value
* @author Paul Ferraro
*/
public interface RegistryFactory<K, V> {
/**
* Creates a registry using the specified entry.
*
* @param entry the local registry entry
* @return a registry
*/
Registry<K, V> createRegistry(Map.Entry<K, V> entry);
}
| 1,518
| 34.325581
| 70
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/provider/package-info.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.
*/
/**
* Public clustering API for registering services on a group of nodes.
*/
package org.wildfly.clustering.provider;
| 1,144
| 41.407407
| 70
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/provider/ServiceProviderRegistration.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.provider;
import java.util.Set;
import org.wildfly.clustering.Registration;
import org.wildfly.clustering.group.Node;
/**
* Registration of a provided service.
*
* @author Paul Ferraro
* @param <T> a service type
*/
public interface ServiceProviderRegistration<T> extends Registration {
/**
* Listener for service provider changes.
*/
interface Listener {
/**
* Indicates that the set of nodes providing a given service has changed.
*
* @param nodes the new set of nodes providing the given service
*/
void providersChanged(Set<Node> nodes);
}
/**
* The provided service.
*
* @return a service identifier
*/
T getService();
/**
* Returns the set of nodes that can provide this service.
*
* @return a set of nodes
*/
Set<Node> getProviders();
}
| 1,939
| 29.793651
| 81
|
java
|
null |
wildfly-main/clustering/server/api/src/main/java/org/wildfly/clustering/provider/ServiceProviderRegistry.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, 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.wildfly.clustering.provider;
import java.util.Set;
import org.wildfly.clustering.Registrar;
import org.wildfly.clustering.group.Group;
import org.wildfly.clustering.group.Node;
/**
* A distributed registry of service providers.
* Allows capability to query which nodes can provide a given service.
* @author Paul Ferraro
* @param <T> a service type
*/
public interface ServiceProviderRegistry<T> extends Registrar<T> {
/**
* Returns the group with which to register service providers.
*
* @return a group
*/
Group getGroup();
/**
* Registers the local node as providing the specified service.
*
* @param service a service to register
* @return a new service provider registration
*/
@Override
ServiceProviderRegistration<T> register(T service);
/**
* Registers the local node as providing the specified service, using the specified listener.
*
* @param service a service to register
* @param listener a registry listener
* @return a new service provider registration
*/
ServiceProviderRegistration<T> register(T service, ServiceProviderRegistration.Listener listener);
/**
* Returns the set of nodes that can provide the specified service.
*
* @param service a service to obtain providers for
* @return a set of nodes
*/
Set<Node> getProviders(T service);
/**
* Returns the complete list of services known to this registry.
* @return a set of services
*/
Set<T> getServices();
}
| 2,587
| 32.179487
| 102
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/test/java/org/wildfly/clustering/server/infinispan/ServiceLoaderTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2015, 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.wildfly.clustering.server.infinispan;
import java.util.Formatter;
import java.util.ServiceLoader;
import org.infinispan.protostream.SerializationContextInitializer;
import org.jboss.logging.Logger;
import org.junit.Test;
import org.wildfly.clustering.marshalling.Externalizer;
import org.wildfly.clustering.marshalling.jboss.ClassTableContributor;
/**
* Validates loading of services.
* @author Paul Ferraro
*/
public class ServiceLoaderTestCase {
private static final Logger LOGGER = Logger.getLogger(ServiceLoaderTestCase.class);
@Test
public void load() {
load(Formatter.class);
load(Externalizer.class);
load(ClassTableContributor.class);
load(SerializationContextInitializer.class);
}
private static <T> void load(Class<T> targetClass) {
ServiceLoader.load(targetClass, ServiceLoaderTestCase.class.getClassLoader())
.forEach(object -> LOGGER.tracef("\t" + object.getClass().getName()));
}
}
| 2,020
| 36.425926
| 87
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/test/java/org/wildfly/clustering/server/infinispan/KeyMapperTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.server.infinispan;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import org.jgroups.util.UUID;
import org.junit.Test;
import org.wildfly.clustering.infinispan.persistence.KeyMapperTester;
import org.wildfly.clustering.server.infinispan.group.AddressableNode;
import org.wildfly.clustering.server.infinispan.group.LocalNode;
/**
* Unit test for {@link KeyMapper}.
* @author Paul Ferraro
*/
public class KeyMapperTestCase {
@Test
public void test() {
KeyMapperTester tester = new KeyMapperTester(new KeyMapper());
tester.test(new LocalNode("node"));
tester.test(new AddressableNode(UUID.randomUUID(), "node", new InetSocketAddress(InetAddress.getLoopbackAddress(), Short.MAX_VALUE)));
}
}
| 1,803
| 37.382979
| 142
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/test/java/org/wildfly/clustering/server/infinispan/group/JGroupsAddressSerializerTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2020, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import org.infinispan.remoting.transport.jgroups.JGroupsAddress;
import org.jgroups.util.UUID;
import org.junit.Test;
import org.wildfly.clustering.marshalling.ExternalizerTester;
import org.wildfly.clustering.marshalling.spi.FormatterTester;
import org.wildfly.clustering.server.infinispan.group.JGroupsAddressSerializer.JGroupsAddressExternalizer;
import org.wildfly.clustering.server.infinispan.group.JGroupsAddressSerializer.JGroupsAddressFormatter;
/**
* @author Paul Ferraro
*/
public class JGroupsAddressSerializerTestCase {
@Test
public void test() throws IOException {
JGroupsAddress address = new JGroupsAddress(UUID.randomUUID());
new ExternalizerTester<>(new JGroupsAddressExternalizer()).test(address);
new FormatterTester<>(new JGroupsAddressFormatter()).test(address);
}
}
| 1,939
| 39.416667
| 106
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/test/java/org/wildfly/clustering/server/infinispan/group/LocalAddressSerializerTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import org.infinispan.remoting.transport.Address;
import org.infinispan.remoting.transport.LocalModeAddress;
import org.junit.Test;
import org.wildfly.clustering.marshalling.ExternalizerTester;
import org.wildfly.clustering.marshalling.Tester;
import org.wildfly.clustering.marshalling.jboss.JBossMarshallingTesterFactory;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamTesterFactory;
import org.wildfly.clustering.marshalling.spi.FormatterTester;
import org.wildfly.clustering.server.infinispan.group.LocalAddressSerializer.LocalAddressExternalizer;
import org.wildfly.clustering.server.infinispan.group.LocalAddressSerializer.LocalAddressFormatter;
/**
* @author Paul Ferraro
*/
public class LocalAddressSerializerTestCase {
@Test
public void test() throws IOException {
test(new ExternalizerTester<>(new LocalAddressExternalizer()));
test(new FormatterTester<>(new LocalAddressFormatter()));
test(JBossMarshallingTesterFactory.INSTANCE.createTester());
test(ProtoStreamTesterFactory.INSTANCE.createTester());
}
static void test(Tester<Address> tester) throws IOException {
tester.test(LocalModeAddress.INSTANCE);
}
}
| 2,313
| 41.072727
| 102
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/test/java/org/wildfly/clustering/server/infinispan/group/LocalNodeFormatterTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import org.junit.Test;
import org.wildfly.clustering.marshalling.ExternalizerTester;
import org.wildfly.clustering.marshalling.Tester;
import org.wildfly.clustering.marshalling.jboss.JBossMarshallingTesterFactory;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamTesterFactory;
import org.wildfly.clustering.marshalling.spi.FormatterTester;
import org.wildfly.clustering.server.infinispan.group.LocalNodeFormatter.LocalNodeExternalizer;
/**
* Unit test for {@link LocalNodeFormatter}.
* @author Paul Ferraro
*/
public class LocalNodeFormatterTestCase {
private final LocalNode localNode = new LocalNode("name");
@Test
public void test() throws IOException {
this.test(new ExternalizerTester<>(new LocalNodeExternalizer()));
this.test(new FormatterTester<>(new LocalNodeFormatter()));
this.test(JBossMarshallingTesterFactory.INSTANCE.createTester());
this.test(ProtoStreamTesterFactory.INSTANCE.createTester());
}
private void test(Tester<LocalNode> tester) throws IOException {
tester.test(this.localNode);
}
}
| 2,207
| 39.888889
| 95
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/test/java/org/wildfly/clustering/server/infinispan/group/AddressableNodeSerializerTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import org.jgroups.util.UUID;
import org.junit.Assert;
import org.junit.Test;
import org.wildfly.clustering.marshalling.ExternalizerTester;
import org.wildfly.clustering.marshalling.Tester;
import org.wildfly.clustering.marshalling.jboss.JBossMarshallingTesterFactory;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamTesterFactory;
import org.wildfly.clustering.marshalling.spi.FormatterTester;
import org.wildfly.clustering.server.infinispan.group.AddressableNodeSerializer.AddressableNodeExternalizer;
import org.wildfly.clustering.server.infinispan.group.AddressableNodeSerializer.AddressableNodeFormatter;
/**
* Unit tests for {@link AddressableNodeSerializer}.
* @author Paul Ferraro
*/
public class AddressableNodeSerializerTestCase {
private final AddressableNode node = new AddressableNode(UUID.randomUUID(), "foo", new InetSocketAddress(InetAddress.getLoopbackAddress(), Short.MAX_VALUE));
@Test
public void test() throws IOException {
this.test(new ExternalizerTester<>(new AddressableNodeExternalizer()));
this.test(new FormatterTester<>(new AddressableNodeFormatter()));
this.test(JBossMarshallingTesterFactory.INSTANCE.createTester());
this.test(ProtoStreamTesterFactory.INSTANCE.createTester());
}
public void test(Tester<AddressableNode> tester) throws IOException {
tester.test(this.node, AddressableNodeSerializerTestCase::assertEquals);
}
static void assertEquals(AddressableNode expected, AddressableNode actual) {
Assert.assertEquals(expected.getAddress(), actual.getAddress());
Assert.assertEquals(expected.getName(), actual.getName());
Assert.assertEquals(expected.getSocketAddress(), actual.getSocketAddress());
}
}
| 2,934
| 43.469697
| 161
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/test/java/org/wildfly/clustering/server/infinispan/group/AddressSerializerTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
import org.jgroups.util.UUID;
import org.junit.Test;
import org.wildfly.clustering.marshalling.ExternalizerTesterFactory;
import org.wildfly.clustering.marshalling.Tester;
import org.wildfly.clustering.marshalling.jboss.JBossMarshallingTesterFactory;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamTesterFactory;
import org.wildfly.clustering.server.infinispan.group.AddressSerializer.IpAddressExternalizer;
import org.wildfly.clustering.server.infinispan.group.AddressSerializer.UUIDExternalizer;
/**
* @author Paul Ferraro
*/
public class AddressSerializerTestCase {
@Test
public void test() throws IOException {
test(new ExternalizerTesterFactory(new UUIDExternalizer(), new IpAddressExternalizer()).createTester());
test(JBossMarshallingTesterFactory.INSTANCE.createTester());
test(ProtoStreamTesterFactory.INSTANCE.createTester());
}
private static void test(Tester<Address> tester) throws IOException {
UUID uuid = UUID.randomUUID();
InetSocketAddress address = new InetSocketAddress(InetAddress.getLoopbackAddress(), Short.MAX_VALUE);
IpAddress ipAddress = new IpAddress(address);
tester.test(uuid);
tester.test(ipAddress);
}
}
| 2,481
| 39.688525
| 112
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/test/java/org/wildfly/clustering/server/infinispan/provider/AddressSetFunctionMarshallerTestCase.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan.provider;
import java.io.IOException;
import java.util.Set;
import org.infinispan.remoting.transport.Address;
import org.infinispan.remoting.transport.LocalModeAddress;
import org.junit.Assert;
import org.junit.Test;
import org.wildfly.clustering.ee.cache.function.CollectionFunction;
import org.wildfly.clustering.ee.cache.function.SetAddFunction;
import org.wildfly.clustering.ee.cache.function.SetRemoveFunction;
import org.wildfly.clustering.marshalling.Tester;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamTesterFactory;
/**
* @author Paul Ferraro
*/
public class AddressSetFunctionMarshallerTestCase {
@Test
public void testSetAddFunction() throws IOException {
Tester<SetAddFunction<Address>> tester = ProtoStreamTesterFactory.INSTANCE.createTester();
tester.test(new ConcurrentAddressSetAddFunction(LocalModeAddress.INSTANCE), AddressSetFunctionMarshallerTestCase::assertEquals);
tester.test(new CopyOnWriteAddressSetAddFunction(LocalModeAddress.INSTANCE), AddressSetFunctionMarshallerTestCase::assertEquals);
}
@Test
public void testSetRemoveFunction() throws IOException {
Tester<SetRemoveFunction<Address>> tester = ProtoStreamTesterFactory.INSTANCE.createTester();
tester.test(new ConcurrentAddressSetRemoveFunction(LocalModeAddress.INSTANCE), AddressSetFunctionMarshallerTestCase::assertEquals);
tester.test(new CopyOnWriteAddressSetRemoveFunction(LocalModeAddress.INSTANCE), AddressSetFunctionMarshallerTestCase::assertEquals);
}
private static <V> void assertEquals(CollectionFunction<V, Set<V>> function1, CollectionFunction<V, Set<V>> function2) {
Assert.assertEquals(function1.getOperand(), function2.getOperand());
}
}
| 2,827
| 45.360656
| 140
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/ClusteringServerLogger.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, 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.wildfly.clustering.server.infinispan;
import static org.jboss.logging.Logger.Level.WARN;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.infinispan.notifications.cachelistener.event.Event;
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
import org.wildfly.clustering.group.Node;
/**
* @author Paul Ferraro
*/
@MessageLogger(projectCode = "WFLYCLSV", length = 4)
public interface ClusteringServerLogger extends BasicLogger {
String ROOT_LOGGER_CATEGORY = "org.wildfly.clustering.server.infinispan";
/**
* The root logger.
*/
ClusteringServerLogger ROOT_LOGGER = Logger.getMessageLogger(ClusteringServerLogger.class, ROOT_LOGGER_CATEGORY);
/* Command dispatcher messages */
@Message(id = 1, value = "A command dispatcher already exists for %s")
IllegalArgumentException commandDispatcherAlreadyExists(Object id);
/* Group messages */
/* Registry messages */
@LogMessage(level = WARN)
@Message(id = 20, value = "Failed to purge %s/%s registry of old registry entries for: %s")
void registryPurgeFailed(@Cause Throwable e, String containerName, String cacheName, Collection<?> members);
@LogMessage(level = WARN)
@Message(id = 21, value = "Failed to notify %s/%s registry listener of %s(%s) event")
void registryListenerFailed(@Cause Throwable e, String containerName, String cacheName, Event.Type type, Map<?, ?> entries);
@LogMessage(level = WARN)
@Message(id = 22, value = "Failed to restore local %s/%s registry entry following network partititon merge")
void failedToRestoreLocalRegistryEntry(@Cause Throwable cause, String containerName, String cacheName);
/* Service provider registry messages */
@LogMessage(level = WARN)
@Message(id = 30, value = "Failed to notify %s/%s service provider registration listener of new providers: %s")
void serviceProviderRegistrationListenerFailed(@Cause Throwable e, String containerName, String cacheName, Set<Node> providers);
}
| 3,264
| 40.858974
| 132
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/ServerSerializationContextInitializer.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan;
import org.infinispan.protostream.SerializationContextInitializer;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.marshalling.protostream.CompositeSerializationContextInitializer;
/**
* {@SerializationContextInitializer} service for this module.
* @author Paul Ferraro
*/
@MetaInfServices(SerializationContextInitializer.class)
public class ServerSerializationContextInitializer extends CompositeSerializationContextInitializer {
public ServerSerializationContextInitializer() {
super(ServerSerializationContextInitializerProvider.class);
}
}
| 1,658
| 40.475
| 101
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/KeyMapper.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.server.infinispan;
import org.infinispan.persistence.keymappers.TwoWayKey2StringMapper;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.infinispan.persistence.DynamicKeyFormatMapper;
/**
* @author Paul Ferraro
*/
@MetaInfServices(TwoWayKey2StringMapper.class)
public class KeyMapper extends DynamicKeyFormatMapper {
public KeyMapper() {
super(KeyMapper.class.getClassLoader());
}
}
| 1,476
| 36.871795
| 76
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/ServerSerializationContextInitializerProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan;
import org.infinispan.protostream.SerializationContextInitializer;
import org.wildfly.clustering.marshalling.protostream.ProviderSerializationContextInitializer;
import org.wildfly.clustering.marshalling.protostream.SerializationContextInitializerProvider;
import org.wildfly.clustering.server.infinispan.dispatcher.CommandDispatcherSerializationContextInitializer;
import org.wildfly.clustering.server.infinispan.group.GroupSerializationContextInitializer;
import org.wildfly.clustering.server.infinispan.group.InfinispanJGroupsTransportMarshallerProvider;
import org.wildfly.clustering.server.infinispan.group.InfinispanTransportMarshallerProvider;
import org.wildfly.clustering.server.infinispan.group.JGroupsStackMarshallerProvider;
import org.wildfly.clustering.server.infinispan.group.JGroupsUtilMarshallerProvider;
import org.wildfly.clustering.server.infinispan.provider.ServiceProviderRegistrySerializationContextInitializer;
/**
* Provider of the {@link SerializationContextInitializer} instances for this module.
* @author Paul Ferraro
*/
public enum ServerSerializationContextInitializerProvider implements SerializationContextInitializerProvider {
COMMAND_DISPATCHER(new CommandDispatcherSerializationContextInitializer()),
JGROUPS_UTIL(new ProviderSerializationContextInitializer<>("org.jgroups.util.proto", JGroupsUtilMarshallerProvider.class)),
JGROUPS_STACK(new ProviderSerializationContextInitializer<>("org.jgroups.stack.proto", JGroupsStackMarshallerProvider.class)),
INFINISPAN_TRANSPORT(new ProviderSerializationContextInitializer<>("org.infinispan.remoting.transport.proto", InfinispanTransportMarshallerProvider.class)),
INFINISPAN_JGROUPS_TRANSPORT(new ProviderSerializationContextInitializer<>("org.infinispan.remoting.transport.jgroups.proto", InfinispanJGroupsTransportMarshallerProvider.class)),
GROUP(new GroupSerializationContextInitializer()),
PROVIDER(new ServiceProviderRegistrySerializationContextInitializer()),
;
private final SerializationContextInitializer initializer;
ServerSerializationContextInitializerProvider(SerializationContextInitializer initializer) {
this.initializer = initializer;
}
@Override
public SerializationContextInitializer getInitializer() {
return this.initializer;
}
}
| 3,386
| 55.45
| 183
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/InfinispanJGroupsTransportMarshallerProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan.group;
import org.infinispan.remoting.transport.jgroups.JGroupsAddress;
import org.jgroups.Address;
import org.wildfly.clustering.marshalling.protostream.FunctionalMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamMarshallerProvider;
import org.wildfly.clustering.marshalling.protostream.SimpleFieldSetMarshaller;
/**
* Provider of marshallers for the org.infinispan.remoting.transport.jgroups package.
* @author Paul Ferraro
*/
public enum InfinispanJGroupsTransportMarshallerProvider implements ProtoStreamMarshallerProvider {
JGROUPS_ADDRESS(new FunctionalMarshaller<>(JGroupsAddress.class, new SimpleFieldSetMarshaller<>(Address.class, AddressMarshaller.INSTANCE), JGroupsAddress::getJGroupsAddress, JGroupsAddress::new)),
;
private final ProtoStreamMarshaller<?> marshaller;
InfinispanJGroupsTransportMarshallerProvider(ProtoStreamMarshaller<?> marshaller) {
this.marshaller = marshaller;
}
@Override
public ProtoStreamMarshaller<?> getMarshaller() {
return this.marshaller;
}
}
| 2,216
| 43.34
| 201
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/InfinispanAddressResolver.java
|
package org.wildfly.clustering.server.infinispan.group;
import java.util.function.Function;
import org.infinispan.remoting.transport.Address;
import org.infinispan.remoting.transport.jgroups.JGroupsAddressCache;
import org.wildfly.clustering.group.Node;
/**
* Resolves the Infinispan {@link Address} of a {@link Node}.
* @author Paul Ferraro
*/
public enum InfinispanAddressResolver implements Function<Node, Address> {
INSTANCE;
@Override
public Address apply(Node node) {
return JGroupsAddressCache.fromJGroupsAddress(JGroupsAddressResolver.INSTANCE.apply(node));
}
}
| 601
| 27.666667
| 99
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/JGroupsAddressSerializer.java
|
/*
* 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.wildfly.clustering.server.infinispan.group;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.infinispan.remoting.transport.jgroups.JGroupsAddress;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.marshalling.Externalizer;
import org.wildfly.clustering.marshalling.spi.BinaryFormatter;
import org.wildfly.clustering.marshalling.spi.Formatter;
import org.wildfly.clustering.marshalling.spi.Serializer;
import org.wildfly.clustering.marshalling.spi.SerializerExternalizer;
/**
* Serializer for an Infinispan JGroups-based address.
* @author Paul Ferraro
*/
public enum JGroupsAddressSerializer implements Serializer<JGroupsAddress> {
INSTANCE;
@Override
public void write(DataOutput output, JGroupsAddress address) throws IOException {
AddressSerializer.INSTANCE.write(output, address.getJGroupsAddress());
}
@Override
public JGroupsAddress read(DataInput input) throws IOException {
return new JGroupsAddress(AddressSerializer.INSTANCE.read(input));
}
@MetaInfServices(Externalizer.class)
public static class JGroupsAddressExternalizer extends SerializerExternalizer<JGroupsAddress> {
public JGroupsAddressExternalizer() {
super(JGroupsAddress.class, INSTANCE);
}
}
@MetaInfServices(Formatter.class)
public static class JGroupsAddressFormatter extends BinaryFormatter<JGroupsAddress> {
public JGroupsAddressFormatter() {
super(JGroupsAddress.class, INSTANCE);
}
}
}
| 2,594
| 37.161765
| 99
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/AddressableNode.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import java.io.Serializable;
import java.net.InetSocketAddress;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
import org.wildfly.clustering.group.Node;
/**
* Node implementation that associates a JGroups {@link Address} with its logical name
* and transport socket binding.
* @author Paul Ferraro
*/
public class AddressableNode implements Node, Addressable, Comparable<AddressableNode>, Serializable {
private static final long serialVersionUID = -7707210981640344598L;
private transient Address address;
private final String name;
private final InetSocketAddress socketAddress;
public AddressableNode(IpAddress address, String name) {
this(address, name, new InetSocketAddress(address.getIpAddress(), address.getPort()));
}
public AddressableNode(Address address, String name, InetSocketAddress socketAddress) {
this.address = address;
this.name = name;
this.socketAddress = socketAddress;
}
@Override
public Address getAddress() {
return this.address;
}
@Override
public int hashCode() {
return this.address.hashCode();
}
@Override
public int compareTo(AddressableNode node) {
return this.address.compareTo(node.getAddress());
}
@Override
public boolean equals(Object object) {
return (object instanceof AddressableNode) ? this.address.equals(((AddressableNode) object).address) : false;
}
@Override
public String toString() {
return this.address.toString();
}
@Override
public String getName() {
return this.name;
}
@Override
public InetSocketAddress getSocketAddress() {
return this.socketAddress;
}
private void writeObject(java.io.ObjectOutputStream output) throws IOException {
output.defaultWriteObject();
AddressSerializer.INSTANCE.write(output, this.address);
}
private void readObject(java.io.ObjectInputStream input) throws IOException, ClassNotFoundException {
input.defaultReadObject();
this.address = AddressSerializer.INSTANCE.read(input);
}
}
| 3,257
| 31.909091
| 117
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/Addressable.java
|
package org.wildfly.clustering.server.infinispan.group;
import org.jgroups.Address;
/**
* A object that is identified by a JGroups {@link Address}.
* @author Paul Ferraro
*/
public interface Addressable {
Address getAddress();
}
| 238
| 18.916667
| 60
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/LocalNode.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, 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.wildfly.clustering.server.infinispan.group;
import java.net.InetSocketAddress;
import org.wildfly.clustering.group.Node;
/**
* Non-clustered {@link Node} implementation.
* @author Paul Ferraro
*/
public class LocalNode implements Node, Comparable<LocalNode> {
private final String name;
public LocalNode(String name) {
this.name = name;
}
@Override
public String getName() {
return this.name;
}
@Override
public InetSocketAddress getSocketAddress() {
return null;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof LocalNode)) return false;
LocalNode node = (LocalNode) object;
return this.name.equals(node.name);
}
@Override
public int hashCode() {
return this.name.hashCode();
}
@Override
public String toString() {
return this.name;
}
@Override
public int compareTo(LocalNode node) {
return this.name.compareTo(node.name);
}
}
| 2,059
| 27.611111
| 70
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/CacheMembership.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.server.infinispan.group;
import java.util.ArrayList;
import java.util.List;
import org.infinispan.distribution.ch.ConsistentHash;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.remoting.transport.Address;
import org.infinispan.topology.CacheTopology;
import org.wildfly.clustering.group.Membership;
import org.wildfly.clustering.group.Node;
import org.wildfly.clustering.server.NodeFactory;
/**
* @author Paul Ferraro
*/
public class CacheMembership implements Membership {
private final Address localAddress;
private final List<Address> addresses;
private final NodeFactory<Address> factory;
public CacheMembership(Address localAddress, CacheTopology topology, NodeFactory<Address> factory) {
this(localAddress, topology.getActualMembers(), factory);
}
public CacheMembership(Address localAddress, ConsistentHash hash, NodeFactory<Address> factory) {
this(localAddress, hash.getMembers(), factory);
}
public CacheMembership(EmbeddedCacheManager manager, NodeFactory<Address> factory) {
this(manager.getAddress(), manager.getMembers(), factory);
}
public CacheMembership(Address localAddress, List<Address> addresses, NodeFactory<Address> factory) {
this.localAddress = localAddress;
this.addresses = addresses;
this.factory = factory;
}
@Override
public boolean isCoordinator() {
return this.localAddress.equals(this.getCoordinatorAddress());
}
@Override
public Node getCoordinator() {
return this.factory.createNode(this.getCoordinatorAddress());
}
private Address getCoordinatorAddress() {
return this.addresses.get(0);
}
@Override
public List<Node> getMembers() {
List<Node> members = new ArrayList<>(this.addresses.size());
for (Address address : this.addresses) {
Node member = this.factory.createNode(address);
if (member != null) {
members.add(member);
}
}
return members;
}
}
| 3,125
| 34.123596
| 105
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/AddressableNodeMarshaller.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import java.net.InetSocketAddress;
import org.infinispan.protostream.descriptors.WireType;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamReader;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamWriter;
/**
* @author Paul Ferraro
*/
public class AddressableNodeMarshaller implements ProtoStreamMarshaller<AddressableNode> {
private static final int ADDRESS_INDEX = 1;
private static final int NAME_INDEX = ADDRESS_INDEX + AddressMarshaller.INSTANCE.getFields();
private static final int SOCKET_ADDRESS_INDEX = NAME_INDEX + 1;
@Override
public AddressableNode readFrom(ProtoStreamReader reader) throws IOException {
Address address = null;
String name = null;
InetSocketAddress socketAddress = null;
while (!reader.isAtEnd()) {
int tag = reader.readTag();
int index = WireType.getTagFieldNumber(tag);
if (index >= ADDRESS_INDEX && index < NAME_INDEX) {
address = AddressMarshaller.INSTANCE.readField(reader, index - ADDRESS_INDEX, address);
} else if (index == NAME_INDEX) {
name = reader.readString();
} else if (index == SOCKET_ADDRESS_INDEX) {
IpAddress ipAddress = reader.readObject(IpAddress.class);
socketAddress = new InetSocketAddress(ipAddress.getIpAddress(), ipAddress.getPort());
} else {
reader.skipField(tag);
}
}
return (address instanceof IpAddress) ? new AddressableNode((IpAddress) address, name) : new AddressableNode(address, name, socketAddress);
}
@Override
public void writeTo(ProtoStreamWriter writer, AddressableNode member) throws IOException {
Address address = member.getAddress();
AddressMarshaller.INSTANCE.writeFields(writer, ADDRESS_INDEX, address);
writer.writeString(NAME_INDEX, member.getName());
if (!(address instanceof IpAddress)) {
writer.writeObject(SOCKET_ADDRESS_INDEX, new IpAddress(member.getSocketAddress()));
}
}
@Override
public Class<? extends AddressableNode> getJavaClass() {
return AddressableNode.class;
}
}
| 3,470
| 41.851852
| 147
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/AddressableNodeSerializer.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.server.infinispan.group;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
import org.kohsuke.MetaInfServices;
import org.wildfly.clustering.marshalling.Externalizer;
import org.wildfly.clustering.marshalling.spi.Serializer;
import org.wildfly.clustering.marshalling.spi.BinaryFormatter;
import org.wildfly.clustering.marshalling.spi.IndexSerializer;
import org.wildfly.clustering.marshalling.spi.Formatter;
import org.wildfly.clustering.marshalling.spi.SerializerExternalizer;
/**
* Marshalling externalizer for an {@link AddressableNode}.
* @author Paul Ferraro
*/
public enum AddressableNodeSerializer implements Serializer<AddressableNode> {
INSTANCE;
@Override
public void write(DataOutput output, AddressableNode node) throws IOException {
AddressSerializer.INSTANCE.write(output, node.getAddress());
output.writeUTF(node.getName());
if (!(node.getAddress() instanceof IpAddress)) {
InetSocketAddress socketAddress = node.getSocketAddress();
// Socket address will always contain a resolved address
byte[] address = socketAddress.getAddress().getAddress();
IndexSerializer.UNSIGNED_BYTE.writeInt(output, address.length);
output.write(address);
IndexSerializer.UNSIGNED_SHORT.writeInt(output, socketAddress.getPort());
}
}
@Override
public AddressableNode read(DataInput input) throws IOException {
Address jgroupsAddress = AddressSerializer.INSTANCE.read(input);
String name = input.readUTF();
if (jgroupsAddress instanceof IpAddress) {
return new AddressableNode((IpAddress) jgroupsAddress, name);
}
byte[] address = new byte[IndexSerializer.UNSIGNED_BYTE.readInt(input)];
input.readFully(address);
int port = IndexSerializer.UNSIGNED_SHORT.readInt(input);
return new AddressableNode(jgroupsAddress, name, new InetSocketAddress(InetAddress.getByAddress(address), port));
}
@MetaInfServices(Externalizer.class)
public static class AddressableNodeExternalizer extends SerializerExternalizer<AddressableNode> {
public AddressableNodeExternalizer() {
super(AddressableNode.class, INSTANCE);
}
}
@MetaInfServices(Formatter.class)
public static class AddressableNodeFormatter extends BinaryFormatter<AddressableNode> {
public AddressableNodeFormatter() {
super(AddressableNode.class, INSTANCE);
}
}
}
| 3,713
| 41.204545
| 121
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/LocalGroup.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2018, 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.wildfly.clustering.server.infinispan.group;
import org.wildfly.clustering.Registration;
import org.wildfly.clustering.group.GroupListener;
import org.wildfly.clustering.group.Membership;
import org.wildfly.clustering.group.Node;
/**
* Non-clustered group implementation.
* Registered {@link GroupListener} are never invoked, as membership of a local group is fixed.
* @author Paul Ferraro
*/
public class LocalGroup implements AutoCloseableGroup<Object>, Registration {
private final Membership membership;
private final String name;
public LocalGroup(String nodeName, String groupName) {
this.membership = new SingletonMembership(new LocalNode(nodeName));
this.name = groupName;
}
@Override
public void close() {
// We never registered anything
}
@Override
public Registration register(GroupListener listener) {
// Nothing to register
return this;
}
@Override
public String getName() {
return this.name;
}
@Override
public Node getLocalMember() {
return this.membership.getCoordinator();
}
@Override
public Membership getMembership() {
return this.membership;
}
@Override
public boolean isSingleton() {
return true;
}
@Override
public Node createNode(Object ignored) {
return this.getLocalMember();
}
}
| 2,435
| 29.074074
| 95
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/JGroupsAddressResolver.java
|
package org.wildfly.clustering.server.infinispan.group;
import java.util.function.Function;
import org.jgroups.Address;
import org.wildfly.clustering.group.Node;
/**
* Resolves the JGroups {@link Address} of a {@link Node}.
* @author Paul Ferraro
*/
public enum JGroupsAddressResolver implements Function<Node, Address> {
INSTANCE;
@Override
public Address apply(Node node) {
if (!(node instanceof Addressable)) {
throw new IllegalArgumentException(node.toString());
}
return ((Addressable) node).getAddress();
}
}
| 574
| 24
| 71
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/AutoCloseableGroup.java
|
package org.wildfly.clustering.server.infinispan.group;
import org.wildfly.clustering.server.group.Group;
/**
* A {@link Group} with a specific lifecycle (i.e. that must be closed).
* @author Paul Ferraro
* @param <A> the address type
*/
public interface AutoCloseableGroup<A> extends Group<A>, AutoCloseable {
@Override
void close();
}
| 351
| 24.142857
| 72
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/CacheGroupConfiguration.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, 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.wildfly.clustering.server.infinispan.group;
import org.jgroups.Address;
import org.wildfly.clustering.ee.infinispan.InfinispanConfiguration;
import org.wildfly.clustering.server.NodeFactory;
/**
* Configuration for a {@link CacheGroup}.
* @author Paul Ferraro
*/
public interface CacheGroupConfiguration extends InfinispanConfiguration {
NodeFactory<Address> getMemberFactory();
}
| 1,425
| 39.742857
| 74
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/GroupSerializationContextInitializer.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2020, 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.wildfly.clustering.server.infinispan.group;
import org.infinispan.protostream.SerializationContext;
import org.wildfly.clustering.marshalling.protostream.AbstractSerializationContextInitializer;
import org.wildfly.clustering.marshalling.protostream.FunctionalScalarMarshaller;
import org.wildfly.clustering.marshalling.protostream.Scalar;
/**
* {@link org.infinispan.protostream.SerializationContextInitializer} for this package.
* @author Paul Ferraro
*/
public class GroupSerializationContextInitializer extends AbstractSerializationContextInitializer {
@Override
public void registerMarshallers(SerializationContext context) {
context.registerMarshaller(new AddressableNodeMarshaller());
context.registerMarshaller(new FunctionalScalarMarshaller<>(LocalNode.class, Scalar.STRING.cast(String.class), LocalNode::getName, LocalNode::new));
}
}
| 1,914
| 44.595238
| 156
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/AddressMarshaller.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
import org.jgroups.util.UUID;
import org.wildfly.clustering.marshalling.protostream.FieldSetMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamReader;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamWriter;
/**
* Marshallers for the fields of an {@link Address}.
* @author Paul Ferraro
*/
public enum AddressMarshaller implements FieldSetMarshaller<Address, Address> {
INSTANCE;
private static final int UUID_ADDRESS_INDEX = 0;
private static final int IP_ADDRESS_INDEX = 1;
private static final int FIELDS = 3;
@Override
public Address getBuilder() {
return null;
}
@Override
public int getFields() {
return FIELDS;
}
@Override
public Address readField(ProtoStreamReader reader, int index, Address address) throws IOException {
switch (index) {
case UUID_ADDRESS_INDEX:
return reader.readObject(UUID.class);
case IP_ADDRESS_INDEX:
return reader.readObject(IpAddress.class);
default:
return address;
}
}
@Override
public void writeFields(ProtoStreamWriter writer, int startIndex, Address address) throws IOException {
if (address instanceof IpAddress) {
writer.writeObject(startIndex + IP_ADDRESS_INDEX, address);
} else {
writer.writeObject(startIndex + UUID_ADDRESS_INDEX, address);
}
}
}
| 2,645
| 33.815789
| 107
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/SingletonMembership.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017, 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.wildfly.clustering.server.infinispan.group;
import java.util.Collections;
import java.util.List;
import org.wildfly.clustering.group.Membership;
import org.wildfly.clustering.group.Node;
/**
* A membership that only ever contains a single member.
* @author Paul Ferraro
*/
public class SingletonMembership implements Membership {
private final Node member;
public SingletonMembership(Node member) {
this.member = member;
}
@Override
public boolean isCoordinator() {
return true;
}
@Override
public Node getCoordinator() {
return this.member;
}
@Override
public List<Node> getMembers() {
return Collections.singletonList(this.member);
}
@Override
public int hashCode() {
return this.member.hashCode();
}
@Override
public boolean equals(Object object) {
if (!(object instanceof SingletonMembership)) return false;
SingletonMembership membership = (SingletonMembership) object;
return this.member.equals(membership.member);
}
@Override
public String toString() {
return this.member.toString();
}
}
| 2,201
| 28.36
| 70
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/IpAddressMarshaller.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import org.jgroups.stack.IpAddress;
import org.wildfly.clustering.marshalling.protostream.FieldSetMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamReader;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamWriter;
/**
* Marshaller for fields of a {@link IpAddress}.
* @author Paul Ferraro
*/
public enum IpAddressMarshaller implements FieldSetMarshaller<IpAddress, IpAddressBuilder> {
INSTANCE;
static final InetAddress DEFAULT_ADDRESS = InetAddress.getLoopbackAddress();
private static final int DEFAULT_PORT = 7600; // Default TCP port
private static final int ADDRESS_INDEX = 0;
private static final int PORT_INDEX = 1;
private static final int FIELDS = 2;
@Override
public IpAddressBuilder getBuilder() {
return new DefaultIpAddressBuilder();
}
@Override
public int getFields() {
return FIELDS;
}
@Override
public IpAddressBuilder readField(ProtoStreamReader reader, int index, IpAddressBuilder builder) throws IOException {
switch (index) {
case ADDRESS_INDEX:
return builder.setAddress(reader.readByteArray());
case PORT_INDEX:
return builder.setPort(reader.readUInt32());
default:
return builder;
}
}
@Override
public void writeFields(ProtoStreamWriter writer, int startIndex, IpAddress address) throws IOException {
byte[] bytes = address.getIpAddress().getAddress();
if (!Arrays.equals(bytes, DEFAULT_ADDRESS.getAddress())) {
writer.writeBytes(startIndex + ADDRESS_INDEX, bytes);
}
int port = address.getPort();
if (port != DEFAULT_PORT) {
writer.writeUInt32(startIndex + PORT_INDEX, port);
}
}
static class DefaultIpAddressBuilder implements IpAddressBuilder {
private InetAddress address = DEFAULT_ADDRESS;
private int port = DEFAULT_PORT;
@Override
public IpAddressBuilder setAddress(byte[] address) throws UnknownHostException {
this.address = InetAddress.getByAddress(address);
return this;
}
@Override
public IpAddressBuilder setPort(int port) {
this.port = port;
return this;
}
@Override
public IpAddress build() {
return new IpAddress(this.address, this.port);
}
}
}
| 3,658
| 33.847619
| 121
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/JGroupsUtilMarshallerProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan.group;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamMarshallerProvider;
/**
* Provider of marshallers for the org.jgroups.util package.
* @author Paul Ferraro
*/
public enum JGroupsUtilMarshallerProvider implements ProtoStreamMarshallerProvider {
UUID(new UUIDMarshaller()),
;
private final ProtoStreamMarshaller<?> marshaller;
JGroupsUtilMarshallerProvider(ProtoStreamMarshaller<?> marshaller) {
this.marshaller = marshaller;
}
@Override
public ProtoStreamMarshaller<?> getMarshaller() {
return this.marshaller;
}
}
| 1,743
| 36.106383
| 84
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/JGroupsStackMarshallerProvider.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan.group;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamBuilderFieldSetMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamMarshallerProvider;
/**
* Provider of marshallers for the org.jgroups.stack package.
* @author Paul Ferraro
*/
public enum JGroupsStackMarshallerProvider implements ProtoStreamMarshallerProvider {
IP_ADDRESS(new ProtoStreamBuilderFieldSetMarshaller<>(IpAddressMarshaller.INSTANCE)),
;
private final ProtoStreamMarshaller<?> marshaller;
JGroupsStackMarshallerProvider(ProtoStreamMarshaller<?> marshaller) {
this.marshaller = marshaller;
}
@Override
public ProtoStreamMarshaller<?> getMarshaller() {
return this.marshaller;
}
}
| 1,895
| 39.340426
| 91
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/IpAddressBuilder.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import org.jgroups.stack.IpAddress;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamBuilder;
/**
* @author Paul Ferraro
*/
public interface IpAddressBuilder extends ProtoStreamBuilder<IpAddress> {
IpAddressBuilder setAddress(byte[] address) throws IOException;
IpAddressBuilder setPort(int port);
}
| 1,439
| 35.923077
| 73
|
java
|
null |
wildfly-main/clustering/server/infinispan/src/main/java/org/wildfly/clustering/server/infinispan/group/InfinispanAddressMarshaller.java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2021, 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.wildfly.clustering.server.infinispan.group;
import java.io.IOException;
import org.infinispan.remoting.transport.Address;
import org.infinispan.remoting.transport.LocalModeAddress;
import org.infinispan.remoting.transport.jgroups.JGroupsAddress;
import org.wildfly.clustering.marshalling.protostream.FieldSetMarshaller;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamReader;
import org.wildfly.clustering.marshalling.protostream.ProtoStreamWriter;
/**
* @author Paul Ferraro
*/
public enum InfinispanAddressMarshaller implements FieldSetMarshaller<Address, Address> {
INSTANCE;
private static final int JGROUPS_ADDRESS = 0;
private static final int FIELDS = JGROUPS_ADDRESS + AddressMarshaller.INSTANCE.getFields();
@Override
public Address getBuilder() {
return LocalModeAddress.INSTANCE;
}
@Override
public int getFields() {
return FIELDS;
}
@Override
public Address readField(ProtoStreamReader reader, int index, Address address) throws IOException {
if (index >= JGROUPS_ADDRESS && index < JGROUPS_ADDRESS + AddressMarshaller.INSTANCE.getFields()) {
return new JGroupsAddress(AddressMarshaller.INSTANCE.readField(reader, index, null));
}
return address;
}
@Override
public void writeFields(ProtoStreamWriter writer, int startIndex, Address address) throws IOException {
if (address instanceof JGroupsAddress) {
AddressMarshaller.INSTANCE.writeFields(writer, startIndex, ((JGroupsAddress) address).getJGroupsAddress());
}
}
}
| 2,633
| 37.735294
| 119
|
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.