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

java¶ÁÐ´ËøÊµÏÖ»úÖÆ

package thread.lock;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
 * @file_name ReadAndWriteLockDemo.java
 * @description ¶ÁÐ´ËøDEMO
 * @author ÕÅÃ÷ÁÁ
 * @date 2009.09.27
 */
public class ReadAndWriteLockDemo {
 ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
 // ¶ÁËø
 Lock rLock = rwLock.readLock();
 // Ð´Ëø
 Lock wLock = rwLock.writeLock();
 // »õ¼Ü
 List<String> stock = new ArrayList<String>();
    //»¥³âËø
 ReentrantLock lock = new ReentrantLock();
 /**
  * ÉÌÆ·ÂòÂô
  * <br>
  * µ±ÉÌÆ·ÊýÁ¿Ð¡ÓÚ1ʱ£¬ÊͷŶÁËø²¢»ñÈ¡Ð´Ëø Éú²úÉÌÆ·ºó£¬
  * <br>
  * Ëø½µ¼¶ÔÚÐ´Ëø±£»¤ÏÂÖØÐ»ñÈ¡¶ÁËø²¢Ïû·ÑÉÌÆ·
  */
 public void sell() {
//  lock.lock();
  try {
   rLock.lock();
   if (stock.size() <= 0) {
    rLock.unlock();
    wLock.lock();
    manufacture();
    rLock.lock();
    wLock.unlock();
   }
   consume();
   rLock.unlock();
  } finally {
//   lock.unlock();
  }
 }
 /**
  * Éú²úÉÌÆ·
  */
 private void manufacture() {
  stock.add("product");
 }
 /**
  * Ïû·ÑÉÌÆ·
  */
 private void consume() {
  System.err.println(stock.remove(0));
 }
 public static void main(String[] args) {
  final ReadAndWriteLockDemo rwDemo = new ReadAndWriteLockDemo();
  rwDemo.sell();
//  Thread t1 = new Thread("threa--1") {
//   public void run() {
//    rwDemo.sell(


Ïà¹ØÎĵµ£º

java¼¯ºÏ¿ò¼Üͼ¼°½éÉÜ

ת×Ô:http://hi.baidu.com/%C9%AE_%CC%C6/blog/item/9e2a8b0887008a8ad0581b3d.html
 
¼ò»¯Í¼£º
Javaƽ̨ÌṩÁËÒ»¸öÈ«Ðµļ¯ºÏ¿ò¼Ü¡£“¼¯ºÏ¿ò¼Ü”Ö÷ÒªÓÉÒ»×éÓÃÀ´²Ù×÷¶ÔÏóµÄ½Ó¿Ú×é³É¡£²»Í¬½Ó¿ÚÃèÊöÒ»×鲻ͬÊý¾ÝÀàÐÍ¡£
Java 2¼¯ºÏ¿ò¼Üͼ
¼¯ºÏ½Ó¿Ú£º6¸ö½Ó¿Ú£¨¶ÌÐéÏß±íʾ£©£¬±íʾ²»Í¬¼¯ºÏÀàÐÍ£¬ÊǼ¯ºÏ¿ò¼Üµ ......

Java ÓйØIOÀàµÄ×¢ÊÍ/˵Ã÷


InputSteam,OutputStream:¶Ô×ֽڵIJÙ×÷
Reader,Writer:¶Ô×Ö·ûµÄ²Ù×÷
InputStreamReader,OutputStreamReader:×Ö½Ú->×Ö·ûµÄת»»,×Ö·û->×Ö½ÚµÄת»»
FilterInputSteam,FilterOutputStream:¹ýÂË×Ö½ÚÊäÈëÁ÷(Êä³öÁ÷)µÄ³¬Àà
FilterReader,FilterWriter:¹ýÂË×Ö·ûÊäÈëÁ÷(Êä³öÁ÷)µÄ³¬Àà
BufferedInputStream,BufferedOutp ......

Java Ö´ÐÐ SQL ½Å±¾Îļþ

ÊÇ¿½±´µÄ±ðÈ˵ģ¬ÒÔ±¸Ñ§Ï°
package com.unmi.db;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* ¶ÁÈ¡ SQL ½Å±¾²¢Ö´ÐÐ
* @author Unmi
*/
pub ......

weblogic jsp ±àÒ룺²é¿´±àÒëºóµÄjavaÖмä´úÂë

ÔËÐÐ×Ô¼ºÅäÖõÄwebÓ¦Óã¬ÍùÍùÖ»ÄÜ¿´¼ûweblogic±àÒëÖ®ºóµÄclassÎļþ¡£¶ø¿´²»¼û±àÒëǰµÄjavaµÄÎļþ¡£ÎªÁ˵÷ÊÔ·½±ã£¬ÎÒÃÇÓÐʱºòÊÇÏë¿´±àÒëǰµÄjavaÎļþ¡£
ÔÚweblogic.xmlÖмÓÈë
<jsp-descriptor>
<jsp-param>
<param-name>keepgenerated</param-name>
<param-value>true</par ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ