¶à·¹é²¢ÅÅÐò¡¾JAVAʵÏÖ¡¿
¶ÔÔ¶Ô¶´óÓÚÄÚ´æµÄÊý¾Ý½øÐÐÍâÅÅÐò£¬Ôڶ෱ȽϵÄʱºòÓðÜÕßÊ÷ЧÂÊ»á¸ü¸ß¡£
package my.sort;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Random;
/**
* »ùÓÚ´óÊý¾ÝÁ¿µÄÍâÅÅÐòËã·¨£¬·ÖΪ¶þ·¹ó±öºÍ¶à·¹é²¢
* @author java2king
* @link http://blog.csdn.net/Java2King
*
*/
public class ExternalSort {
public static int ITEM_COUNT = 10000000; //×ÜÊý
public static int BUFFER_SIZE = 1024*4*1000;// Ò»´Î»º³å¶ÁÈ¡
public static int FILE_COUNT = 1024*1000*1*4;// ÿ¸öÎļþµÄ¼Ç¼Êý1
public static File MAIN_FILE = new File("mainset");//ÒªÅÅÐòµÄÎļþ
/**
* ¶þ·¹é²¢
* @param file
* @return
* @throws IOException
*/
public File sort(File file) throws IOException {
ArrayList<File> files = split(file);
return process(files);
}
/**
* ¶à·¹é²¢
* @param file
* @throws IOException
*/
public void mSort(File file) throws IOException{
ArrayList<File> files = split(file);
multipleMerge(files);
}
// recursive method to merge the lists until we are left with a
// single merged list
private File process(ArrayList<File> list) throws IOException {
if (list.size() == 1) {
return list.get(0);
}
ArrayList<File> inter = new ArrayList<File>();
for (Iterator<File> itr = list.iterator(); itr.hasNext();) {
File one = itr.next();
if (itr.hasNext()) {
File two = itr.next();
inter.add(merge(one, two)
Ïà¹ØÎĵµ£º
ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖƵÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......
The Java virtual machine defines various runtime data areas that are used during execution of a program. Some of these data areas are created on Java virtual machine start-up and are destroyed only when the Java virtual machine exits. Other data areas are per thread. Per-thread data areas are create ......
»·¾³£ºÊý¾Ý¿âsql server2005£¬jdk1.6 £¬myeclipse£¬Çý¶¯jdts1.2.2
Ö´ÐÐÒÔÏ´úÂ룬±¨´í£º
String querySQL = "{?=call p_sys_manager_csReport(?,?,?,?,?)}";
cstmt = conn.prepareCall(querySQL);
cstmt.registerOutParameter(1, java.sql.Types.INTEGER);
cstmt.setInt(2, modType);
cstmt.setInt(3, dptI ......
1¡¢´´½¨ Statement ¶ÔÏó
½¨Á¢Á˵½Ìض¨Êý¾Ý¿âµÄÁ¬½ÓÖ®ºó£¬¾Í¿ÉÓøÃÁ¬½Ó·¢ËÍ SQL Óï¾ä¡£Statement ¶ÔÏóÓà Connection µÄ·½·¨ createStatement ´´½¨£¬ÈçÏÂÁдúÂë¶ÎÖÐËùʾ£º
Connection con = DriverManager.getConnection(url, "sunny", "");
Statement stmt = con.createStatement();
ΪÁËÖ´ÐÐ Statement ¶ÔÏ󣬱»· ......
http://school.itzcn.com/special-spid-50.html
Òì³£¸úÆÕͨµÄ¾¯¸æµÈÓÐÒ»¶¨µÄÇø±ð¡£µ±Ó¦ÓóÌÐò·¢ÉúÒ쳣ʱ£¬»áÖжÏÕýÔÚÖ´ÐеijÌÐòµÄÕý³£Ö¸ÁîÁ÷¡£Ò²¾ÍÊÇ˵£¬·¢ÉúÒì³£ºóÃæµÄ´úÂ뽫µÃ²»µ½ÕýÈ·µÄÖ´ÐС£ÉõÖÁ»¹»á´¥·¢Êý¾Ý¿âµÄ»ØÍ˲Ù×÷¡£
¡¡¡¡ÔÚJava¿ª·¢Æ½Ì¨ÖУ¬Òì³£°üÀ¨Ô¤¶¨ÒåÒì³£Óë×Ô¶¨ÒåÒì³£¡£ÕâÁ½ÖÖÒì³£µÄÀàÐÍ»¥Îª²¹³ä¡£×÷Ϊһ ......