当前位置: 首页>>代码示例>>Java>>正文


Java VmShutdownListener类代码示例

本文整理汇总了Java中org.alfresco.util.VmShutdownListener的典型用法代码示例。如果您正苦于以下问题:Java VmShutdownListener类的具体用法?Java VmShutdownListener怎么用?Java VmShutdownListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VmShutdownListener类属于org.alfresco.util包,在下文中一共展示了VmShutdownListener类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JobLockServiceImpl

import org.alfresco.util.VmShutdownListener; //导入依赖的package包/类
public JobLockServiceImpl()
{
    defaultRetryWait = 20;
    defaultRetryCount = 10;
    txnListener = new LockTransactionListener();
    
    TraceableThreadFactory threadFactory = new TraceableThreadFactory();
    threadFactory.setThreadDaemon(false);
    threadFactory.setNamePrefix("JobLockService");
    
    scheduler = Executors.newSingleThreadScheduledExecutor(threadFactory);
    
    shutdownListener = new VmShutdownListener("JobLockService");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:JobLockServiceImpl.java

示例2: getArchivedNodesWorkProvider

import org.alfresco.util.VmShutdownListener; //导入依赖的package包/类
/**
 * @return                      Returns a work provider for batch processing
 * 
 * @since 3.3.4
 */
private BatchProcessWorkProvider<NodeRef> getArchivedNodesWorkProvider(final StoreRef originalStoreRef, final String lockToken)
{
    return new BatchProcessWorkProvider<NodeRef>()
    {
        private VmShutdownListener vmShutdownLister = new VmShutdownListener("getArchivedNodesWorkProvider");
        private List<NodeRef> nodeRefs;
        private boolean done;
        private synchronized List<NodeRef> getNodeRefs()
        {
            if (nodeRefs == null)
            {
                nodeRefs = getArchivedNodes(originalStoreRef);
            }
            return nodeRefs;
        }
        /**
         * @return              Returns 0, always
         */
        public synchronized int getTotalEstimatedWorkSize()
        {
            return 0;
        }
        public synchronized Collection<NodeRef> getNextWork()
        {
            if (vmShutdownLister.isVmShuttingDown())
            {
                return Collections.emptyList();
            }
            // Make sure we still have the lock
            try
            {
                // TODO: Replace with joblock callback mechanism that provides shutdown hints
                jobLockService.refreshLock(lockToken, LOCK_QNAME, LOCK_TTL);
            }
            catch (LockAcquisitionException e)
            {
                // This is OK.  We don't have the lock so just quit
                return Collections.emptyList();
            }
            
            if (done)
            {
                return Collections.emptyList();
            }
            else
            {
                done = true;
                return getNodeRefs();
            }
        }
    };
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:58,代码来源:NodeArchiveServiceImpl.java


注:本文中的org.alfresco.util.VmShutdownListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。