JavaÖÐTimerµÄʹÓÃ
JAVA¼¼ÇÉ(Java¶¨Ê±Ö´ÐÐÈÎÎñµÄʵÏÖ·½·¨)2009Äê02ÔÂ07ÈÕ ÐÇÆÚÁù 10:36¶¨Ê±Ö´ÐÐÈÎÎñµÄÈýÖÖ·½·¨:
1£©java.util.Timer.
2£©ServletContextListener.
3)org.springframework.scheduling.timer.ScheduledTimerTask
1£©java.util.Timer
¡¡¡¡Õâ¸ö·½·¨Ó¦¸ÃÊÇ×î³£Óõģ¬²»¹ýÕâ¸ö·½·¨ÐèÒªÊÖ¹¤Æô¶¯ÄãµÄÈÎÎñ£º
Timer timer=new Timer();
timer.schedule(new ListByDayTimerTask(),10000,86400000);
ÕâÀïµÄListByDayTimerTaskÀà±ØÐëextends TimerTaskÀïÃæµÄrun()·½·¨¡£
2£©ServletContextListener
Õâ¸ö·½·¨ÔÚwebÈÝÆ÷»·¾³±È½Ï·½±ã£¬ÕâÑù£¬ÔÚweb serverÆô¶¯ºó¾Í¿ÉÒÔ
×Ô¶¯ÔËÐиÃÈÎÎñ£¬²»ÐèÒªÊÖ¹¤²Ù×÷¡£
½«ListByDayListener implements ServletContextListener½Ó¿Ú£¬ÔÚ
contextInitialized·½·¨ÖмÓÈëÆô¶¯TimerµÄ´úÂ룬ÔÚcontextDestroyed
·½·¨ÖмÓÈëcancel¸ÃTimerµÄ´úÂ룻ȻºóÔÚweb.xmlÖУ¬¼ÓÈëlistener:
<listener>
<listener-class>com.sysnet.demo.util.MyTimerTask</listener-class>
</listener>
3)org.springframework.scheduling.timer.ScheduledTimerTask
¡¡¡¡Èç¹ûÄãÓÃspring£¬ÄÇôÄã²»ÐèҪдTimerÀàÁË£¬ÔÚschedulingContext-timer
.xmlÖмÓÈëÏÂÃæµÄÄÚÈݾͿÉÒÔÁË£º
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="timer" class="org.springframework.scheduling.ti
Ïà¹ØÎĵµ£º
ÔÚJavaÖУ¬²»Í¬µÄÀ඼ÓÐ×Ô¼ºµ¥¶ÀµÄCache»úÖÆ£¬ÊµÏֵķ½·¨Ò²¿ÉÄÜÓÐËù²»Í¬£¬ÎÄÕÂÁоÙÁËJavaÖг£¼ûµÄ¸÷ÀàCache»úÖƵÄʵÏÖ·½·¨£¬Í¬Ê±½øÐÐÁË×ۺϵıȽϡ£
OSCache
OSCacheÊǸöÒ»¸ö¹ã·º²ÉÓõĸßÐÔÄܵÄJava EE»º´æ¿ò¼Ü£¬OSCacheÄÜÓÃÓÚÈκÎJavaÓ¦ÓóÌÐòµÄÆÕͨµÄ»º´æ½â¾ö·½°¸¡£
OSCacheÓÐÒÔÏÂÌص㣺»º´æÈκζÔÏó£¬Äã¿ÉÒÔ²»ÊÜÏÞÖƵ ......
MysqlÔÚĬÈÏÇé¿öϽ¨Á¢±íµÄ×Ö·û±àÂëÊÇlatin1£¬ËùÒÔÔÚ²åÈëÖÐÎÄʱ»á³ö´í¡£
eg£º
1¡¢²é¿´±í½¨Á¢µÄsqlÔ´Â룺
1: sqlÃüÁshow create table users
2:
3: ½á¹û£º
4: CREATE TABLE `users` (
5: `userID` int(10) unsigned NOT NULL AUTO_INCREMENT,
6: `userName` varchar(4 ......
(Ò»)¹ýÂËÆ÷Àà±àд¡£
1¡¢ÉèÖÃ×Ö·û¼¯±àÂ뷽ʽ£º
±àд¹ýÂËÆ÷ÀࣺʵÏÖ½Ó¿Újavax.servlet.Filter
public class CharacterEncodingFilter implements Filter {
private String charset;
public void destroy() {
// TODO Auto-generated method stub
}
public void ......
£¨×ª£©javaÓëflexͨÐÅ
Ò»¡¢×¼±¸£º
·þÎñ¶Ë£ºJDK1.5 £¨Õâ¸ö²»ÓýéÉÜÁË°É£¿£©
·þÎñ¶ËIDE£ºeclipse £¨ËüµÄÖ÷Ò³£©
¿Í»§¶Ë£ºFLEX 3 £¨Adobe® Flex® 3 ÊÇÓÃÓÚ¹¹½¨ºÍά»¤ÔÚËùÓÐÖ÷Òªä¯ÀÀÆ÷¡¢×ÀÃæºÍ²Ù×÷ϵͳһÖµز¿ÊðµÄ¼«¾ß±íÏÖÁ¦µÄ Web Ó¦ÓóÌÐòµÄ¸ßЧÂʵĿª·ÅÔ´Âë¿ò¼Ü¡££©
¿Í»§¶ËIDE£ºFlex Builder 3 ......
Ç°ÑÔ
ÔÚJavaÓïÑÔÖУ¬equals()ºÍhashCode()Á½¸öº¯ÊýµÄʹÓÃÊǽôÃÜÅäºÏµÄ£¬ÄãÒªÊÇ×Ô¼ºÉè¼ÆÆäÖÐÒ»¸ö£¬¾ÍÒªÉè¼ÆÁíÍâÒ»¸ö¡£ÔÚ¶àÊýÇé¿ö Ï£¬ÕâÁ½¸öº¯ÊýÊDz»Óÿ¼Âǵģ¬Ö±½ÓʹÓÃËüÃǵÄĬÈÏÉè¼Æ¾Í¿ÉÒÔÁË¡£µ«ÊÇÔÚһЩÇé¿öÏ£¬ÕâÁ½¸öº¯Êý×îºÃÊÇ×Ô¼ºÉè¼Æ£¬²ÅÄÜÈ·±£Õû¸ö³ÌÐòµÄÕý³£ÔËÐС£×î³£¼ûµÄÊǵ± Ò»¸ö¶ÔÏó±»¼ÓÈ뼯ºÏ¶ÔÏó£¨collectio ......