在Java/J2EE(比如Struts2/Spring/Hibernate)实际项目中有用过多线程吗?比如java.util.concurrent包? 都实现什么功能?用了那些API? |
|
10分 |
用的比较多的是线程池,线程参数不要共享,由多线程调度程序分配数据。
|
你说的线程池指的是什么?怎么实现? |
|
5分 |
java.util.concurrent.Executors
|
5分 |
Concurrency Utilities for Java EE sample:
/** * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. * * You may not modify, use, reproduce, or distribute this software except in * compliance with the terms of the License at: * http://java.net/projects/javaeetutorial/pages/BerkeleyLicense */ package javaeetutorial.concurrency.jobs.service; import java.util.UUID; /** private final static Logger logger = Logger.getLogger(JobService.class.getCanonicalName()); @EJB @GET @POST try { return Response.status(Response.Status.OK).entity(“Job ” + jobID + ” successfully submitted.”).build(); static class JobTask implements Runnable { private final String jobID; public JobTask(String id) { @Override |
5分 |
/**
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. * * You may not modify, use, reproduce, or distribute this software except in * compliance with the terms of the License at: * http://java.net/projects/javaeetutorial/pages/BerkeleyLicense */ package javaeetutorial.concurrency.jobs.service; import java.io.Serializable; /** private final List<String> store; public TokenStore() { @Lock(LockType.WRITE) @Lock(LockType.READ) |
5分 |
线程池 的调用 。
|
5分 |
怕说的不详细,百度了下,这个比较详细 http://www.cnblogs.com/riskyer/p/3263032.html |
5分 |
不需要 。平台做多线程,http连接池,数据库连接池等,而90%的应用(你开发的)都是单线程的
|