mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
Merged DEV/LIVECYCLE-3.1 to V3.1 12665: Merged V2.1-A to DEV\LIVECYCLE-3.1 8615: Cluster startup and property setting enhancements 8657: Fixed shutdown procedure for JGroups 8676: Enable system property overriding of more JGroups TCP stack properties - ${alfresco.tcp.start_port:7800} - ${alfresco.tcp.port_range:3} 8678: More logging of cluster view changes and channel factory config during startup 12667: Merged V2.1-A to DEV/LIVECYCLE-3.1 9188: Index recovery job only calls through if property 'alfresco.cluster.name' has been set 9197: Fixed unit test after bean property name change 12793: Merged V2.1-A to DEV/LIVECYCLE-3.1 7765: Requested mimetypes 8526: Updated Mimetypes 8610: Mimetype changes Many branding and other non-core changes were omitted 12848: Fixed JAWS-223: Adobe LC Hibernate Dialect Loading - Hibernate dialect can be null or empty and will be autodetected from the database metadata - Property 'hibernate.dialect' is set on the System - iBatis loading (activities) checks for 'hibernate.dialect' - SchemaBootstrap checks for 'hibernate.dialect' 12854: Merged V2.1-A to DEV/LIVECYCLE-3.1 8681: Fixed mimetype 'application/photoshop' 12856: Merged V2.1-A to DEV/LIVECYCLE-3.1 9008: Fixed ADB-64: NPE when applying aspect cm:mlDocument 12857: Merged V2.1-A to DEV/LIVECYCLE-3.1 9032: ACT-2303: "Namespace is displayed in the Node browser is www.alfresco.org ... ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/V2.1-A:r7765,8526,8610,8615,8657,8676,8678,9188,9197 Merged /alfresco/BRANCHES/V3.1:r12894 Merged /alfresco/BRANCHES/DEV/LIVECYCLE-3.1:r12665,12667,12793,12848,12854,12856-12857 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13518 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -58,6 +58,7 @@ public class JGroupsKeepAliveHeartbeatReceiver extends ReceiverAdapter
|
||||
private final JGroupsKeepAliveHeartbeatSender heartbeatSender;
|
||||
private final Channel channel;
|
||||
private boolean stopped;
|
||||
private View lastView;
|
||||
private final ThreadPoolExecutor threadPool;
|
||||
private final Set<String> rmiUrlsProcessingQueue;
|
||||
|
||||
@@ -189,9 +190,28 @@ public class JGroupsKeepAliveHeartbeatReceiver extends ReceiverAdapter
|
||||
@Override
|
||||
public void viewAccepted(View newView)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
if (EqualsHelper.nullSafeEquals(lastView, newView))
|
||||
{
|
||||
logger.debug("Cluster view changed: " + newView);
|
||||
// No change, so ignore
|
||||
return;
|
||||
}
|
||||
int lastSize = (lastView == null) ? 0 : lastView.getMembers().size();
|
||||
int newSize = newView.getMembers().size();
|
||||
// Report
|
||||
if (newSize < lastSize)
|
||||
{
|
||||
logger.warn("\n" +
|
||||
"New cluster view with fewer members: \n" +
|
||||
" Last View: " + lastView + "\n" +
|
||||
" New View: " + newView);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.info("\n" +
|
||||
"New cluster view with additional members: \n" +
|
||||
" Last View: " + lastView + "\n" +
|
||||
" New View: " + newView);
|
||||
}
|
||||
lastView = newView;
|
||||
}
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ import net.sf.ehcache.CacheManager;
|
||||
import net.sf.ehcache.distribution.CachePeer;
|
||||
|
||||
import org.alfresco.repo.jgroups.AlfrescoJGroupsChannelFactory;
|
||||
import org.alfresco.util.VmShutdownListener;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jgroups.Address;
|
||||
@@ -60,6 +61,8 @@ public final class JGroupsKeepAliveHeartbeatSender
|
||||
lastHeartbeatSendUrls = heartbeatUrls;
|
||||
}
|
||||
|
||||
private VmShutdownListener vmShutdownListener;
|
||||
|
||||
private final CacheManager cacheManager;
|
||||
private final Channel heartbeatChannel;
|
||||
private long heartBeatInterval;
|
||||
@@ -77,7 +80,7 @@ public final class JGroupsKeepAliveHeartbeatSender
|
||||
Channel heartbeatChannel,
|
||||
long heartBeatInterval)
|
||||
{
|
||||
|
||||
this.vmShutdownListener = new VmShutdownListener("JGroupsKeepAliveHeartbeatSender");
|
||||
this.cacheManager = cacheManager;
|
||||
this.heartbeatChannel = heartbeatChannel;
|
||||
this.heartBeatInterval = heartBeatInterval;
|
||||
@@ -112,6 +115,7 @@ public final class JGroupsKeepAliveHeartbeatSender
|
||||
public void init()
|
||||
{
|
||||
serverThread = new HeartbeatSenderThread();
|
||||
serverThread.setDaemon(true);
|
||||
serverThread.start();
|
||||
}
|
||||
|
||||
@@ -149,7 +153,7 @@ public final class JGroupsKeepAliveHeartbeatSender
|
||||
logger.debug("\n" +
|
||||
"Starting cache peer URLs heartbeat");
|
||||
}
|
||||
while (!stopped)
|
||||
while (!stopped && !vmShutdownListener.isVmShuttingDown())
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -172,6 +176,11 @@ public final class JGroupsKeepAliveHeartbeatSender
|
||||
{
|
||||
logger.debug("Heartbeat sending failed: ", e);
|
||||
}
|
||||
// Quick exit if necessary
|
||||
if (stopped || vmShutdownListener.isVmShuttingDown())
|
||||
{
|
||||
break;
|
||||
}
|
||||
// Wait for the next heartbeat
|
||||
synchronized (this)
|
||||
{
|
||||
|
@@ -0,0 +1,47 @@
|
||||
package org.alfresco.repo.domain.ibatis;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.orm.ibatis.SqlMapClientFactoryBean;
|
||||
|
||||
import com.ibatis.sqlmap.client.SqlMapClient;
|
||||
|
||||
/**
|
||||
* Extension to the SQLMap factory to produce <tt>SqlMapClient</tt> instances that
|
||||
* cater for Alfresco extensions.
|
||||
* <p>
|
||||
* Currently, this is just a hack to find the Hibernate dialect and provide that as
|
||||
* a property to the factory code. This will go away if we move over to iBatis; to be
|
||||
* replaced with something similar to the schema script loading that uses a hierarchy
|
||||
* of databases.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.1
|
||||
*/
|
||||
public class AlfrescoSqlMapClientFactoryBean extends SqlMapClientFactoryBean
|
||||
{
|
||||
|
||||
@Override
|
||||
protected SqlMapClient buildSqlMapClient(Resource configLocation, Properties properties) throws IOException
|
||||
{
|
||||
// Get the Hibernate dialect from the system properties
|
||||
String hibernateDialect = System.getProperty(Environment.DIALECT);
|
||||
if (hibernateDialect == null)
|
||||
{
|
||||
return super.buildSqlMapClient(configLocation, properties);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
properties = new Properties();
|
||||
}
|
||||
properties.put("hibernate.dialect", hibernateDialect);
|
||||
return super.buildSqlMapClient(configLocation, properties);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -970,8 +970,14 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
||||
private void changeDialect(Configuration cfg)
|
||||
{
|
||||
String dialectName = cfg.getProperty(Environment.DIALECT);
|
||||
if (dialectName == null)
|
||||
if (dialectName == null || dialectName.length() == 0)
|
||||
{
|
||||
// Look for it on the system properties
|
||||
dialectName = System.getProperty("hibernate.dialect");
|
||||
if (dialectName != null)
|
||||
{
|
||||
cfg.setProperty(Environment.DIALECT, dialectName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// TODO: https://issues.alfresco.com/jira/browse/ETHREEOH-679
|
||||
|
@@ -153,13 +153,33 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
|
||||
}
|
||||
|
||||
/**
|
||||
* Close all channels. All the channels will continue to function, but will be replaced
|
||||
* internally with dummy channels. Effectively, all the cluster communications will be
|
||||
* closed down.
|
||||
* Close all channels. All the channels will be closed and will cease to function.
|
||||
*/
|
||||
private static void closeChannels()
|
||||
{
|
||||
changeClusterNamePrefix(null);
|
||||
for (Map.Entry<String, ChannelProxy> entry : channels.entrySet())
|
||||
{
|
||||
ChannelProxy channelProxy = entry.getValue();
|
||||
|
||||
// Close the channel via the proxy
|
||||
try
|
||||
{
|
||||
channelProxy.close();
|
||||
channelProxy.shutdown();
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("\n" +
|
||||
"Closed channel: " + channelProxy);
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
logger.warn(
|
||||
"Unable to close channel: \n" +
|
||||
" Channel: " + channelProxy,
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -358,11 +378,13 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
|
||||
e);
|
||||
}
|
||||
// done
|
||||
if (logger.isDebugEnabled())
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.debug("\n" +
|
||||
logger.info("\n" +
|
||||
"Created JChannelFactory: \n" +
|
||||
" configuration: " + AlfrescoJGroupsChannelFactory.configUrl);
|
||||
" Cluster Name: " + (AlfrescoJGroupsChannelFactory.clusterNamePrefix == null ? "" : AlfrescoJGroupsChannelFactory.clusterNamePrefix) + "\n" +
|
||||
" Stack Mapping: " + AlfrescoJGroupsChannelFactory.stacksByAppRegion + "\n" +
|
||||
" Configuration: " + AlfrescoJGroupsChannelFactory.configUrl);
|
||||
}
|
||||
return AlfrescoJGroupsChannelFactory.channelFactory;
|
||||
}
|
||||
@@ -394,6 +416,13 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
|
||||
try
|
||||
{
|
||||
oldChannel.close();
|
||||
oldChannel.shutdown();
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("\n" +
|
||||
"Closed old channel during channel rebuild: \n" +
|
||||
" Old channel: " + oldChannel);
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
@@ -420,12 +449,15 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
|
||||
writeLock.lock();
|
||||
try
|
||||
{
|
||||
if (clusterNamePrefix == null || clusterNamePrefix.length() == 0)
|
||||
if (clusterNamePrefix == null || clusterNamePrefix.trim().length() == 0 || clusterNamePrefix.startsWith("${"))
|
||||
{
|
||||
// Clear everything out
|
||||
AlfrescoJGroupsChannelFactory.clusterNamePrefix = null;
|
||||
}
|
||||
AlfrescoJGroupsChannelFactory.clusterNamePrefix = clusterNamePrefix;
|
||||
else
|
||||
{
|
||||
AlfrescoJGroupsChannelFactory.clusterNamePrefix = clusterNamePrefix;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -490,11 +522,11 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AlfrescoJGroupsChannelFactory#changeClusterName(String)
|
||||
* @see AlfrescoJGroupsChannelFactory#changeClusterNamePrefix(String)
|
||||
*/
|
||||
public void setClusterNamePrefix(String clusterNamePrefix)
|
||||
public void setClusterName(String clusterName)
|
||||
{
|
||||
AlfrescoJGroupsChannelFactory.changeClusterNamePrefix(clusterNamePrefix);
|
||||
AlfrescoJGroupsChannelFactory.changeClusterNamePrefix(clusterName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -579,6 +611,8 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
|
||||
/**
|
||||
* Swap the channel. The old delegate will be disconnected before the swap occurs.
|
||||
* This guarantees data consistency, assuming that any failures will be handled.
|
||||
* <p>
|
||||
* Note that the old delegate is not closed or shutdown.
|
||||
*
|
||||
* @param the new delegate
|
||||
* @return the old, disconnected delegate
|
||||
@@ -593,8 +627,6 @@ public class AlfrescoJGroupsChannelFactory extends AbstractLifecycleBean
|
||||
}
|
||||
delegate.setUpHandler(null);
|
||||
|
||||
// Close the old delegate
|
||||
delegate.close();
|
||||
Channel oldDelegage = delegate;
|
||||
|
||||
// Assign the new delegate and carry the listeners over
|
||||
|
@@ -28,7 +28,6 @@ import java.io.Serializable;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.copy.CopyServicePolicies;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
@@ -163,7 +162,7 @@ public class MultilingualDocumentAspect implements
|
||||
}
|
||||
|
||||
// if the local has been modified
|
||||
if (!localeBefore.equals(localeAfter))
|
||||
if (localeBefore == null || !localeBefore.equals(localeAfter))
|
||||
{
|
||||
NodeRef mlContainer = multilingualContentService.getTranslationContainer(nodeRef);
|
||||
|
||||
@@ -191,7 +190,7 @@ public class MultilingualDocumentAspect implements
|
||||
// if locale of the container is equals to the locale of
|
||||
// the node (before update). The nodeRef is the pivot language
|
||||
// and the locale of the mlContainer must be modified
|
||||
if(localeBefore.equals(localMlContainer))
|
||||
if(localeBefore != null && localeBefore.equals(localMlContainer))
|
||||
{
|
||||
nodeService.setProperty(
|
||||
mlContainer,
|
||||
|
@@ -24,7 +24,9 @@
|
||||
*/
|
||||
package org.alfresco.repo.module;
|
||||
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.module.ModuleService;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.AbstractLifecycleBean;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
@@ -37,8 +39,18 @@ import org.springframework.context.ApplicationEvent;
|
||||
*/
|
||||
public class ModuleStarter extends AbstractLifecycleBean
|
||||
{
|
||||
private TransactionService transactionService;
|
||||
private ModuleService moduleService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param transactionService provides the retrying transaction
|
||||
*/
|
||||
public void setTransactionService(TransactionService transactionService)
|
||||
{
|
||||
this.transactionService = transactionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param moduleService the service that will do the actual work.
|
||||
*/
|
||||
@@ -51,7 +63,15 @@ public class ModuleStarter extends AbstractLifecycleBean
|
||||
protected void onBootstrap(ApplicationEvent event)
|
||||
{
|
||||
PropertyCheck.mandatory(this, "moduleService", moduleService);
|
||||
moduleService.startModules();
|
||||
RetryingTransactionCallback<Object> startModulesCallback = new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object execute() throws Throwable
|
||||
{
|
||||
moduleService.startModules();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(startModulesCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,19 +1,22 @@
|
||||
package org.alfresco.repo.node.index;
|
||||
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
/**
|
||||
* Forces a index recovery using the {@link IndexRecovery recovery component} passed
|
||||
* in via the job detail.
|
||||
* <p>
|
||||
* Nothing is done if the cluster name property <b>alfresco.cluster.name</b> has not been set.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
*/
|
||||
public class IndexRecoveryJob implements Job
|
||||
{
|
||||
/** KEY_INDEX_RECOVERY_COMPONENT = 'indexRecoveryComponent' */
|
||||
public static final String KEY_INDEX_RECOVERY_COMPONENT = "indexRecoveryComponent";
|
||||
public static final String KEY_CLUSTER_NAME = "clusterName";
|
||||
|
||||
/**
|
||||
* Forces a full index recovery using the {@link IndexRecovery recovery component} passed
|
||||
@@ -21,12 +24,18 @@ public class IndexRecoveryJob implements Job
|
||||
*/
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException
|
||||
{
|
||||
IndexRecovery indexRecoveryComponent = (IndexRecovery) context.getJobDetail()
|
||||
.getJobDataMap().get(KEY_INDEX_RECOVERY_COMPONENT);
|
||||
JobDataMap map = context.getJobDetail().getJobDataMap();
|
||||
IndexRecovery indexRecoveryComponent = (IndexRecovery) map.get(KEY_INDEX_RECOVERY_COMPONENT);
|
||||
if (indexRecoveryComponent == null)
|
||||
{
|
||||
throw new JobExecutionException("Missing job data: " + KEY_INDEX_RECOVERY_COMPONENT);
|
||||
}
|
||||
String clusterName = (String) map.get(KEY_CLUSTER_NAME);
|
||||
if (clusterName == null || clusterName.trim().length() == 0 || clusterName.startsWith("${"))
|
||||
{
|
||||
// No cluster name
|
||||
return;
|
||||
}
|
||||
// reindex
|
||||
indexRecoveryComponent.reindex();
|
||||
}
|
||||
|
@@ -361,7 +361,18 @@ public final class QName implements QNamePattern, Serializable, Cloneable
|
||||
return (prefix == null) ? localName : prefix + NAMESPACE_PREFIX + localName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getter version of toPrefixString()
|
||||
*
|
||||
* @return the string representation of QName
|
||||
*/
|
||||
public String getPrefixString()
|
||||
{
|
||||
return toPrefixString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render string representation of QName using format:
|
||||
*
|
||||
|
Reference in New Issue
Block a user