spring 线程池_Spring线程池服务

spring 线程池

线程池对于执行同步和异步过程非常重要。 本文介绍如何使用Spring开发和监视线程池服务。 创建线程池已通过两种替代方法进行了说明。

二手技术

JDK 1.6.0_21
春天3.0.5
Maven的3.0.2

步骤1:建立已完成的专案

创建一个Maven项目,如下所示。 (可以使用Maven或IDE插件创建)。

步骤2:图书馆

Spring依赖项已添加到Maven的pom.xml中。

<!-- Spring 3 dependencies -->
<dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version>
</dependency>
<dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version>
</dependency>

为了创建runnable-jar,可以使用以下插件。

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-shade-plugin</artifactId><version>1.3.1</version><executions><execution><phase>package</phase><goals><goal>shade</goal></goals><configuration><transformers><transformerimplementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"><mainClass>com.otv.exe.Application</mainClass></transformer><transformerimplementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.handlers</resource></transformer><transformerimplementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.schemas</resource></transformer></transformers></configuration></execution></executions>
</plugin>

第3步:创建任务班

通过实现Runnable接口可以创建一个新的TestTask类。 此类显示要执行的任务。

package com.otv.task;import org.apache.log4j.Logger;/*** @author onlinetechvision.com* @since 17 Oct 2011* @version 1.0.0**/
public class TestTask implements Runnable {private static Logger log = Logger.getLogger(TestTask.class);String taskName;public TestTask() {}public TestTask(String taskName) {this.taskName = taskName;}public void run() {try {log.debug(this.taskName + " : is started.");Thread.sleep(10000);log.debug(this.taskName + " : is completed.");} catch (InterruptedException e) {log.error(this.taskName + " : is not completed!");e.printStackTrace();}}@Overridepublic String toString() {return (getTaskName());}public String getTaskName() {return taskName;}public void setTaskName(String taskName) {this.taskName = taskName;}
}

步骤4:建立TestRejectedExecutionHandler类别

通过实现RejectedExecutionHandler接口创建TestRejectedExecutionHandler类。 如果没有空闲线程并且队列溢出,则将拒绝任务。 此类处理被拒绝的任务。

package com.otv.handler;import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;import org.apache.log4j.Logger;/*** @author onlinetechvision.com* @since 17 Oct 2011* @version 1.0.0**/
public class TestRejectedExecutionHandler implements RejectedExecutionHandler {private static Logger log = Logger.getLogger(TestRejectedExecutionHandler.class);public void rejectedExecution(Runnable runnable, ThreadPoolExecutor executor) {log.debug(runnable.toString() + " : has been rejected");}
}

步骤5:创建ITestThreadPoolExecutorService接口

ITestThreadPoolExecutorService接口已创建。

package com.otv.srv;import java.util.concurrent.ThreadPoolExecutor;import com.otv.handler.TestRejectedExecutionHandler;/*** @author onlinetechvision.com* @since 17 Oct 2011* @version 1.0.0**/
public interface ITestThreadPoolExecutorService {public ThreadPoolExecutor createNewThreadPool();public int getCorePoolSize();public void setCorePoolSize(int corePoolSize);public int getMaxPoolSize();public void setMaxPoolSize(int maximumPoolSize);public long getKeepAliveTime();public void setKeepAliveTime(long keepAliveTime);public int getQueueCapacity();public void setQueueCapacity(int queueCapacity);public TestRejectedExecutionHandler getTestRejectedExecutionHandler();public void setTestRejectedExecutionHandler(TestRejectedExecutionHandler testRejectedExecutionHandler);}

步骤6:建立TestThreadPoolExecutorService类别

通过实现ITestThreadPoolExecutorService接口来创建TestThreadPoolExecutorService类。 此类创建一个新的线程池。

package com.otv.srv;import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;import com.otv.handler.TestRejectedExecutionHandler;/*** @author onlinetechvision.com* @since 17 Oct 2011* @version 1.0.0**/
public class TestThreadPoolExecutorService implements ITestThreadPoolExecutorService {private int  corePoolSize;private int  maxPoolSize;private long keepAliveTime;private int  queueCapacity;TestRejectedExecutionHandler testRejectedExecutionHandler;public ThreadPoolExecutor createNewThreadPool() {ThreadPoolExecutor executor = new ThreadPoolExecutor(getCorePoolSize(),getMaxPoolSize(),getKeepAliveTime(),TimeUnit.SECONDS,new ArrayBlockingQueue(getQueueCapacity()),getTestRejectedExecutionHandler());return executor;}public int getCorePoolSize() {return corePoolSize;}public void setCorePoolSize(int corePoolSize) {this.corePoolSize = corePoolSize;}public int getMaxPoolSize() {return maxPoolSize;}public void setMaxPoolSize(int maxPoolSize) {this.maxPoolSize = maxPoolSize;}public long getKeepAliveTime() {return keepAliveTime;}public void setKeepAliveTime(long keepAliveTime) {this.keepAliveTime = keepAliveTime;}public int getQueueCapacity() {return queueCapacity;}public void setQueueCapacity(int queueCapacity) {this.queueCapacity = queueCapacity;}public TestRejectedExecutionHandler getTestRejectedExecutionHandler() {return testRejectedExecutionHandler;}public void setTestRejectedExecutionHandler(TestRejectedExecutionHandler testRejectedExecutionHandler) {this.testRejectedExecutionHandler = testRejectedExecutionHandler;}
}

步骤7:创建IThreadPoolMonitorService接口

IThreadPoolMonitorService接口已创建。

package com.otv.monitor.srv;import java.util.concurrent.ThreadPoolExecutor;public interface IThreadPoolMonitorService extends Runnable {public void monitorThreadPool();public ThreadPoolExecutor getExecutor();public void setExecutor(ThreadPoolExecutor executor);}

步骤8:创建ThreadPoolMonitorService类

ThreadPoolMonitorService类是通过实现IThreadPoolMonitorService接口创建的。 此类监视创建的线程池。

package com.otv.monitor.srv;import java.util.concurrent.ThreadPoolExecutor;
import org.apache.log4j.Logger;/*** @author onlinetechvision.com* @since 17 Oct 2011* @version 1.0.0**/
public class ThreadPoolMonitorService implements IThreadPoolMonitorService {private static Logger log = Logger.getLogger(ThreadPoolMonitorService.class);ThreadPoolExecutor executor;private long monitoringPeriod; public void run() {try {while (true){monitorThreadPool();Thread.sleep(monitoringPeriod*1000);}} catch (Exception e) {log.error(e.getMessage());}}public void monitorThreadPool() {StringBuffer strBuff = new StringBuffer();strBuff.append("CurrentPoolSize : ").append(executor.getPoolSize());strBuff.append(" - CorePoolSize : ").append(executor.getCorePoolSize());strBuff.append(" - MaximumPoolSize : ").append(executor.getMaximumPoolSize());strBuff.append(" - ActiveTaskCount : ").append(executor.getActiveCount());strBuff.append(" - CompletedTaskCount : ").append(executor.getCompletedTaskCount());strBuff.append(" - TotalTaskCount : ").append(executor.getTaskCount());strBuff.append(" - isTerminated : ").append(executor.isTerminated());log.debug(strBuff.toString());}public ThreadPoolExecutor getExecutor() {return executor;}public void setExecutor(ThreadPoolExecutor executor) {this.executor = executor;}   public long getMonitoringPeriod() {return monitoringPeriod;}public void setMonitoringPeriod(long monitoringPeriod) {this.monitoringPeriod = monitoringPeriod;}
}

第9步:创建入门课程

启动器类已创建。

package com.otv.start;import java.util.concurrent.ThreadPoolExecutor;import org.apache.log4j.Logger;import com.otv.handler.TestRejectedExecutionHandler;
import com.otv.monitor.srv.IThreadPoolMonitorService;
import com.otv.monitor.srv.ThreadPoolMonitorService;
import com.otv.srv.ITestThreadPoolExecutorService;
import com.otv.srv.TestThreadPoolExecutorService;
import com.otv.task.TestTask;/*** @author onlinetechvision.com* @since 17 Oct 2011* @version 1.0.0**/
public class Starter {private static Logger log = Logger.getLogger(TestRejectedExecutionHandler.class);IThreadPoolMonitorService threadPoolMonitorService;ITestThreadPoolExecutorService testThreadPoolExecutorService;public void start() {// A new thread pool is created...ThreadPoolExecutor executor = testThreadPoolExecutorService.createNewThreadPool();executor.allowCoreThreadTimeOut(true);// Created executor is set to ThreadPoolMonitorService...threadPoolMonitorService.setExecutor(executor);// ThreadPoolMonitorService is started...Thread monitor = new Thread(threadPoolMonitorService);monitor.start();// New tasks are executed...for(int i=1;i<10;i++) {executor.execute(new TestTask("Task"+i));}try {Thread.sleep(40000);} catch (Exception e)   {log.error(e.getMessage());}for(int i=10;i<19;i++) {executor.execute(new TestTask("Task"+i));}// executor is shutdown...executor.shutdown();}   public IThreadPoolMonitorService getThreadPoolMonitorService() {return threadPoolMonitorService;}public void setThreadPoolMonitorService(IThreadPoolMonitorService threadPoolMonitorService) {this.threadPoolMonitorService = threadPoolMonitorService;}public ITestThreadPoolExecutorService getTestThreadPoolExecutorService() {return testThreadPoolExecutorService;}public void setTestThreadPoolExecutorService(ITestThreadPoolExecutorService testThreadPoolExecutorService) {this.testThreadPoolExecutorService = testThreadPoolExecutorService;}
}

步骤10:创建应用程序类

应用程序类已创建。 此类运行应用程序。

package com.otv.start;import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;/*** @author onlinetechvision.com* @since 17 Oct 2011* @version 1.0.0**/
public class Application {public static void main(String[] args) {ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");Starter starter = (Starter) context.getBean("Starter");starter.start();}}

步骤11:创建applicationContext.xml

applicationContext.xml已创建。

<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd"><!-- Beans Declaration --><bean id="TestTask" class="com.otv.task.TestTask"></bean><bean id="ThreadPoolMonitorService" class="com.otv.monitor.srv.ThreadPoolMonitorService"><property name="monitoringPeriod"  value="5" /></bean><bean id="TestRejectedExecutionHandler" class="com.otv.handler.TestRejectedExecutionHandler"></bean><bean id="TestThreadPoolExecutorService" class="com.otv.srv.TestThreadPoolExecutorService"><property name="corePoolSize"  value="1" /><property name="maxPoolSize"   value="3" /><property name="keepAliveTime" value="10" /><property name="queueCapacity" value="3" /><property name="testRejectedExecutionHandler" ref="TestRejectedExecutionHandler" /></bean><bean id="Starter" class="com.otv.start.Starter"><property name="threadPoolMonitorService" ref="ThreadPoolMonitorService" /><property name="testThreadPoolExecutorService" ref="TestThreadPoolExecutorService" /></bean>
</beans>

步骤12:创建线程池的替代方法

Spring提供的ThreadPoolTask​​Executor类也可以用于创建线程池。

<bean id="threadPoolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"><property name="corePoolSize"  value="1" /><property name="maxPoolSize"   value="3" /><property name="queueCapacity" value="3" />
</bean><bean id="testTaskExecutor" class="TestTaskExecutor"><constructor-arg ref="threadPoolTaskExecutor" />
</bean>

步骤13:建立专案

生成OTV_Spring_ThreadPool项目后,将创建OTV_Spring_ThreadPool-0.0.1-SNAPSHOT.jar

步骤14:运行项目

运行创建的OTV_Spring_ThreadPool-0.0.1-SNAPSHOT.jar文件后,将在下面显示输出日志:

18.10.2011 20:08:48 DEBUG (TestRejectedExecutionHandler.java:19) - Task7 : has been rejected
18.10.2011 20:08:48 DEBUG (TestRejectedExecutionHandler.java:19) - Task8 : has been rejected
18.10.2011 20:08:48 DEBUG (TestRejectedExecutionHandler.java:19) - Task9 : has been rejected
18.10.2011 20:08:48 DEBUG (TestTask.java:25) - Task1 : is started.
18.10.2011 20:08:48 DEBUG (TestTask.java:25) - Task6 : is started.
18.10.2011 20:08:48 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 2 - CompletedTaskCount : 0 - TotalTaskCount : 5 - isTerminated : false
18.10.2011 20:08:48 DEBUG (TestTask.java:25) - Task5 : is started.
18.10.2011 20:08:53 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 3 - CompletedTaskCount : 0 - TotalTaskCount : 6 - isTerminated : false
18.10.2011 20:08:58 DEBUG (TestTask.java:27) - Task6 : is completed.
18.10.2011 20:08:58 DEBUG (TestTask.java:27) - Task1 : is completed.
18.10.2011 20:08:58 DEBUG (TestTask.java:25) - Task3 : is started.
18.10.2011 20:08:58 DEBUG (TestTask.java:25) - Task2 : is started.
18.10.2011 20:08:58 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 3 - CompletedTaskCount : 2 - TotalTaskCount : 6 - isTerminated : false
18.10.2011 20:08:58 DEBUG (TestTask.java:27) - Task5 : is completed.
18.10.2011 20:08:58 DEBUG (TestTask.java:25) - Task4 : is started.
18.10.2011 20:09:03 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 3 - CompletedTaskCount : 3 - TotalTaskCount : 6 - isTerminated : false
18.10.2011 20:09:08 DEBUG (TestTask.java:27) - Task2 : is completed.
18.10.2011 20:09:08 DEBUG (TestTask.java:27) - Task3 : is completed.
18.10.2011 20:09:08 DEBUG (TestTask.java:27) - Task4 : is completed.
18.10.2011 20:09:08 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 0 - CompletedTaskCount : 6 - TotalTaskCount : 6 - isTerminated : false
18.10.2011 20:09:13 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 0 - CompletedTaskCount : 6 - TotalTaskCount : 6 - isTerminated : false
18.10.2011 20:09:18 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 0 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 0 - CompletedTaskCount : 6 - TotalTaskCount : 6 - isTerminated : false
18.10.2011 20:09:23 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 0 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 0 - CompletedTaskCount : 6 - TotalTaskCount : 6 - isTerminated : false
18.10.2011 20:09:28 DEBUG (TestTask.java:25) - Task10 : is started.
18.10.2011 20:09:28 DEBUG (TestRejectedExecutionHandler.java:19) - Task16 : has been rejected
18.10.2011 20:09:28 DEBUG (TestRejectedExecutionHandler.java:19) - Task17 : has been rejected
18.10.2011 20:09:28 DEBUG (TestRejectedExecutionHandler.java:19) - Task18 : has been rejected
18.10.2011 20:09:28 DEBUG (TestTask.java:25) - Task14 : is started.
18.10.2011 20:09:28 DEBUG (TestTask.java:25) - Task15 : is started.
18.10.2011 20:09:28 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 3 - CompletedTaskCount : 6 - TotalTaskCount : 12 - isTerminated : false
18.10.2011 20:09:33 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 3 - CompletedTaskCount : 6 - TotalTaskCount : 12 - isTerminated : false
18.10.2011 20:09:38 DEBUG (TestTask.java:27) - Task10 : is completed.
18.10.2011 20:09:38 DEBUG (TestTask.java:25) - Task11 : is started.
18.10.2011 20:09:38 DEBUG (TestTask.java:27) - Task14 : is completed.
18.10.2011 20:09:38 DEBUG (TestTask.java:27) - Task15 : is completed.
18.10.2011 20:09:38 DEBUG (TestTask.java:25) - Task12 : is started.
18.10.2011 20:09:38 DEBUG (TestTask.java:25) - Task13 : is started.
18.10.2011 20:09:38 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 3 - CompletedTaskCount : 9 - TotalTaskCount : 12 - isTerminated : false
18.10.2011 20:09:43 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 3 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 3 - CompletedTaskCount : 9 - TotalTaskCount : 12 - isTerminated : false
18.10.2011 20:09:48 DEBUG (TestTask.java:27) - Task11 : is completed.
18.10.2011 20:09:48 DEBUG (TestTask.java:27) - Task13 : is completed.
18.10.2011 20:09:48 DEBUG (TestTask.java:27) - Task12 : is completed.
18.10.2011 20:09:48 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 0 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 0 - CompletedTaskCount : 12 - TotalTaskCount : 12 - isTerminated : true
18.10.2011 20:09:53 DEBUG (ThreadPoolMonitorService.java:39) - CurrentPoolSize : 0 - CorePoolSize : 1 - MaximumPoolSize : 3 - ActiveTaskCount : 0 - CompletedTaskCount : 12 - TotalTaskCount : 12 - isTerminated : true

步骤15:下载

OTV_Spring_ThreadPool

参考: 如何使用我们JCG合作伙伴提供的 Spring开发和监视线程池服务   在线技术愿景博客的Eren Avsarogullari。


翻译自: https://www.javacodegeeks.com/2012/02/spring-thread-pool-services.html

spring 线程池

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/356625.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

带有骆驼,ActiveMQ,Elasticsearch的HL7关键用例

对于可以说HL7协议格式的系统&#xff0c; HL7 over MLLP是一种非常常见的传输机制。 JBoss Fuse是一个非常强大的微服务样式集成平台&#xff0c;在为关键医疗保健提供者构建灵活&#xff0c;有弹性&#xff0c;高可用性的集成方案方面拥有良好的记录。 此外&#xff0c;在JCA…

android 包裹内容,Android开发中Bundle用法 包裹数据

SDK里是这样描述&#xff1a;A mapping from String values to various Parcelable types。它帮助我将数据打包传入intent里面&#xff0c;为使用这些数据提供了便利。protected void onListItemClick (ListView l, View v, int position, long id){super.onListItemClick(l, v…

安卓高级6 SnackBar

引言 文&#xff0f;李牧羊&#xff08;简书作者&#xff09; 原文链接&#xff1a;http://www.jianshu.com/p/2654e6bda3b1 著作权归作者所有&#xff0c;转载请联系作者获得授权&#xff0c;并标注“简书作者”。 在之前我有提到这一篇Android Design Support Library系列文章…

利用Aspose.Word控件实现Word文档的操作

Aspose系列的控件&#xff0c;功能都挺好&#xff0c;之前一直在我的Winform开发框架中用Aspose.Cell来做报表输出&#xff0c;可以实现多样化的报表设计及输出&#xff0c;由于一般输出的内容比较正规化或者多数是表格居多&#xff0c;所以一般使用Aspose.Cell来实现我想要的各…

html编码自动识别,html实体编码遇上js代码

摘要&#xff1a; 在js中单、双引号引起来的是字符串&#xff0c;如果我们要在字符串中使用单、双引号&#xff0c;需要反斜杠进行转义。而如果字符串出现在html标签中&#xff0c;我们需要做转义处理。单双引号在js代码中在js中单、双引号引起来的是字符串&#xff0c;如果我们…

Activiti中具有单独数据库模式的多租户

我们过去听到的一项功能请求是以多租户方式运行Activiti引擎&#xff0c;使租户的数据与其他租户的数据隔离。 当然&#xff0c;在某些云/ SaaS环境中&#xff0c;这是必须的。 几个月前&#xff0c;波恩大学的学生拉斐尔吉伦&#xff08;Raphael Gielen&#xff09;与我接触&…

html5自动把某个层放在屏幕底部,告诉你一个将 footer 保持在底部的最好方法

当你在布局网页时&#xff0c;有可能会遇到类似下面的这种情况broken_layout.png导致这一问题的原因是页面内容太少&#xff0c;无法将内容区域撑开&#xff0c;从而在 footer 下面留下一大块空白。本文将介绍一种现代化的方法&#xff0c;&#xfffd;确保 footer 始终处于页面…

html的扇形代码导航,CSS3--利用transform和transition属性制作扇形导航

在前面&#xff0c;我们已经讲解了transform这个属性以及案例&#xff0c;那么本文会进一步结合transform和transition两个属性&#xff0c;并制作一个简单的案例进行说明。一、transition属性说明接下来简单分析一下transition这个属性的定义以及子属性。1)ansition-property …

常见的误解:这会创建多少个对象?

总览 一个常见的问题是一段代码创建多少个对象或多少个字符串。 答案通常不是您的想法&#xff0c;也不是您真正需要知道的。 了解何时创建对象是很有用的&#xff0c;但是有很多其他因素通常要考虑的重要得多&#xff0c;这可能意味着应用程序总数不是您所想的。 字符串不是一…

cvs配电保护断路器_电工电器(三)-配电电器-断路器类-剩余电流保护断路器

本文文字836&#xff0c;阅读时间6分钟左右。此系列文章 从配电电器的大类等进行慢慢阐述&#xff0c;有不足的地方 欢迎大家相互探讨交流。配电电器&#xff0c;顾名思义就是进行电力分配的设备。电&#xff0c;从发电机出来之后&#xff0c;由总线输出&#xff0c;不可能直接…

delhpi7 tcombobox清楚重复项_专利数据统计中需要搞清楚的首要问题(2)

上一篇专利数据统计中需要搞清楚的首要问题(1)介绍了通过合并申请号避免重复统计&#xff0c;理清了专利篇数和专利件数的问题&#xff0c;那么还有一类统计就是对发明项数的统计&#xff0c;这里就涉及到对同一项发明的重复统计问题。上一篇介绍的相同申请号但不同公开号的专利…

【Electron】Electron开发入门(八):自定义electron框架外壳(shell)的菜单(Menu)...

1.自定义electron框架外壳&#xff08;shell&#xff09;的菜单&#xff08;Menu&#xff09; electron的main.js里代码&#xff1a; const Menu require(electron).Menu; var template [{label: 关闭,click: function () { win.close();console.log("关闭")},// s…

交通大数据应用细分_盈海科技 | 交通大数据可视化“掘金”数据价值

面对日益拥堵的交通状况智能交通布局虽在不断完善但交通管理依旧收效甚微问题究竟出在了哪里&#xff1f;数据独立存储难以融合应用数据内在规律难寻数据可视化程度低……问题繁多 困难重重怎么办&#xff1f;&#xff1f;&#xff1f;交通大数据可视化解决方案上岗啦&#xff…

书评– Kubernetes Up&Running,作者:Kelsey Hightower

欢呼&#xff01; 正如我在以前的帖子中所写的那样&#xff0c;当您开始研究和使用所有这些新颖的&#xff0c;有光泽的容器/编排技术时&#xff0c;很有可能最终导致您的翻译“迷失”。 很多信息&#xff0c;很多技术&#xff0c;很多开发 &#xff0c;很多承诺&#xff0c;很…

MFC CListCtrl

列名、行内容的添加、删除。 据列名、行内容长度设置列宽。 排序。 提升权限 BOOL CDemoListCtrlApp::EnableDebugPrivilege() { HANDLE token; if(!OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES,&token)) { return FALSE; } TOKEN_PRIVILEGES tkp…

快手用旺旺瓶子做机器人_100品牌入榜,在快手的品牌运营怎么做?|11月快手品牌新势力榜揭晓...

11月榜单见证了许多新入驻快手的品牌迅速成长。母婴品牌「安慕斯」实现垂类专业场景剧情化&#xff0c;引起用户发注&#xff0c;激发用户参与&#xff0c;单月涨粉突破60万&#xff1b;服饰箱包运动垂类下的珠宝品牌「DR钻戒」以“一生唯一真爱”的理念抢占消费者心智&#xf…

认识计算机ppt课件游戏,《认识计算机》PPT课件

《认识计算机》PPT课件 认知主义认为 学习是个体对环 境的作用&#xff0c;而并不仅是环境刺激引起的行为改变&#xff1b;环境只能提供潜在刺激&#xff0c;至于这些潜在刺激是否受到注意或被加工&#xff0c;这主要取决于学习者内部的认知结构。 认 识 计 算 机 认知主义认为…

BZOJ1433 ZJOI2009 假期的宿舍 二分图匹配

1433: [ZJOI2009]假期的宿舍 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 2375 Solved: 1005[Submit][Status][Discuss]Description Input Output Sample Input 1 3 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0Sample Output ˆ ˆHINT 对于30% 的数据满足1 ≤ n ≤ 12。对于100% 的…

Apache Spark中实现的MapReduce设计模式

该博客是该系列文章的第一篇&#xff0c;讨论了MapReduce设计模式一书中的一些设计模式&#xff0c;并展示了如何在Apache Spark&#xff08;R&#xff09;中实现这些模式。 在编写MapReduce或Spark程序时&#xff0c;考虑执行作业的数据流很有用。 即使Pig&#xff0c;Hive&a…

计算机主机风扇安装方法,电脑机箱怎么安装风扇减震胶钉保护主板cup?

炎炎夏日&#xff0c;是时候给你的爱机清清灰&#xff0c;特别是对于机箱散热不好的朋友就需要给电脑机箱装上几个风力强劲的风扇&#xff0c;这样可以大大减少CPU、主板等的老化时间&#xff0c;延长爱机的寿命。现在机箱风扇大都使用橡胶拉钉(或者叫减震钉、固定钉)安装&…