JAVA¶¨Ê±Æ÷ʹÓÃ,×ªÔØ2~
JAVA¶¨Ê±Æ÷£¨java.util.Timer£©
2009Äê07ÔÂ30ÈÕ ÐÇÆÚËÄ ÏÂÎç 02:17
¡¾1¡¿Java ¶¨Ê±Æ÷£¨java.util.Timer£©Óж¨Ê±´¥·¢¼Æ»®ÈÎÎñµÄ¹¦ÄÜ£¬Í¨¹ýÅäÖö¨Ê±Æ÷µÄ¼ä¸ôʱ¼ä£¬ÔÚijһ¼ä¸ôʱ¼ä¶ÎÖ®ºó»á×Ô¶¯ÓйæÂɵĵ÷ÓÃÔ¤ÏÈËù°²Åŵļƻ®ÈÎÎñ£¨java.util.TimerTask£©¡£Óëÿ¸ö Timer ¶ÔÏóÏà¶ÔÓ¦µÄÊǵ¥¸öºǫ́Ị̈߳¬ÓÃÓÚ˳ÐòµØÖ´ÐÐËùÓмÆÊ±Æ÷ÈÎÎñ¡£¼ÆÊ±Æ÷ÈÎÎñÓ¦¸ÃѸËÙÍê³É¡£Èç¹ûÍê³Éij¸ö¼ÆÊ±Æ÷ÈÎÎñµÄʱ¼äÌ«³¤£¬ÄÇôËü»á“¶ÀÕ¼”¼ÆÊ±Æ÷µÄÈÎÎñÖ´ÐÐÏ̡߳£Òò´Ë£¬Õâ¾Í¿ÉÄÜÑÓ³ÙºóÐøÈÎÎñµÄÖ´ÐУ¬¶øÕâЩÈÎÎñ¾Í¿ÉÄÜ“¶ÑÔÚÒ»Æð”£¬²¢ÇÒÔÚÉÏÊö²»ÓѺõÄÈÎÎñ×îÖÕÍê³Éʱ²ÅÄܹ»±»¿ìËÙÁ¬ÐøµØÖ´ÐС£ÁíÍ⣬ÓÉÓÚÎÒÃÇÏ£Íûµ±Web¹¤³ÌÆô¶¯Ê±£¬¶¨Ê±Æ÷ÄÜ×Ô¶¯¿ªÊ¼¼ÆÊ±£¬ÔÚÕû¸öWeb¹¤³ÌµÄÉúÃüÆÚÀ¶¨Ê±Æ÷ÄÜÔÚÿÍíÉîÒ¹´¥·¢Ò»´Î±¨±í¼ÆËãÒýÇæÌìµÈ¡£Òò´Ë¶¨Ê±Æ÷µÄ´æ·ÅλÖÃÒ²ÖµµÃ¿¼²é£¬²»Äܼòµ¥µÄ´æÔÚÓÚµ¥¸öServlet»òJavaBeanÖУ¬±ØÐëÄÜÈö¨Ê±Æ÷ËÞÖ÷µÄ´æ»îÆÚΪÕû¸öWeb¹¤³ÌÉúÃüÆÚ£¬ÔÚ¹¤³ÌÆô¶¯Ê±ÄÜ×Ô¶¯¼ÓÔØÔËÐС£½áºÏÕâÁ½µã£¬¸úServletÉÏÏÂÎÄÓйصļàÌýÆ÷¾Í×îºÏÊʲ»¹ýÁË£¬Í¨¹ýÔÚ¹¤³ÌµÄÅäÖÃÎļþÖмÓÒÔ ºÏÀíÅäÖ㬻áÔÚ¹¤³ÌÆô¶¯Ê±×Ô¶¯ÔËÐУ¬²¢ÔÚÕû¸ö¹¤³ÌÉúÃüÆÚÖд¦ÓÚ¼àÌý״̬¡£
ÏÂÃæ¾ÍServlet¼àÌýÆ÷½áºÏJava ¶¨Ê±Æ÷À´½²ÊöÕû¸öʵÏÖ¹ý³Ì¡£ÒªÔËÓÃServlet¼àÌýÆ÷ÐèҪʵÏÖjavax.servlet.ServletContextListener½Ó¿Ú£¬Í¬Ê±ÊµÏÖËüµÄcontextInitialized(ServletContextEvent event)ºÍcontextDestroyed(ServletContextEvent event)Á½¸ö½Ó¿Úº¯Êý¡£¿¼ÂǶ¨Ê±Æ÷Óиö½¨Á¢ºÍÏú»ÙµÄ¹ý³Ì£¬¿´ÁËÇ°ÃæÁ½¸ö½Ó¿Úº¯Êý£¬¾Í²»ÈÝÖÃÒɵİѽ¨Á¢µÄ¹ý³ÌÖÃÈë contextInitialized£¬°ÑÏú»ÙµÄ¹ý³ÌÖÃÈëcontextDestroyedÁË¡£
package com.korby.servlet;
import javax.servlet.*;
import javax.servlet.http.*;
import com.korby.pub.TimerManager;
/**
* Æô¶¯¶¨Ê±Æ÷µÄ¼àÌýÆ÷
* @author korby
* @version 1.0
*/
public class TimerListener implements ServletContextListener {
private TimerManager tm = null;
public void contextInitialized(ServletContextEvent sce) {
int day,hour,min,sec;
day = 26; hour = 16; min = 42; sec = 0;
 
Ïà¹ØÎĵµ£º
Javaѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
/*
* EncryptUtils.java
* Copyright (C) 2007-3-19 <JustinLei@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* ......
ÔÚjavaÓïÖÐGC
¼´À¬»øÊÕ¼¯»úÖÆÊÇÖ¸jvmÓÃÓÚÊÍ·ÅÄÇЩ²»ÔÙʹÓõĶÔÏóËùÕ¼ÓõÄÄÚ´æ¡£javaÓïÑÔ²¢²»ÒªÇójvmÓÐgc£¬Ò²Ã»Óй涨gcÈçºÎ¹¤×÷¡£²»¹ý³£ÓõÄjvm¶¼ÓÐgc£¬¶øÇÒ´ó¶àÊýgc¶¼Ê¹ÓÃÀàËÆµÄËã·¨¹ÜÀíÄÚ´æºÍÖ´ÐÐÊÕ¼¯²Ù×÷¡£
À¬»øÊÕ¼¯µÄÄ¿µÄÔÚÓÚÇå³ý²»ÔÙʹÓõĶÔÏó¡£gcͨ¹ýÈ·¶¨¶ÔÏóÊÇ·ñ±»»î¶¯¶ ......
¹¹Ôì·½·¨ÕªÒª
Object()
·½·¨ÕªÒª
protected Object clone()
´´½¨²¢·µ»Ø´Ë¶ÔÏóµÄÒ»¸ö¸±±¾¡£
boolean equals(Object obj)
&n ......
żÏñ³ç°Ý£¨Ò»£©
ÄãµÄżÏñÊÇË£¿ÔÚ¸ßÖÐʱ´ú£¬ÎÒµÄżÏñÊÇÊãÇéÀËÂþ¡¢¸ß¿º¼¤°ºµÄ¿ÕÖв¹¸ø£¨Air Supply£©ÒÔ¼°¾²Èç´¦×Ó¡¢¶¯ÈçÍÑÍõĿÀò·Ã×Â壨Kylie Minogue£©£»ÏÖÔÚÎÒµÄżÏñÊÇDavid Flanagan¡¢Jonathan Knudsen¡¢Elliotte Rusty Harold¡¢Bruce EckelµÈÈË¡£ÄãÎÊÎÒDavid FlanaganµÈÈ˳ª¹ýʲô¸è£¬à¸£¡ÄãÎó»áÁË£¬ËûÃDz» ......