ͨ¹ýJava¼¸ÐдúÂë½ØÈ¡ÆÁÄ»
ͨ¹ýjava.awt.RobotµÄcreateScreenCapture½ØÆÁ¡£
public static void captureScreen(String fileName) throws Exception {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle screenRectangle = new Rectangle(screenSize);
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(screenRectangle);
ImageIO.write(image, "png", new File(fileName));
}
Ïà¹ØÎĵµ£º
ÓÉÓÚFlex Builder compiler shellÓÐmemory leakµÄÎÊÌ⣬ ¶øSDKĬÈÏµÄµÄ JVM heap size Ö»ÓÐ312M£¬µ±compile±È½Ï´óµÄprojectÈÝÒײ»¹»£¬ËùÒÔÖ»ÒªÐÞ¸ÄSDKµÄJVM²ÎÊý¾Í¿ÉÒÔ¡£
±à¼ {Flex SDK}/bin/jvm.config ÎļþÈçÏ¡£
java.args=-Xmx512m ...
Èç¹û»¹ÊÇÓÐError£¬¿ÉÒÔÔö¼Óµ½1024»òÕ߸ü¶à¡£ ......
1. MD5¼ÓÃÜ£¬³£ÓÃÓÚ¼ÓÃÜÓû§ÃûÃÜÂ룬µ±Óû§Ñé֤ʱ¡£
¡¡ ¡¡protected byte[] encrypt(byte[] obj) ...{
¡¡¡¡try ...{
¡¡¡¡MessageDigest md5 = MessageDigest.getInstance("MD5");
¡¡¡¡md5.update(obj);
¡¡¡¡return md5.digest();
¡¡¡¡} catch (NoSuchAlgorithmException e) ...{
¡¡¡¡e.printStackTrace();
¡ ......
Ò»¡¢Ê¹ä¯ÀÀÆ÷²»»º´æÒ³ÃæµÄ¹ýÂËÆ÷
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* ÓÃÓÚµÄʹ Browser ²» ......
1.Ê×ÏÈдһ¸öȨÏÞ¹ýÂËfilterÀà,ʵÏÖFilter½Ó¿Ú
/*Ê×ÏÈдһ¸öȨÏÞ¹ýÂËfilter*/
import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.FilterChain;
import ......
ÎÄÕÂÓÃʵÀý´úÂëչʾÁËJavaÖжàÏ̷߳ÃÎʹ²Ïí×ÊÔ´
ʱÏß³Ìͬ²½
µÄÖØÒªÐÔ¡£
·Ö±ðͨ¹ýÔÚÁ½¸öÏß³ÌÖÐͬʱ·ÃÎÊ(µ÷ÓÃget_id*·½·¨)¾¹ýͬ²½´¦Àí(lock¼°Synchronized)µÄ¹²Ïí×ÊÔ´(tmp)¼°Î´¾¹ýͬ²½´¦ÀíµÄ¹²Ïí×ÊÔ´(tmp)À´ËµÃ÷ͬ²½´¦ÀíµÄµÄ×÷Óá£
mainÖзÖÁ½²¿·Ö:
1£©Ç°°ë²¿·Ö£¬non-synchronization²¿·ÖÓÃÀ´²âÊÔûÓÐ×öͬ²½´¦ÀíµÄ´úÂë ......