Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVAÏß³ÌÖеÄÊØ»¤Ị̈߳¨Daemon£©

ÊØ»¤Ị̈߳¨Daemon£©
JavaÓÐÁ½ÖÖThread£º“ÊØ»¤Ïß³ÌDaemon”Óë“Óû§Ïß³ÌUser”¡£
ÎÒÃÇ֮ǰ¿´µ½µÄÀý×Ó¶¼ÊÇÓû§£¬ÊØ»¤Ïß³ÌÊÇÒ»ÖÖ“ÔÚºǫ́ÌṩͨÓÃÐÔÖ§³Ö”µÄỊ̈߳¬Ëü²¢²»ÊôÓÚ³ÌÐò±¾Ìå¡£
´Ó×ÖÃæÉÏÎÒÃǺÜÈÝÒ×½«ÊØ»¤Ïß³ÌÀí½â³ÉÊÇÓÉÐéÄâ»ú£¨virtual machine£©ÔÚÄÚ²¿´´½¨µÄ£¬¶øÓû§Ïß³ÌÔòÊÇ×Ô¼ºËù´´½¨µÄ¡£ÊÂʵ²¢²»ÊÇÕâÑù£¬ÈκÎÏ̶߳¼¿ÉÒÔÊÇ“ÊØ»¤Ïß³ÌDaemon”»ò“Óû§Ïß³ÌUser”¡£ËûÃÇÔÚ¼¸ºõÿ¸ö·½Ã涼ÊÇÏàͬµÄ£¬Î¨Ò»µÄÇø±ðÊÇÅжÏÐéÄâ»úºÎʱÀ뿪£º
Óû§Ị̈߳ºJavaÐéÄâ»úÔÚËüËùÓзÇÊØ»¤Ïß³ÌÒѾ­À뿪ºó×Ô¶¯À뿪¡£
ÊØ»¤Ị̈߳ºÊØ»¤Ïß³ÌÔòÊÇÓÃÀ´·þÎñÓû§Ï̵߳ģ¬Èç¹ûûÓÐÆäËûÓû§Ïß³ÌÔÚÔËÐУ¬ÄÇô¾ÍûÓпɷþÎñ¶ÔÏó£¬Ò²¾ÍûÓÐÀíÓɼÌÐøÏÂÈ¥¡£
setDaemon(boolean on)·½·¨¿ÉÒÔ·½±ãµÄÉèÖÃÏ̵߳ÄDaemonģʽ£¬trueΪDaemonģʽ£¬falseΪUserģʽ¡£setDaemon(boolean on)·½·¨±ØÐëÔÚÏß³ÌÆô¶¯Ö®Ç°µ÷Ó㬵±Ïß³ÌÕýÔÚÔËÐÐʱµ÷Óûá²úÉúÒì³£¡£isDaemon·½·¨½«²âÊÔ¸ÃÏß³ÌÊÇ·ñΪÊØ»¤Ï̡߳£ÖµµÃÒ»ÌáµÄÊÇ£¬µ±ÄãÔÚÒ»¸öÊØ»¤Ïß³ÌÖвúÉúÁËÆäËûỊ̈߳¬ÄÇôÕâЩвúÉúµÄÏ̲߳»ÓÃÉèÖÃDaemonÊôÐÔ£¬¶¼½«ÊÇÊØ»¤Ị̈߳¬Óû§Ïß³ÌͬÑù¡£
import java.io.IOException;
public class TestDaemonThread {
public static void main(String[] args) {
DaemonThread daemonThread = new DaemonThread();
// ÉèÖÃΪÊØ»¤Ïß³Ì
daemonThread.setDaemon(true);
daemonThread.start();
System.out.println("isDaemon = " + daemonThread.isDaemon());
try {
// ½ÓÊÜÊäÈ룬ʹ³ÌÐòÔÚ´ËÍ£¶Ù£¬Ò»µ©½ÓÊÕµ½Óû§ÊäÈ룬mainÏ߳̽áÊø£¬ÊØ»¤Ïß³Ì×Ô¶¯½áÊø
System.in.read();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
class DaemonThread extends Thread {

public DaemonThread() {}

/**
* Ï̵߳Ärun·½·¨£¬Ëü½«ºÍÆäËûÏß³ÌͬʱÔËÐÐ
*/
public void run() {
while (true) {
for (int i = 1; i <= 100; i++) {
this.setSleep(200);
System.out.println(i);
}
this.setSleep(2000);
}
}

public void setSleep(long time


Ïà¹ØÎĵµ£º

javaдµÄµç¿ÏÂÔØÍê³É¹Ø»úС³ÌÐò

¾­³£Óõ½µç¿ÏÂÔØ×ÊÁÏ,һЩhttpÄã¸ù±¾ÕÒ²»µ½µÄ×ÊÔ´,µ±È»ËÙ¶ÈÊDz»Äܹ§Î¬ÁË,¿×Óô,¸ÉµÄ¾ÍÊÇÂý»î,ÈÈÃÅ×ÊÔ´³ýÍâ…
ÎÒÓõÄverycd°æµÄµç¿,Ô­°æµç¿µÄÒ»ÖÖmods,µç¿òËÆÓÐN¶à°æ±¾,²»¹ýÎÒ¾õµÃverycdµÄ¾Í¹»ÓÃÁË,±Ï¾¹¹úÄڰ˳ɵÄÈ˶¼ÔÚÓÃ.
×î½üÔÚÏÂж«·½µÄиÅÄîÓ¢Óï½Ì³Ì,½ø¶È87%,ÑÛ¿´ÒªÏÂÍêÁË,µÈÒªµÈ1¸ö¶àСʱ,ÏÂÔØÍê³ÉÓ ......

Java±àÂë¹æ·¶(Ò»)

ÃüÃû¹æ·¶
ÏîÄ¿Ãû£º¸÷µ¥´ÊÊ××Öĸ´óд£¬ÆäËü×ÖĸСд
°üÃû£ºÈ«²¿×ÖĸСдÇÒΨһ£¬Í¨³£Îª¹«Ë¾ÓòÃûµÄµ¹Ðò
Ô´ÎļþÃû£º¸÷µ¥´ÊÊ××Öĸ´óд£¬ÆäËü×ÖĸСд
·½·¨Ãû£ºµÚÒ»¸öµ¥´ÊÈ«²¿Ð¡Ð´£¬ÆäÓ൥´ÊÊ××Öĸ´óд£¬ÆäËü×ÖĸСд£¬Ò»°ãӦΪ¶¯´Ê
³ÉÔ±±äÁ¿Ãû£ºµÚÒ»¸öµ¥´ÊÈ«²¿Ð¡Ð´£¬ÆäÓ൥´ÊÊ××Öĸ´óд£¬ÆäËü×ÖĸСд
³ÉÔ±³£Á¿Ãû£ºËùÓе¥ ......

java·ºÐÍT.classµÄ»ñÈ¡

   ºÜÔç֮ǰд¹ýÀûÓ÷ºÐͺͷ´Éä»úÖƳéÏóDAO £¬¶ÔÆäÖлñÈ¡×ÓÀà·ºÐ͵ÄclassÒ»Ö±²»ÊǺÜÀí½â¡£¹Ø¼üµÄµØ·½ÊÇHibernateBaseDaoµÄ¹¹Ôì·½·¨ÖеÄ
Type genType = getClass().getGenericSuperclass();
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
entityClass = (Class)params[0] ......

Java CGLIB

Java Cglib
1.CGLIB°üµÄ½éÉÜ
     ´úÀíΪ¿ØÖÆÒª·ÃÎʵÄÄ¿±ê¶ÔÏóÌṩÁËÒ»ÖÖ;¾¶¡£µ±·ÃÎʶÔÏóʱ£¬ËüÒýÈëÁËÒ»¸ö¼ä½ÓµÄ²ã¡£JDK×Ô´Ó1.3°æ±¾¿ªÊ¼£¬¾ÍÒýÈëÁ˶¯Ì¬´úÀí£¬²¢ÇÒ¾­³£±»ÓÃÀ´¶¯Ì¬µØ´´½¨´úÀí¡£JDKµÄ¶¯Ì¬´úÀíÓÃÆðÀ´·Ç³£¼òµ¥£¬µ±ËüÓÐÒ»¸öÏÞÖÆ£¬¾ÍÊÇʹÓö¯Ì¬´úÀíµÄ¶ÔÏó±ØÐëʵÏÖÒ»¸ö»ò¶à¸ö½Ó¿Ú¡£Èç¹ûÏë´úÀ ......

JAVAÖеĶàÏß³Ì

1¡¢ ÈÏʶThreadºÍRunnable
JavaÖÐʵÏÖ¶àÏß³ÌÓÐÁ½ÖÖ;¾¶£º¼Ì³ÐThreadÀà»òÕßʵÏÖRunnable½Ó¿Ú¡£RunnableÊǽӿڣ¬½¨ÒéÓýӿڵķ½Ê½Éú³ÉỊ̈߳¬ÒòΪ½Ó¿Ú¿ÉÒÔʵÏÖ¶à¼Ì³Ð£¬¿öÇÒRunnableÖ»ÓÐÒ»¸örun·½·¨£¬ºÜÊʺϼ̳С£ÔÚʹÓÃThreadµÄʱºòÖ»Ðè¼Ì³ÐThread£¬²¢ÇÒnewÒ»¸öʵÀý³öÀ´£¬µ÷ÓÃstart()·½·¨¼´¿ÉÒÔÆô¶¯Ò»¸öÏ̡߳£
Thread Test = ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ