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

Java Ïß³ÌÖмǼÈÕÖ¾

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
public class ThreadLog
{
private final static String _detailLogFile = "log"+File.separator+"detail";
private static boolean _logFlag = true;
private static HashMap<String, String> _threadDetailFile = new HashMap<String, String>();
private static int _fileIndex = 1;
private static void generateLogFile(String fileName)
{
String absoluteFilePath = ProjectConfig.getNFSCAbsolutePath() +
File.separator + "log" + File.separator +fileName;

_threadDetailFile.put(String.valueOf(Thread.currentThread().getId()) + "_" + fileName,
absoluteFilePath);

File file = new File(absoluteFilePath);
//create a new file
if(!file.exists())
{
try
{
file.createNewFile();
}
catch(IOException ex)
{
ExceptionDefaultHandler.handle(ex, "threadlog.log");
}
}
}
private static void generateLogFile()
{
String fileName = _detailLogFile +
DateTimeUtil.getCurrentDateFormatString("yyyyMMddHHmmss") +"_"+
String.valueOf(_fileIndex++)+ ".log";

String absoluteFilePath = ProjectConfig.getNFSCAbsolutePath() +
File.separator + fileName;

_threadDetailFile.put(String.valueOf(Thread.currentThread().getId()), absoluteFilePath);

File file = new File(absoluteFilePath);
//if the file exist, we have to remove it.
if(file.exists())
{
try
{
file.delete();
}
catch(SecurityException ex)
{
ExceptionDefaultHandler.handle(ex, "threadlog.log");
}
}
//create a new file
try
{
file.createNewFile();
}
catch(IOException ex)
{
ExceptionDefaultHandler.handle(ex, "threadlog.log");
}
}
private static boolean hasThreadLogFile()
{
return _threadDetailFile.containsKey(String.valueOf(Thread.currentThread().getId()));
}
private static boolean hasThreadLogFi


Ïà¹ØÎĵµ£º

A example to run the Java APP in bat

@echo off cls REM --- BEG MACHINE-DEPENDENT ---- set HOME_J2RE=C:\Program Files\Java\jdk1.5.0_17 REM --- END MACHINE-DEPENDENT ---- set HOME_JAVA=%HOME_J2RE%\bin\java set HOME_JAVA="%HOME_JAVA%" set ARG_MEMORY=-Xms128m -Xmx196m set PROP_POLICY=-Dorg.ragingcat.kst.uikeytool.policy.extende ......

javaÖÐÊäÈëÊä³öµÄ×ÜÀ¨(³õѧ±Ø¿´)

µÚÒ»½Ú Êý¾ÝÁ÷µÄ»ù±¾¸ÅÄî
     Àí½âÊý¾ÝÁ÷
Á÷Ò»°ã·ÖΪÊäÈëÁ÷£¨Input Stream£©ºÍÊä³öÁ÷£¨Output Stream£©Á½À࣬µ«ÕâÖÖ»®·Ö²¢²»ÊǾø¶ÔµÄ¡£±ÈÈçÒ»¸öÎļþ£¬µ±ÏòÆäÖÐдÊý¾Ýʱ£¬Ëü¾ÍÊÇÒ»¸öÊä³öÁ÷£»µ±´ÓÆäÖжÁÈ¡Êý¾Ýʱ£¬Ëü¾ÍÊÇÒ»¸öÊäÈëÁ÷¡£µ±È»£¬¼üÅÌÖ»ÊÇÒ»¸öÊýÈËÁ÷£¬¶øÆÁÄ»ÔòÖ»ÊÇÒ»¸öÊä³öÁ÷¡£ ......

JavaµÄ·´Éä»úÖÆ

 JAVA·´Éä»úÖÆÊÇÔÚÔËÐÐ״̬ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬¶¼Äܹ»ÖªµÀÕâ¸öÀàµÄËùÓÐÊôÐԺͷ½·¨£»¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏ󣬶¼Äܹ»µ÷ÓÃËüµÄÈÎÒâÒ»¸ö·½·¨£»ÕâÖÖ¶¯Ì¬»ñÈ¡µÄÐÅÏ¢ÒÔ¼°¶¯Ì¬µ÷ÓöÔÏóµÄ·½·¨µÄ¹¦ÄܳÆΪjavaÓïÑԵķ´Éä»úÖÆ¡£
Java·´Éä»úÖÆÖ÷ÒªÌṩÁËÒÔϹ¦ÄÜ£º ÔÚÔËÐÐʱÅжÏÈÎÒâÒ»¸ö¶ÔÏóËùÊôµÄÀࣻÔÚÔËÐÐʱ¹¹ÔìÈÎÒâÒ»¸öÀàµÄ¶Ô ......

java»º´æ´¦Àí

java»º´æ¼¼ÊõÒ»£¨×ª£©
¿´Ò»Á£É³ÖеÄÊÀ½ç£¬ Ò»¶äÒ°»¨ÖеÄÌìÌᣠ°ÑÎÞÏÞÎÕÓÚÕÆÖУ¬ °ÑÓÀºãÎÕÓÚ˲¼ä¡£——ÍþÁ®• ²¼À³¿Ë
¿ªÊ¼ÌÖÂÛ»º´æ֮ǰ,ÈÃÎÒÃÇÏÈÀ´ÌÖÂÛÌÖÂÛÁíÍâÒ»¸öÎÊÌâ:ÀíÂÛºÍʵ¼ù.´Óahuaxuan½Ó´¥µÄ³ÌÐòÔ±À´¿´,ÓеijÌÐòԱƫʵ¼ù,ÓеijÌÐòԱƫÀíÂÛ,µ«ÊÇÕⶼÊDz»ºÃµÄÐÐΪ,ÀíÂÛºÍʵ¼ùͬÑùÖØÒª,ÎÒÃÇÔÚ×öºÜ¶àº ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ