Skip to content

Commit

Permalink
Cleaning up the code by removing unused fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsavoie committed Sep 13, 2018
1 parent d5ec48b commit 0fca817
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 28 deletions.
Expand Up @@ -165,7 +165,6 @@ public class ExternalPooledConnectionFactoryService implements Service<Void> {
public static final String JGROUPS_CHANNEL_NAME = "jgroupsChannelName";
public static final String JGROUPS_CHANNEL_REF_NAME = "jgroupsChannelRefName";

private Supplier<Object> transactionManager;
private final DiscoveryGroupConfiguration discoveryGroupConfiguration;
private final TransportConfiguration[] connectors;
private List<PooledConnectionFactoryConfigProperties> adapterParams;
Expand All @@ -182,7 +181,7 @@ public class ExternalPooledConnectionFactoryService implements Service<Void> {
private int minPoolSize;
private int maxPoolSize;
private final String jgroupsClusterName;
private final String jgroupChannelName;
private final String jgroupsChannelName;
private final boolean createBinderService;
private final String managedConnectionPoolClassName;
// can be null. In that case the behaviour is depending on the IronJacamar container setting.
Expand All @@ -191,12 +190,12 @@ public class ExternalPooledConnectionFactoryService implements Service<Void> {


public ExternalPooledConnectionFactoryService(String name, TransportConfiguration[] connectors, DiscoveryGroupConfiguration groupConfiguration, String jgroupsClusterName,
String jgroupChannelName, List<PooledConnectionFactoryConfigProperties> adapterParams, BindInfo bindInfo, String txSupport, int minPoolSize, int maxPoolSize, String managedConnectionPoolClassName, Boolean enlistmentTrace) {
String jgroupsChannelName, List<PooledConnectionFactoryConfigProperties> adapterParams, BindInfo bindInfo, String txSupport, int minPoolSize, int maxPoolSize, String managedConnectionPoolClassName, Boolean enlistmentTrace) {
this.name = name;
this.connectors = connectors;
this.discoveryGroupConfiguration = groupConfiguration;
this.jgroupsClusterName = jgroupsClusterName;
this.jgroupChannelName = jgroupChannelName;
this.jgroupsChannelName = jgroupsChannelName;
this.adapterParams = adapterParams;
this.bindInfo = bindInfo;
createBinderService = true;
Expand Down Expand Up @@ -234,20 +233,18 @@ public static ExternalPooledConnectionFactoryService installService(OperationCon
connectors, groupConfiguration, jgroupClusterName, jgroupChannelName, adapterParams,
bindInfo, txSupport, minPoolSize, maxPoolSize, managedConnectionPoolClassName, enlistmentTrace);

installService0(context, serviceName, service, groupConfiguration, jgroupClusterName, jgroupChannelName, connectorsSocketBindings, model);
installService0(context, serviceName, service, groupConfiguration, connectorsSocketBindings, model);
return service;
}

private static void installService0(OperationContext context,
ServiceName serviceName,
ExternalPooledConnectionFactoryService service,
DiscoveryGroupConfiguration groupConfiguration,
String jgroupsClusterName,
String jgroupsChannelName,
Set<String> connectorsSocketBindings,
ModelNode model) throws OperationFailedException {
ServiceBuilder serviceBuilder = context.getServiceTarget().addService(serviceName);
service.transactionManager = serviceBuilder.requires(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER);
serviceBuilder.requires(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER);
// ensures that Artemis client thread pools are not stopped before any deployment depending on a pooled-connection-factory
serviceBuilder.requires(MessagingServices.ACTIVEMQ_CLIENT_THREAD_POOL);
ModelNode credentialReference = ConnectionFactoryAttributes.Pooled.CREDENTIAL_REFERENCE.resolveModelAttribute(context, model);
Expand All @@ -269,11 +266,11 @@ private static void installService0(OperationContext context,
}
if (groupConfiguration != null) {
final String key = "discovery" + groupConfiguration.getName();
if (jgroupsClusterName != null) {
ServiceName commandDispatcherFactoryServiceName = jgroupsChannelName != null ? ClusteringRequirement.COMMAND_DISPATCHER_FACTORY.getServiceName(context, jgroupsChannelName) : ClusteringDefaultRequirement.COMMAND_DISPATCHER_FACTORY.getServiceName(context);
if (service.jgroupsClusterName != null) {
ServiceName commandDispatcherFactoryServiceName = service.jgroupsChannelName != null ? ClusteringRequirement.COMMAND_DISPATCHER_FACTORY.getServiceName(context, service.jgroupsChannelName) : ClusteringDefaultRequirement.COMMAND_DISPATCHER_FACTORY.getServiceName(context);
Supplier<CommandDispatcherFactory> commandDispatcherFactorySupplier = serviceBuilder.requires(commandDispatcherFactoryServiceName);
service.commandDispatcherFactories.put(key, commandDispatcherFactorySupplier);
service.clusterNames.put(key, jgroupsClusterName);
service.clusterNames.put(key, service.jgroupsClusterName);
} else {
final ServiceName groupBinding = GroupBindingService.getDiscoveryBaseServiceName(JBOSS_MESSAGING_ACTIVEMQ).append(groupConfiguration.getName());
Supplier<SocketBinding> socketBindingSupplier = serviceBuilder.requires(groupBinding);
Expand Down
Expand Up @@ -166,7 +166,6 @@ public class PooledConnectionFactoryService implements Service<Void> {
public static final String JGROUPS_CHANNEL_NAME = "jgroupsChannelName";
public static final String JGROUPS_CHANNEL_REF_NAME = "jgroupsChannelRefName";

private Injector<Object> transactionManager = new InjectedValue<Object>();
private List<String> connectors;
private String discoveryGroupName;
private List<PooledConnectionFactoryConfigProperties> adapterParams;
Expand Down Expand Up @@ -301,7 +300,7 @@ private static void installService0(OperationContext context,
private static ServiceBuilder createServiceBuilder(ServiceTarget serviceTarget, ServiceName serverServiceName, ServiceName serviceName, PooledConnectionFactoryService service) {
ServiceBuilder serviceBuilder = serviceTarget
.addService(serviceName, service)
.addDependency(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER, service.transactionManager)
.addDependency(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER)
.addDependency(serverServiceName, ActiveMQServer.class, service.activeMQServer)
.addDependency(ActiveMQActivationService.getServiceName(serverServiceName))
.addDependency(JMSServices.getJmsManagerBaseServiceName(serverServiceName))
Expand All @@ -311,11 +310,13 @@ private static ServiceBuilder createServiceBuilder(ServiceTarget serviceTarget,
return serviceBuilder;
}

@Override
public Void getValue() throws IllegalStateException, IllegalArgumentException {
return null;
}


@Override
public void start(StartContext context) throws StartException {
ServiceTarget serviceTarget = context.getChildTarget();
try {
Expand Down Expand Up @@ -404,12 +405,18 @@ private void createService(ServiceTarget serviceTarget, ServiceContainer contain
inboundProperties.add(p);
}
} else {
if (adapterParam.getConfigType() == ConnectionFactoryAttribute.ConfigType.INBOUND) {
inboundProperties.add(p);
} else if (adapterParam.getConfigType() == ConnectionFactoryAttribute.ConfigType.OUTBOUND) {
outboundProperties.add(p);
} else {
if (null == adapterParam.getConfigType()) {
properties.add(p);
} else switch (adapterParam.getConfigType()) {
case INBOUND:
inboundProperties.add(p);
break;
case OUTBOUND:
outboundProperties.add(p);
break;
default:
properties.add(p);
break;
}
}
}
Expand Down Expand Up @@ -459,12 +466,6 @@ private void createService(ServiceTarget serviceTarget, ServiceContainer contain
activator.getTxIntegrationInjector())
.addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE,
JcaSubsystemConfiguration.class, activator.getConfigInjector())
// No legacy security services needed as this activation's sole connection definition
// does not configure a legacy security domain
/*
.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class,
activator.getSubjectFactoryInjector())
*/
.addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class,
activator.getCcmInjector()).addDependency(NamingService.SERVICE_NAME)
.addDependency(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER)
Expand Down Expand Up @@ -588,10 +589,6 @@ public void stop(StopContext context) {
// Service context takes care of this
}

public Injector<Object> getTransactionManager() {
return transactionManager;
}

Injector<SocketBinding> getSocketBindingInjector(String name) {
return new MapInjector<String, SocketBinding>(socketBindings, name);
}
Expand Down

0 comments on commit 0fca817

Please sign in to comment.