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

JavaÊý¾Ý¿âÁ¬½Ó³ØÀàÔ´Âë

À´×Ô:http://www.cnblogs.com/shiyangxt/archive/2008/07/30/1256813.html
»·¾³£ºMyEclipse
 
Êý¾Ý¿â£ºmysql
 
Ê×ÏÈн¨JavaÏîÄ¿£¬È»ºóн¨Á½¸öÀ࣬һ¸öÊý¾Ý¿âÁ¬½Ó³ØÀ࣬һ¸ö²âÊÔÀà¡£
 
·Ö±ðÃüÃûConnectionPool£¬ConnectionPoolTest¡£
 
È»ºóн¨Ò»¸öÅäÖÃÎļþ£¬ÃüÃû£ºdbpool.properties¡£
 
дÈë´úÂ룺
ConnectionPool.java
 
Code
package webbook.util;
import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
import java.util.Vector;
public class ConnectionPool {
    private Vector<Connection> pool;
    private String url;
    private String username;
    private String password;
    private String driverClassName;
    /** *//**
     * Á¬½Ó³ØµÄ´óС£¬Ò²¾ÍÊÇÁ¬½Ó³ØÖÐÓжàÉÙ¸öÊý¾Ý¿âÁ¬½Ó¡£
     */
    private int poolSize = 1;
    private static ConnectionPool instance = null;
    /** *//**
     * ˽ÓеĹ¹Ôì·½·¨£¬½ûÖ¹Íⲿ´´½¨±¾ÀàµÄ¶ÔÏó£¬ÒªÏë»ñµÃ±¾ÀàµÄ¶ÔÏó£¬Í¨¹ý<code>getIstance</code>·½·¨¡£
     * ʹÓÃÁËÉè¼ÆģʽÖеĵ¥×Óģʽ¡£
     */
    private ConnectionPool() {
        init();
    }
    /** *//**
     * Á¬½Ó³Ø³õʼ»¯·½·¨£¬¶ÁÈ¡ÊôÐÔÎļþµÄÄÚÈÝ ½¨Á¢Á¬½Ó³ØÖеijõʼÁ¬½Ó
     */
    private void init() {
        pool = new Vector<Connection>(poolSize);
        readConfig();
        addConnection();
    }
    /** *//**
     * ·µ»ØÁ¬½Óµ½Á¬½Ó³ØÖÐ
     */
    public synchronized void release(Conn


Ïà¹ØÎĵµ£º

°³¾­ÀúµÄJavaÃæÊÔÌâÄ¿

ÌâÄ¿¶¼ºÜ¼òµ¥,µ«ÓÐʱºòÈÃÄãÓñÊÍêÕûµÄд³öÀ´È´²»ÄÇôÈÝÒ×ÁË.
1.±éÀúÎļþ¼Ð(±»Õâ¸öÌâÄ¿¿¼ÁËÁ½´Î)
import java.io.File;
public class ListFile {
public static void main(String[] args) {
// TODO Auto-generated method stub
String path = "C:/Inetpub";
File f = new File(path);
list(f);
}
publ ......

JavaÏß³Ìͬ²½Ê¾Àý

ÎÄÕÂÓÃʵÀý´úÂëչʾÁËJavaÖжàÏ̷߳ÃÎʹ²Ïí×ÊÔ´
ʱÏß³Ìͬ²½
µÄÖØÒªÐÔ¡£
·Ö±ðͨ¹ýÔÚÁ½¸öÏß³ÌÖÐͬʱ·ÃÎÊ(µ÷ÓÃget_id*·½·¨)¾­¹ýͬ²½´¦Àí(lock¼°Synchronized)µÄ¹²Ïí×ÊÔ´(tmp)¼°Î´¾­¹ýͬ²½´¦ÀíµÄ¹²Ïí×ÊÔ´(tmp)À´ËµÃ÷ͬ²½´¦ÀíµÄµÄ×÷Óá£
mainÖзÖÁ½²¿·Ö:
1£©Ç°°ë²¿·Ö£¬non-synchronization²¿·ÖÓÃÀ´²âÊÔûÓÐ×öͬ²½´¦ÀíµÄ´úÂë ......

Java Read()×èÈûµÄÒ»ÖÖ´¦Àí·½Ê½

java.io.InputStreamµÄread()·½·¨ÃèÊö£º
        If no byte is available because the end of the stream has been reached, the value -1 is returned.
        µ½´ïÁ÷µÄĩβÕæ»á·Å»Ø-1Âð£¿
        ......

javaÎļþ±ÈÀýËõС·Å´ó

1Ê×ÏÈÌí¼ÓÐÞ¸ÄͼƬ¿í¶ÈºÍ¸ß¶ÈµÄ·½·¨
public static void reduceImg(String imgsrc, int widthdist, int heightdist) {
  try {
   File srcfile = new File(imgsrc);
   if (!srcfile.exists()) {
    return;
   }
    ......

C/C++ÓÚJavaÖ®¼äµÄ»¥Ïàµ÷ÓÃ

ÀûÓÃJNI¼¼Êõ£¬¿ÉÒÔ×öµ½C/C++ÓëJavaÖ®¼äµÄÏ໥µ÷Óá£
1¡¢Javaµ÷ÓÃC/C++½Ó¿Ú
Õâ¸öÊÇJNI×î»ù±¾µÄÓ¦Óã¬JNIÓкܶàÕâ·½ÃæµÄÀý×Ó´úÂë¡£Ò»°ã°ÑC/C++д³É¶¯Ì¬Á´½Ó¿â£»ÔÚJava³ÌÐòÔÚLoadLibrary£¬ÀûÓÃnative½Ó¿Ú£¬¼´¿ÉÍê³Éµ÷Óá£
2¡¢C/C++»Øµ÷Java½Ó¿Ú
ÕâÖÖÓ÷¨£¬JNIµÄÀý×ӱȽÏÉÙ¡£Æäʵ£¬Ò²±È½Ï¼òµ¥£¬JNIÒ²ÌṩÁËÕâÑùµÄ½Ó¿Ú¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ