<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[华丽的痘痘]]></title><description><![CDATA[努力成为一个有价值的程序员]]></description><link>https://blog.csdn.net/andycpp</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; andycpp]]></copyright><item><title><![CDATA[Java线程之fork/join框架]]></title><link>https://blog.csdn.net/andycpp/article/details/8903155</link><guid>https://blog.csdn.net/andycpp/article/details/8903155</guid><author>andycpp</author><pubDate>Fri, 10 May 2013 17:55:26 +0800</pubDate><description><![CDATA[fork/join框架是用多线程的方式实现分治法来解决问题。fork指的是将问题不断地缩小规模，join是指根据子问题的计算结果，得出更高层次的结果。
fork/join框架的使用有一定的约束条件：

1. 除了fork()  和  join()方法外，线程不得使用其他的同步工具。线程最好也不要sleep()
2. 线程不得进行I/O操作
3. 线程不得抛出checked excepti]]></description><category></category></item><item><title><![CDATA[Java线程之CompletionService]]></title><link>https://blog.csdn.net/andycpp/article/details/8902699</link><guid>https://blog.csdn.net/andycpp/article/details/8902699</guid><author>andycpp</author><pubDate>Wed, 08 May 2013 22:03:00 +0800</pubDate><description><![CDATA[当使用ExecutorService启动了多个Callable后，每个Callable会产生一个Future，我们需要将多个Future存入一个线性表，用于之后处理数据。当然，还有更复杂的情况，有5个生产者线程，每个生产者线程都会创建任务，所有任务的Future都存放到同一个线性表中。另有一个消费者线程，从线性表中取出Future进行处理。
CompletionService正是为此而存在，它是]]></description><category></category></item><item><title><![CDATA[Java线程之FutureTask]]></title><link>https://blog.csdn.net/andycpp/article/details/8902655</link><guid>https://blog.csdn.net/andycpp/article/details/8902655</guid><author>andycpp</author><pubDate>Wed, 08 May 2013 21:50:23 +0800</pubDate><description><![CDATA[FutureTask是Future和Callable的结合体。传统的代码是这样写的
Future f = executor.submit(new Callable());
然后通过Future来取得计算结果。但是，若开启了多个任务，我们无从知晓哪个任务最先结束，因此，若要实现“当某任务结束时，立刻做一些事情，例如记录日志”这一功能，就需要写一些额外的代码。
FutureTask正是为此而存在]]></description><category></category></item><item><title><![CDATA[Java线程之立刻处理刚完成的任务]]></title><link>https://blog.csdn.net/andycpp/article/details/8863184</link><guid>https://blog.csdn.net/andycpp/article/details/8863184</guid><author>andycpp</author><pubDate>Sun, 28 Apr 2013 13:58:55 +0800</pubDate><description><![CDATA[ExecutorService的invokeAll()方法可以一次启动多个线程，并将这些线程的执行结果放入一个List。这是一个很方便的方法，但有不足之处，那就是必须等待所有线程全部结束之后，才会返回List，之后才能处理线程的结果。若有些线程执行很快，比如几秒就结束了，另一些线程执行很慢，要几小时，那么短时间线程的执行结果仍然无法立刻获取，必须等几小时之后，所有线程都结束了，他们的执行结果才可用]]></description><category></category></item><item><title><![CDATA[Java线程之ExecutorService.invokeAny()]]></title><link>https://blog.csdn.net/andycpp/article/details/8862263</link><guid>https://blog.csdn.net/andycpp/article/details/8862263</guid><author>andycpp</author><pubDate>Sun, 28 Apr 2013 10:49:17 +0800</pubDate><description><![CDATA[有一类多线程编程模式是这样的：启动多个线程，相互独立的（无同步）去计算一个结果，当某一个线程得到结果之后，立刻终止所有线程，因为只需要一个结果就够了。
实际应用场景：作为男生，电脑上必须有苍老师的爱情动作片。这种片子必须藏得非常隐蔽，隐蔽到什么程度呢？自己都忘了把它藏哪里了，这可咋办啊？编写多线程程序，针对每一个硬盘分区，启动一个线程，搜索该硬盘分区上的所有文件，找名字中含有“苍老师”的文件。由]]></description><category></category></item><item><title><![CDATA[Java线程之Exchanger]]></title><link>https://blog.csdn.net/andycpp/article/details/8854593</link><guid>https://blog.csdn.net/andycpp/article/details/8854593</guid><author>andycpp</author><pubDate>Fri, 26 Apr 2013 15:22:50 +0800</pubDate><description><![CDATA[Exchanger可以在两个线程之间交换数据，只能是2个线程，他不支持更多的线程之间互换数据。
当线程A调用Exchange对象的exchange()方法后，他会陷入阻塞状态，直到线程B也调用了exchange()方法，然后以线程安全的方式交换数据，之后线程A和B继续运行
public class ThreadLocalTest {

	public static void main(Stri]]></description><category></category></item><item><title><![CDATA[Java线程之ThreadLocal]]></title><link>https://blog.csdn.net/andycpp/article/details/8854275</link><guid>https://blog.csdn.net/andycpp/article/details/8854275</guid><author>andycpp</author><pubDate>Fri, 26 Apr 2013 14:43:52 +0800</pubDate><description><![CDATA[ThreadLocal的功能是实现一个线程独立的全局变量。
使用全局变量的好处是，程序的任何地方都可以使用它，而无需进行参数传递。
在单线程环境下，将类的属性和方法定义为static，即可实现全局变量。
但是在多线程环境下，普通的全局变量是线程间共享的，一个线程修改了全局变量的值，另一个线程可以看到这个修改。
使用ThreadLocal实现全局变量，即保留了随处可用这一优点，又能做到线程间]]></description><category></category></item><item><title><![CDATA[Java线程之Phaser]]></title><link>https://blog.csdn.net/andycpp/article/details/8838820</link><guid>https://blog.csdn.net/andycpp/article/details/8838820</guid><author>andycpp</author><pubDate>Tue, 23 Apr 2013 11:27:36 +0800</pubDate><description><![CDATA[Phaser是一个灵活的线程同步工具，他包含了CyclicBarrier和CountDownLatch的相关功能
       首先，来看一下如何用Phaser替代CountDownLatch。对于CountDownLatch而言，有2个重要的方法，一个是await()方法，可以使线程进入等待状态，在Phaser中，与之对应的方法是awaitAdvance(int
 n)。CountDownL]]></description><category></category></item><item><title><![CDATA[Java线程之CyclicBarrier]]></title><link>https://blog.csdn.net/andycpp/article/details/8592317</link><guid>https://blog.csdn.net/andycpp/article/details/8592317</guid><author>andycpp</author><pubDate>Tue, 19 Feb 2013 20:53:27 +0800</pubDate><description><![CDATA[CountDownLatch和CyclicBarrier都能在线程执行时设置中间等待位置，表面上看相似度很高，下面讲讲他们的区别：
    CountDownLatch是线程A等待B。它有着明确的顺序，A先执行，到中间等待位置后，A调用countDown()方法，激活B，B才开始执行。再强调一下，这个类强调顺序，A先，B后
    CyclicBarrier是线程间互相等待，即A和B互相等待，]]></description><category></category></item><item><title><![CDATA[Java实现希尔排序]]></title><link>https://blog.csdn.net/andycpp/article/details/8586381</link><guid>https://blog.csdn.net/andycpp/article/details/8586381</guid><author>andycpp</author><pubDate>Sun, 17 Feb 2013 23:00:15 +0800</pubDate><description><![CDATA[希尔排序步长的选择很重要，不同的选择方式性能差异很大。为了做实验，生成一个长度为 0x400000（该数字为16进制）随机的整形数组，存放于硬盘上的文本文件内。每次排序均将此数组读入内存后，再排序，再将排序结果写入硬盘文件。只对排序操作计时，读文件和写文件不计时。
步长选择方式为最基本的1,2,4,8,16,32,64...size/2
在我的测试中，排序耗时7150毫秒


	priv]]></description><category></category></item><item><title><![CDATA[Java线程之CountDownLatch]]></title><link>https://blog.csdn.net/andycpp/article/details/8582003</link><guid>https://blog.csdn.net/andycpp/article/details/8582003</guid><author>andycpp</author><pubDate>Fri, 15 Feb 2013 23:12:02 +0800</pubDate><description><![CDATA[CountDownLatch是一个高级的线程同步工具，可以理解为一个闸门，先运行一些线程，计算出一些结果，满足条件后，开闸，然后另一些线程启动。换句话说，它将多个线程分为2类，一类开闸前运行，一类开闸后运行。
对于开闸后运行的线程，调用await()方法后，进入等待状态，等待开闸。它内部有一个计数器，初始状态计数器为用户设定的正整数，当开闸前某个线程运行完毕后，调用它的countDown()方法]]></description><category></category></item><item><title><![CDATA[Java线程之Semaphore]]></title><link>https://blog.csdn.net/andycpp/article/details/8580186</link><guid>https://blog.csdn.net/andycpp/article/details/8580186</guid><author>andycpp</author><pubDate>Wed, 13 Feb 2013 21:15:19 +0800</pubDate><description><![CDATA[之前一直对Semaphore不是很理解，感觉它功能十分简单，用Lock加Condition完全可以轻易替代它，觉得它根本没有存在的必要。最近遇到一个例子，用Semaphore可以优雅的实现，用Lock加Condition却让我大费脑筋，主要原因是自己水平太菜。记录下来，免得以后忘了。
例子：某单位有3台打印机，有10个用户提交打印任务，写程序模拟对打印机的管理。不废话，直接上代码

publ]]></description><category></category></item><item><title><![CDATA[对一个整数用加法进行分解]]></title><link>https://blog.csdn.net/andycpp/article/details/7192919</link><guid>https://blog.csdn.net/andycpp/article/details/7192919</guid><author>andycpp</author><pubDate>Wed, 11 Jan 2012 10:42:32 +0800</pubDate><description><![CDATA[比如输对于整数5，分解的结果为：
5 = 4 + 1
5 = 3 + 2
5 = 3 + 1 + 1
5 = 2 + 2 + 1
5 = 2 + 1 + 1 + 1
5 = 1 + 1 + 1 + 1 + 1
    private static void splitInteger(int n) {
        if(n10) {
            System.out.p]]></description><category></category></item><item><title><![CDATA[堆排序算法]]></title><link>https://blog.csdn.net/andycpp/article/details/6439337</link><guid>https://blog.csdn.net/andycpp/article/details/6439337</guid><author>andycpp</author><pubDate>Mon, 23 May 2011 12:01:00 +0800</pubDate><description><![CDATA[终于整明白啥是堆排序了，原来堆只是个幻象，是个虚拟模型，不必要真的弄一棵树出来，直接操作的对象仍然是数组。若要升序排序，则构造大顶堆，每次将堆顶元素删除后放置到堆尾的后一个位置，堆不断缩小。直接上代码	/**
	 * 堆排序演示程序
	 */
	public static void main(String[] args) {
		int[] a = createArray(20);
		System.out.println(Arrays.toString(a));
		heapSort(a);]]></description><category></category></item><item><title><![CDATA[找出符合条件的组合]]></title><link>https://blog.csdn.net/andycpp/article/details/5914247</link><guid>https://blog.csdn.net/andycpp/article/details/5914247</guid><author>andycpp</author><pubDate>Wed, 29 Sep 2010 14:29:00 +0800</pubDate><description><![CDATA[将0~9共10个数字填入下面的表达式，使得该表达式成立。找出所有可能的情况。【 】【 】【 】 + 【 】【 】【 】 = 【 】【 】【 】【 】public class MainTest {
	public static void main(String[] args) {
		showAllResult(10);
	}
	
	private static void showAllResult(int num) {
		int[] nums = new int[num];
		findAl]]></description><category></category></item><item><title><![CDATA[小技巧]]></title><link>https://blog.csdn.net/andycpp/article/details/5913497</link><guid>https://blog.csdn.net/andycpp/article/details/5913497</guid><author>andycpp</author><pubDate>Wed, 29 Sep 2010 09:51:00 +0800</pubDate><description><![CDATA[<br />在新闻标题中加入“new”标志："  <img src=/jwch/info/images/new03.gif  border=none>"]]></description><category></category></item><item><title><![CDATA[如何重载equals方法]]></title><link>https://blog.csdn.net/andycpp/article/details/5909954</link><guid>https://blog.csdn.net/andycpp/article/details/5909954</guid><author>andycpp</author><pubDate>Mon, 27 Sep 2010 16:18:00 +0800</pubDate><description><![CDATA[<br />1、参数是Object类型的，将参数命名为otherObject<br />2、检测两个引用是否指向同一个对象<br />if (this == otherObject) return true;<br />3、如果otherObject是null，则返回false<br />if (otherObject == null) return false; <br />4、比较两个对象是否属于同一个类<br />if (getClass() != otherObject.getClass()) re]]></description><category></category></item><item><title><![CDATA[JAVA格式化字符串速查]]></title><link>https://blog.csdn.net/andycpp/article/details/5906041</link><guid>https://blog.csdn.net/andycpp/article/details/5906041</guid><author>andycpp</author><pubDate>Sat, 25 Sep 2010 22:17:00 +0800</pubDate><description><![CDATA[<br />语法规则：<br />%[argument_index$][flags][width][.precision]conversion<br /><br />正规使用方法：<br />StringBuilder sb = new StringBuilder();
Formatter formatter = new Formatter(sb, Locale.US);
formatter.format("%4$2s %3$2s %2$2s %1$2s", "a", "b", "c", "d")<br]]></description><category></category></item><item><title><![CDATA[取得汉字拼音]]></title><link>https://blog.csdn.net/andycpp/article/details/5871258</link><guid>https://blog.csdn.net/andycpp/article/details/5871258</guid><author>andycpp</author><pubDate>Wed, 08 Sep 2010 16:22:00 +0800</pubDate><description><![CDATA[<br />用输入法生成器
<br />
"C:/Program Files/Windows NT/Accessories/Imegen.exe"
<br />
逆转换拼音输入法文件C:/WINNT/SYSTEM32/WINPY.MB
<br />
会生成一个同名的TEXT文件]]></description><category></category></item><item><title><![CDATA[mysql环境变量]]></title><link>https://blog.csdn.net/andycpp/article/details/5862942</link><guid>https://blog.csdn.net/andycpp/article/details/5862942</guid><author>andycpp</author><pubDate>Sat, 04 Sep 2010 11:29:00 +0800</pubDate><description><![CDATA[<br />通过  show variables like "sql_safe_updates"  查看环境变量的当前值<br />通过  set sql_select_limit = 0;  修改环境变量<br />mysql手册的5.1.4小节是环境变量介绍]]></description><category></category></item></channel></rss>