<commit_before>/*
 * @(#)HandlerFactory.java		       version: 0.1 
 * Date:2012-2-11
 *
 * Copyright (c) 2011 CFuture09, Institute of Software, 
 * Guangdong Ocean University, Zhanjiang, GuangDong, China.
 * All rights reserved.
 */
package com.lurencun.cfuture09.androidkit.utils.thread;

import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;

import com.lurencun.cfuture09.androidkit.utils.lang.IdGenerator;
import com.lurencun.cfuture09.androidkit.utils.lang.IncreaseIntId;

/**
 * 线程工厂类。
 * 
 * @author Geek_Soledad (<EMAIL>)
 */
public class HandlerFactory {
	private static IdGenerator<Integer> id = new IncreaseIntId();

	private HandlerFactory() {

	}

	/**
	 * 获取新的后台Handler对象。
	 * 
	 * @param name
	 *            线程名字。
	 * @return 在新线程运行的Handler对象。
	 */
	public static Handler newBackgroundHandler(String name) {
		HandlerThread thread = new HandlerThread(name);
		thread.start();
		return new Handler(thread.getLooper());<commit_msg>fixed bug for NullPointerException<commit_after>/*
 * @(#)HandlerFactory.java		       version: 0.1 
 * Date:2012-2-11
 *
 * Copyright (c) 2011 CFuture09, Institute of Software, 
 * Guangdong Ocean University, Zhanjiang, GuangDong, China.
 * All rights reserved.
 */
package com.lurencun.cfuture09.androidkit.utils.thread;

import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;

import com.lurencun.cfuture09.androidkit.utils.lang.IdGenerator;
import com.lurencun.cfuture09.androidkit.utils.lang.IncreaseIntId;

/**
 * 线程工厂类。
 * 
 * @author Geek_Soledad (<EMAIL>)
 */
public class HandlerFactory {
	private static IdGenerator<Integer> id = new IncreaseIntId();

	private HandlerFactory() {

	}

	/**
	 * 获取新的后台Handler对象。
	 * 
	 * @param name
	 *            线程名字。
	 * @return 在新线程运行的Handler对象。
	 */
	public static Handler newBackgroundHandler(String name) {
		HandlerThread thread = new HandlerThread(name);
		thread.run();
		return new Handler(thread.getLooper());
{'fraction_non_alphanumeric': 0.11973617453069507, 'fraction_numerical': 0.0213089802130898, 'mean_word_length': 4.108808290155441, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6990846', 'n_tokens_mistral': 744, 'n_tokens_neox': 671, 'n_words': 136}