java²¢·¢±à³Ì Executor¿ò¼Ü1
Executor¿ò¼ÜÊÇÖ¸java 5ÖÐÒýÈëµÄһϵÁв¢·¢¿âÖÐÓëexecutorÏà¹ØµÄһЩ¹¦ÄÜÀ࣬ÆäÖаüÀ¨Ï̳߳أ¬Executor£¬Executors£¬ExecutorService£¬CompletionService£¬Future£¬CallableµÈ¡£ËûÃǵĹØϵΪ£º
²¢·¢±à³ÌµÄÒ»ÖÖ±à³Ì·½Ê½ÊÇ°ÑÈÎÎñ²ð·ÖΪһЩÁеÄСÈÎÎñ£¬¼´Runnable£¬È»ºóÔÚÌá½»¸øÒ»¸öExecutorÖ´ÐУ¬Executor.execute(Runnalbe) ¡£ExecutorÔÚÖ´ÐÐʱʹÓÃÄÚ²¿µÄÏ̳߳ØÍê³É²Ù×÷¡£
Ò»¡¢´´½¨Ï̳߳Ø
ExecutorsÀ࣬ÌṩÁËһϵÁй¤³§·½·¨ÓÃÓÚ´´ÏÈÏ̳߳أ¬·µ»ØµÄÏ̳߳ض¼ÊµÏÖÁËExecutorService½Ó¿Ú¡£
public static ExecutorService newFixedThreadPool(int nThreads)
´´½¨¹Ì¶¨ÊýÄ¿Ï̵߳ÄÏ̳߳ء£
public static ExecutorService newCachedThreadPool()
´´½¨Ò»¸ö¿É»º´æµÄÏ̳߳أ¬µ÷ÓÃexecute ½«ÖØÓÃÒÔÇ°¹¹ÔìµÄỊ̈߳¨Èç¹ûÏ߳̿ÉÓã©¡£Èç¹ûÏÖÓÐÏß³ÌûÓпÉÓõģ¬Ôò´´½¨Ò»¸öÐÂÏ̲߳¢Ìí¼Óµ½³ØÖС£ÖÕÖ¹²¢´Ó»º´æÖÐÒƳýÄÇЩÒÑÓÐ 60 ÃëÖÓδ±»Ê¹ÓõÄÏ̡߳£
public static ExecutorService newSingleThreadExecutor()
´´½¨Ò»¸öµ¥Ï̻߳¯µÄExecutor¡£
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize)
´´½¨Ò»¸öÖ§³Ö¶¨Ê±¼°ÖÜÆÚÐÔµÄÈÎÎñÖ´ÐеÄÏ̳߳أ¬¶àÊýÇé¿öÏ¿ÉÓÃÀ´Ìæ´úTimerÀà¡£
Java´úÂë
Executor executor = Executors.newFixedThreadPool(10);
Runnable task = new Runnable() {
@Override
public void run() {
System.out.println("task over");
}
};
executor.execute(task);
executor = Executors.newScheduledThreadPool(10);
ScheduledExecutorService scheduler = (ScheduledExecutorService) executor;
scheduler.scheduleAtFixedRate(task, 10, 10, TimeUnit.SECONDS);
Executor executor = Executors.newFixedThreadPool(10);
Runnable task = new Runnable() {
@Override
public void run() {
System.out.println("task over");
}
};
executor.execute(task);
executor = Executors.newScheduledThreadPool(10);
ScheduledExecutorService scheduler = (ScheduledExecutorS
Ïà¹ØÎĵµ£º
ÓÐʱ£¬ÎÒÃÇÔÚдһ¸ö¹¹Ô캯Êýʱ£¬¾³£ÒòΪËü°üº¬ÖÚ¶àµÄ²ÎÊý¶ø¿àÄÕ,Õâʱ¿ÉÒÔ¿¼ÂÇÓÃBuilderģʽÀ´´´½¨¶ÔÏó¡£
È磬ÎÒÃÇÒªÉè¼ÆÒ»¸öÓªÑø³É·ÝµÄÀ࣬°üº¬ÄÜÁ¿£¬µ°°×ÖÊ£¬Ö¬·¾£¬¸Æ£¬Ìú£¬Ð¿£¬Î¬ÉúËØA, άÉúËØB1 ... µÈ£¬µ«ÔÚ¹¹ÔìµÄʱºò£¬²»Ò»¶¨Ã¿´Î¶¼ÐèÒªÕâЩ²ÎÊý£¬Èç¸Æ£¬Ìú£¬Ð¿ºÍάÉúËصÈÊÇ¿ÉÑ¡µÄ£¬ÎªÁËÊÊÓ¦¶àÖÖ¿ÉÄܵĴîÅ䣬±È½ÏÔʼ ......
javaÖеÄËÄÖÖÀàÐ͵ļ¯ºÏÀà
£¨1£©Vector £¨2£©BitSet£¨3£©Stack£¨4£©HashTable
2ö¾ÙÆ÷
ÔÚÈκμ¯ºÏÀàÖУ¬±ØÐëͨ¹ýijÖÖ·½·¨ÔÚÆäÖÐÖÃÈë¶ÔÏó£¬ÔÙÓÃÁíÒ»ÖÖ·½·¨´ÓÖÐÈ¡µÃ¶ÔÏó¡£ÔÚVectorÖУ¬addElement()¾ÍÊÇÎÒÃDzåÈë¶ÔÏó²ÉÓõķ½·¨
£¬¶þelementAt()ÔòÊÇÌáÈ¡¶ÔÏóµÄΨһ·½·¨¡£
Iterator¿ÉÒÔ´ïµ½Õâ¸öÄ¿µÄ£¬ËüÊÇÒ»¸ö¶ÔÏó£¬×÷ÓÃÊDZ ......
Ò»¡¢BorderLayoutTest.java
package com.briup.md08;
import java.awt.*;
import javax.swing.*;
/*BorderLayoutÌصã
1¡¢×é¼þµÄ´óСÓÉÈÝÆ÷¾ö¶¨
2¡¢ÈÝÆ÷±»»®·ÖΪ5¸öÇøÓò£¬Ã¿¸öÇøÓòÖ»ÄÜÖ±½Ó¼ÓÈë3¸ö×é¼þ
3¡¢×é¼þ¼ÓÈëµÄλÖÃÐèÒªÖ¸¶¨£¬Ä¬ÈÏΪCENTER
4¡¢×é¼þÖ®¼äĬÈÏûÓмä϶
5¡¢Èç¹û³ýCENTER ÒÔÍâµÄÇøÓòûÓмÓÈë×é¼þ£¬Æ ......
package com.shxy.code;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
i ......
ÓÃJavaÁ¬½ÓSQL Server2000Êý¾Ý¿âÓжàÖÖ·½·¨£¬ÏÂÃæ½éÉÜÆäÖÐ×î³£ÓõÄÁ½ÖÖ£¨Í¨¹ýJDBCÇý¶¯Á¬½ÓÊý¾Ý¿â£©¡£
1. ͨ¹ýMicrosoftµÄJDBCÇý¶¯Á¬½Ó¡£´ËJDBCÇý¶¯¹²ÓÐÈý¸öÎļþ£¬·Ö±ðÊÇmssqlserver.jar¡¢msutil.jarºÍmsbase.jar£¬¿ÉÒÔµ½Î¢ÈíµÄÍøվȥÏÂÔØ£¨http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B ......