This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name dl.yongboy.com; | |
location ~ ^/downloads/(.*)$ { | |
charset utf-8; | |
alias D:/Document/$1; | |
internal; #阻止浏览器直接访问 | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.servlet3.demo; | |
import java.io.IOException; | |
import java.io.Writer; | |
import javax.servlet.ServletException; | |
import javax.servlet.annotation.WebServlet; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.learn.jsry166y.demo; | |
import jsr166y.RecursiveTask; | |
/** | |
* 斐波纳契数列求解<br/> | |
* 800年前,意大利的数学家斐波纳契出版了惊世之作《算盘书》。在《算盘书》里,他提出了著名的“兔子问题”:假定一对兔子每个月可以生一对兔子, | |
* 而这对新兔子在出生后第二个月就开始生另外一对兔子,这些兔子不会死去,那么一对兔子一年内能繁殖多少对兔子? | |
* 答案是一组非常特殊的数字:1,1,2,3,5,8, | |
* 13,21,34,55,89……不难发现,从第三个数起,每个数都是前两数之和,这个数列则称为“斐波纳契数列”,其中每个数字都是“斐波纳契数”。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.learn.jsry166y.demo; | |
/** | |
* 单线程版本的斐波纳契数列求解参考实现<br/> | |
* 800年前,意大利的数学家斐波纳契出版了惊世之作《算盘书》。在《算盘书》里,他提出了著名的“兔子问题”:假定一对兔子每个月可以生一对兔子, | |
* 而这对新兔子在出生后第二个月就开始生另外一对兔子,这些兔子不会死去,那么一对兔子一年内能繁殖多少对兔子? | |
* 答案是一组非常特殊的数字:1,1,2,3,5,8, | |
* 13,21,34,55,89……不难发现,从第三个数起,每个数都是前两数之和,这个数列则称为“斐波纳契数列”,其中每个数字都是“斐波纳契数”。 | |
* | |
* @author yongboy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.learn.jsry166y.demo; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.ExecutionException; | |
/** | |
* 单线程版本,改变递增式获取结果的算法 | |
* @author yongboy | |
* @time 2012-1-30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.learn.jsry166y.demo; | |
import java.util.concurrent.Future; | |
import jsr166y.ForkJoinPool; | |
import jsr166y.ForkJoinTask; | |
import org.junit.Test; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.learn.jsry166y.demo.queue; | |
import java.util.concurrent.TimeUnit; | |
import jsr166y.LinkedTransferQueue; | |
import jsr166y.Phaser; | |
import jsr166y.TransferQueue; | |
import junit.framework.Assert; | |
import org.junit.Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.learn.jsry166y.demo.random; | |
import java.util.ArrayList; | |
import java.util.List; | |
import jsr166y.Phaser; | |
import jsr166y.ThreadLocalRandom; | |
import junit.framework.Assert; | |
import org.junit.Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 用于执行ForkJoinTask | |
public class ForkJoinWorkerThread extends Thread { | |
final ForkJoinPool.WorkQueue workQueue; // 可以用于工作窃取的双端队列 | |
final ForkJoinPool pool; // 工作线程池 | |
protected ForkJoinWorkerThread(ForkJoinPool pool) { | |
super(pool.nextWorkerName()); | |
setDaemon(true); // 将该线程标记为守护线程 | |
Thread.UncaughtExceptionHandler ueh = pool.ueh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2011 sunli [[email protected]][weibo.com@sunli1223] | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |