mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Messenger facade: MessengerFactory.createMessenger() now takes app-region as parameter
* Allows single factory to be specified and individual consumers to use it to create appropriate application-region-scoped messengers. * New interface more appropriate for where non-DI use will be required, e.g. Ehcache peer providers. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@33846 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,9 +22,8 @@ package org.alfresco.repo.cluster;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.repo.jgroups.AlfrescoJGroupsChannelFactory;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.jgroups.Channel;
|
||||
import org.springframework.beans.factory.annotation.Required;
|
||||
|
||||
/**
|
||||
* JGroups implementation of the {@link MessengerFactory} interface.
|
||||
@@ -33,20 +32,11 @@ import org.springframework.beans.factory.annotation.Required;
|
||||
*/
|
||||
public class JGroupsMessengerFactory implements MessengerFactory
|
||||
{
|
||||
private String appRegion;
|
||||
|
||||
|
||||
@Override
|
||||
public <T extends Serializable> Messenger<T> createMessenger()
|
||||
public <T extends Serializable> Messenger<T> createMessenger(String appRegion)
|
||||
{
|
||||
PropertyCheck.mandatory(this, "appRegion", appRegion);
|
||||
ParameterCheck.mandatory("appRegion", appRegion);
|
||||
Channel channel = AlfrescoJGroupsChannelFactory.getChannel(appRegion);
|
||||
return new JGroupsMessenger<T>(channel);
|
||||
}
|
||||
|
||||
@Required
|
||||
public void setAppRegion(String appRegion)
|
||||
{
|
||||
this.appRegion = appRegion;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user