- 博客(27)
- 资源 (3)
- 收藏
- 关注
原创 知识库--synchronized集合+Concurrent集合 (91)
宏观上: Using synchronized collections is like driving through a traffic light–controlled intersection; concurrent collection is like an uncongested freeway(高速公路).同步Synchronized(悲观锁:认为别人一定会改变—数据,排他性,相当悲观
2017-01-24 10:36:50 555
翻译 技能库--统计文件大小 +Fork-Join(90)
ExecutorService manages a pool of thread and allows us to schedule tasks for execution by threads in its pool. It is however, up to us to decide how many threads will be in the pool, and there is no di
2017-01-23 08:42:38 408
原创 技能库--统计文件大小 + ExchangeData+BlockingQueue(89)
主线程负责不断的汇总结果,pool线程池负责explore每个文件或者目录,并不断的put结果到线程交换数据的–BlockingQueue package com.qunar.finance.paper.countFileSize;import java.io.File;import java.util.concurrent.*;import java.util.concurrent.atomi
2017-01-22 08:40:49 332
原创 技能库--统计文件大小 + CountDownLatch(87)
使用countdownlatch工具public class CountdownLatch0 { private ExecutorService service; final private AtomicLong pendingFileVisits = new AtomicLong(); final private AtomicLong totalSize = new Ato
2017-01-20 08:48:59 290
原创 技能库--统计文件大小 + Executors+Future(86)
1 首先使用单线程来计算 文件的总大小public class TotalFileSizeSequential { private long getTotalSizeOfFilesInDir(final File file){ if(file.isFile()) return file.length(); final File[] chi
2017-01-19 23:55:48 555
原创 知识库--Concurrency+ThreadPool+Executors(79)
阻塞系数=0.9 四核处理器public abstract class AbstractNAV { public static Map<String, Integer> readTickers() throws IOException { final BufferedReader reader = new BufferedReader(new
2017-01-12 20:16:25 239
原创 HOW--如何评估线程池线程的个数(79)
堵塞系数 blocking coefficient 创建的线程数量 = 1 ÷ (1-blocking coefficient)
2017-01-12 14:34:31 873
翻译 知识库--Tomcat+Shutdown+Hook(76)
In a Tmocat deployment you start the servlet container by instantiating a Server object and call its start method, which in turn calls the start method of other components. In a normal situation, to gi
2017-01-11 08:36:47 387
原创 面试--java+数据转型(76)
public static void main(String[] args) { double x =1; double y =33.33; System.out.println((short)x/y*2); }输出的数据类型是什么类型的? 答案:0.06000600060006001
2017-01-11 08:15:22 304
原创 面试--Tomcat+一个请求的完整过程(76)
Tomcat处理一个HTTP请求的过程 假设来自客户的请求为: http://localhost:8080/yy/index.jsp 1) 请求被发送到本机端口8080,被在那里侦听的Coyote HTTP/1.1 Connector获得 2) Connector把该请求交给它所在的Service的Engine来处理,并等待来自Engine的回应 3) Engine获得请求localh
2017-01-11 00:37:30 5282
原创 知识库--Concurrency+Determining the Number of Threads(76)
Determining the Number of Threads //线程数量是计算出来的 绝不是猜测出来的,dubbo的超时时间,重试次数亦如此For a large problem, we’d want to have at least as many threads as the number of available cores. This will ensure that as ma
2017-01-11 00:21:44 671
原创 面试--单例模式(75)
1 直接初始化public class Singleton { /** 单例变量 ,static的,在类加载时进行初始化一次,保证线程安全 */ private static Singleton instance = new Singleton(); /** * 私有化的构造方法,保证外部的类不能通过构造器来实例化。 */ private
2017-01-10 00:09:28 340
原创 面试--排序(75)
public class BubbleQuickSort { public void bubbleSort() { int a[] = {49, 28, 65, 97, 76, 13, 27, 49, 78, 34, 12, 64, 5, 2, 62, 99, 56, 17, 18, 23, 34, 15, 23, 53, 51}; int temp = 0;
2017-01-09 13:48:41 295
原创 面试--金融支付(75)
1 去支付: 获取支付URL,token,签名 2 支付前校验内容: 校验订单状态; 锁定库存; 校验签名; 校验支付流水; 3 输入密码,支付 4 支付结果回调
2017-01-09 13:17:06 574
翻译 知识库--Concurrent+division+labor(75)
Division of Labor 【The most effective way to do it is to do it. . Amelia Earhart】Is the speedup going to be in proportion to the
2017-01-09 08:37:42 189
翻译 知识库--Web+Digester(73)
Creating Web DigesterA Digester object reference called webDigester exists in the ContextConfig class:private static Digester webDigester = createWebDigester();This Digester is used to parse the defau
2017-01-07 23:42:51 326
翻译 知识库--Digester + ContextConfig(73)
Digester + ContextConfigUnlike other types of containes, a StandardContext must have a listener. This listener configures the StandardContext instance and upon successfully doing so sets the StandardCo
2017-01-07 22:26:34 351
翻译 知识库--Digester+RuleSet(73)
Another way of adding rules to a Digester instance is by calling its addRuleSet method. The signature of this method is as follows:public void addRuleSet(RuleSet ruleSet)The org.apache.commons.digeste
2017-01-07 20:16:34 584
翻译 知识库--Digester+Rules(73)
A rule specifies an action or a couple of actions that the Digester must do upon encountering a particular pattern. A rule is represented by the org.apache.commons.digester.Rule class. The Digester cla
2017-01-07 11:19:32 507
翻译 知识库--Digester(72)
1 where will use digester? A context represents a Web application, therefore the configuration of a web application is achieved through configuring the instantiated Context instance. The XML file us
2017-01-06 08:47:47 303
翻译 知识库--Zookeeper ZkCli tool 实现-应用实例(71)
A 客户端成为master的过程1 启动server端 [~/zookeeper]$ ../zookeeper-3.4.9/bin/zkServer.sh start ../z1/z1.cfg2 启动cli端 [~/zookeeper]$ ../zookeeper-3.4.9/bin/zkCli.sh -server 27.0.0.1:2180,127.0.0.1:2182,127.0.0.1:
2017-01-05 14:07:00 295
翻译 知识库--Power of Concurrency (71)
The Power of Concurrency 1 Making Apps More Responsive Not only can threads help make applications responsive, but they can help enhance the user experience. Applications can look ahead at operation
2017-01-04 23:30:35 278
翻译 知识库--StandardService + Lifecycle(start/stop)+initialize(72)
StandardService + Lifecycle(start/stop)+initializeThe lifecycle methods are the start and the stop methods inherited from the Lifecycle interface plus the initialize method.//initialize method calls th
2017-01-04 00:31:20 322
翻译 知识库--Garbage Collection Types(71)
When the young generation fills up, a young generation of just that generation is performed. When the old or permanent generation fills up, what is known as a full collection is typically done. That
2017-01-04 00:02:43 401
翻译 知识库--GC+CMS(70)
Concurrent Mark-Sweep (CMS) CollectorFor many applications, end-to-end throughput is not as important as fast response time. Young generation collections do not typically cause pauses. Howerver, old ge
2017-01-03 08:41:57 415
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人