JavaÖÐJNDIµÄÅäÖÃ
·½°¸Ò»²½Ö裺
1¡¢ÅäÖÃTomcat\conf\context.xmlÌí¼Ó <Resource>
<Resource name="jdbc/books" auth="Container"
type="javax.sql.DataSource" maxActive="100" maxIdle="30"
maxWait="10000" username="sa" password=""
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;DatabaseName=books" />
name Ö¸¶¨ResourceµÄJNDIÃû³Æ
auth Ö¸¶¨¹ÜÀíResourceµÄManager£¨Container:ÓÉÈÝÆ÷´´½¨ºÍ¹ÜÀí|Application£ºÓÉWebÓ¦Óô´½¨ºÍ¹ÜÀí£©
type Ö¸¶¨ResourceËùÊôµÄJavaÀà
maxActive Ö¸¶¨Á¬½Ó³ØÖд¦Óڻ״̬µÄÊý¾Ý¿âÁ¬½ÓµÄ×î´óÊýÄ¿
maxIdle Ö¸¶¨Á¬½Ó³ØÖд¦ÓÚ¿ÕÏÐ״̬µÄÊý¾Ý¿âÁ¬½ÓµÄ×î´óÊýÄ¿
maxWait Ö¸¶¨Á¬½Ó³ØÖеÄÁ¬½Ó´¦ÓÚ¿ÕÏеÄ×ʱ¼ä£¬³¬¹ýÕâ¸öʱ¼ä»áÅ׳öÒì³££¬È¡ÖµÎª-1£¬±íʾ¿ÉÒÔÎÞÏÞÆڵȴý
2¡¢¿½±´ÏàÓ¦µÄjar°üµ½Tomcat\common\libÖÐ
/server/libĿ¼ÏµÄjarÎļþÖ»Äܱ»Tomcat·þÎñÆ÷·ÃÎÊ
/shared/libĿ¼ÏµÄjarÎļþ¿ÉÒÔ±»ËùÓеÄwebÓ¦ÓóÌÐò·ÃÎÊ£¬µ«²»Äܱ»Tomcat·þÎñÆ÷·ÃÎÊ
/common/libĿ¼ÏµÄjarÎļþ¿ÉÒÔ±»Tomcat·þÎñÆ÷ºÍËùÓеÄwebÓ¦ÓóÌÐò·ÃÎÊ¡£
3¡¢ÅäÖÃwebÏîÄ¿ÖеÄweb.xmlÌí¼Ó <resourc-ref>
<resource-ref>
<res-ref-name>jdbc/books</res-ref-name> Ö¸¶¨JNDIµÄÃû×Ö£¬Óë<Resource>ÔªËØÖеÄnameÒ»ÖÂ
<res-type>javax.sql.DataSource</res-type> Ö¸¶¨ÒýÓÃ×ÊÔ´µÄÀàÃû£¬Óë<Resource>ÔªËØÖеÄtypeÒ»ÖÂ
<res-auth>Container</res-auth> Ö¸¶¨¹ÜÀíËùÒýÓÃ×ÊÔ´µÄManagerÓë<Resource>ÔªËØÖеÄauthÒ»ÖÂ
</resource-ref>
4¡¢java´úÂë
import javax.sql.DataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
//»ñÈ¡Co
Ïà¹ØÎĵµ£º
public class DealLockTest implements Runnable {
static String i = new String();
static String j = new String();
private String str = null;
public DealLockTest(String str) {
this.str = str;
}
public static void main(String[] args) {
new Thread(new DealLockTest("i")).start( ......
¿´¿´ÏÂÃæ³ÌÐò½«Êä³öʲô½á¹û£º
/**
* ShowExtending
* ÑÝʾ¼Ì³ÐʱµÄÏÖÏó
*/
class SupCls {
static String s1 = "¸¸ÀàÀà±äÁ¿s1";
String s2 = "¸¸ÀàʵÀý±äÁ¿s2";
SupCls(){
System.out.println("¸¸À๹ÔìÆ÷±»·ÃÎÊ");
}
public static void f1(){
......
¡¾IT168 ¼¼ÊõÎÄÕ¡¿
WWJ SDK ÊÇÒ»ÖÖ¹¹½¨ÔÚ Java OpenGL (JOGL) À©Õ¹Ö®É쵀 3D
ͼÐεØÇòÒÇ¡£WWJ Àà²ã´Î½á¹¹µÄºËÐÄÊÇ GLCanvas µÄ×ÓÀà WorldWindowGLCanvas¡£¶ø GLCanvas ÊÇÒ»¸ö
Abstract Window Toolkit (AWT) ×é¼þ¡£
¡¡¡¡WWJ ¶Ô AWT µÄÒÀÀµÐÔ¶ÔÓÚÏëÔÚ Eclipse
Ó¦ÓóÌÐòÖÐʹÓà WWJ µÄ GIS ¿ª·¢ÈËÔ±À´½²ÊÇÒ»¸öÕÏ°¡£Äú¿É ......
overrideÊǸ²Ð´£¬¶ÔÓ¦ÓÚOO±à³ÌµÄ¼Ì³ÐÌØÐÔ£¬Òâ˼¾ÍÊÇÔÚ×ÓÀàÖÐÖØд¸¸ÀàÖеķ½·¨£»
overloadÊÇÖØÔØ£¬¶ÔÓ¦ÓÚOO±à³ÌµÄ¶à̬ÌØÐÔ£¬Òâ˼¾ÍÊÇÔÚͬһ¸öÀàÖÐͬÑùÃû³ÆµÄ¶à¸ö·½·¨£¬ Õâ¶à¸ö·½·¨Ö®¼äµÄÇø±ðÔÚËûÃǵIJÎÊýÁв»Í¬¡£
ÀýÈ磺
public interface UserDao {
public void save();
......
±¾ÎĽ²½âÁËJavaÐòÁл¯µÄ»úÖƺÍÔÀí¡£´ÓÎÄÖÐÄã¿ÉÒÔÁ˽âÈçºÎÐòÁл¯Ò»¸ö¶ÔÏó£¬Ê²Ã´Ê±ºòÐèÒªÐòÁл¯ÒÔ¼°JavaÐòÁл¯µÄËã·¨¡£
00 00 00 0B: 11, containVersionµÄÖµ.
0x70:TC_NULL£¬Ã»Óг¬ÀàÁË¡£
0x49: ÓòÀàÐÍ. 49 ´ú±í"I", Ò²¾ÍÊÇInt..
00 0E: ÓòÃû×Ö³¤¶ ......