[ARTEMIS-3494]: ActiveMQClientProtocolManagerFactory shouldn't have a private constructor.

* Removing the 'private' constructor
* Removing the use of a static getInstance

Issue: https://issues.apache.org/jira/browse/ARTEMIS-3494
This commit is contained in:
Emmanuel Hugonnet 2021-09-22 14:06:18 +02:00 committed by Bruscino Domenico Francesco
parent 1a27d8e28d
commit fa439375e9
5 changed files with 9 additions and 9 deletions

View File

@ -95,7 +95,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
private static final long serialVersionUID = -1615857864410205260L; private static final long serialVersionUID = -1615857864410205260L;
// This is the default value // This is the default value
private ClientProtocolManagerFactory protocolManagerFactory = ActiveMQClientProtocolManagerFactory.getInstance(this); private ClientProtocolManagerFactory protocolManagerFactory = new ActiveMQClientProtocolManagerFactory().setLocator(this);
private final boolean ha; private final boolean ha;
@ -506,7 +506,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
public ClientProtocolManagerFactory getProtocolManagerFactory() { public ClientProtocolManagerFactory getProtocolManagerFactory() {
if (protocolManagerFactory == null) { if (protocolManagerFactory == null) {
// Default one in case it's null // Default one in case it's null
protocolManagerFactory = ActiveMQClientProtocolManagerFactory.getInstance(this); protocolManagerFactory = new ActiveMQClientProtocolManagerFactory().setLocator(this);
} }
return protocolManagerFactory; return protocolManagerFactory;
} }

View File

@ -25,9 +25,6 @@ public class ActiveMQClientProtocolManagerFactory implements ClientProtocolManag
private static final long serialVersionUID = 1; private static final long serialVersionUID = 1;
private ActiveMQClientProtocolManagerFactory() {
}
ServerLocator locator; ServerLocator locator;
@Override @Override
@ -36,8 +33,9 @@ public class ActiveMQClientProtocolManagerFactory implements ClientProtocolManag
} }
@Override @Override
public void setLocator(ServerLocator locator) { public ClientProtocolManagerFactory setLocator(ServerLocator locator) {
this.locator = locator; this.locator = locator;
return this;
} }
public static final ActiveMQClientProtocolManagerFactory getInstance(ServerLocator locator) { public static final ActiveMQClientProtocolManagerFactory getInstance(ServerLocator locator) {

View File

@ -23,7 +23,7 @@ public interface ClientProtocolManagerFactory {
ClientProtocolManager newProtocolManager(); ClientProtocolManager newProtocolManager();
void setLocator(ServerLocator locator); ClientProtocolManagerFactory setLocator(ServerLocator locator);
ServerLocator getLocator(); ServerLocator getLocator();

View File

@ -36,10 +36,11 @@ public class HornetQClientProtocolManagerFactory implements ClientProtocolManage
} }
@Override @Override
public void setLocator(ServerLocator locator) { public ClientProtocolManagerFactory setLocator(ServerLocator locator) {
this.locator = locator; this.locator = locator;
locator.addIncomingInterceptor(new HQPropertiesConversionInterceptor(true)); locator.addIncomingInterceptor(new HQPropertiesConversionInterceptor(true));
locator.addOutgoingInterceptor(new HQPropertiesConversionInterceptor(false)); locator.addOutgoingInterceptor(new HQPropertiesConversionInterceptor(false));
return this;
} }
/** /**

View File

@ -44,8 +44,9 @@ public class ActiveMQServerSideProtocolManagerFactory implements ClientProtocolM
} }
@Override @Override
public void setLocator(ServerLocator locator) { public ClientProtocolManagerFactory setLocator(ServerLocator locator) {
this.locator = locator; this.locator = locator;
return this;
} }
public static ActiveMQServerSideProtocolManagerFactory getInstance(ServerLocator locator, StorageManager storageManager) { public static ActiveMQServerSideProtocolManagerFactory getInstance(ServerLocator locator, StorageManager storageManager) {