I am so lazy…
Well, I’m back after a month.
The new section of my blog is the Summer Review and Course Design.
Today I will describe the Reflection and Connection pool in JAVA.
1.Reflection
Java reflection is an new mechanism which is used to get the detail information about the Construction method, mumber variables and normal methods in a Class. Well, the precondition is that the mechanism have to depend on the following two document:
- the API belong to the package java.lang.reflect
- the Class Class belong to the package Java.lang
eg. We can new a new package——reflect——and a new class to examine the function of reflection.
If you want to know something about the unknown class, for example, Class “driverClass”, you can compile the following code.

run as java application and you will see the information you want

-------------------------------------------------------------------------------------------------------
2.the connection pool
Before discussing the new defination, let’s talking about the database-linked method we used now.
In the previous program, as long as we need to link to the database, the Driver have to be loaded in the tool class. After that, we can get the database connection through the DriverManager.
In this process, as long as we want to operate something through the database, we must get the database connection, which means that we have to find the database Host throw the url again and again. The process of looking for the address will consume much of time.
The connection pool is not a necessity in a little program, however, in a large program, the complicated and repeated request towards the database will occupy plenty of time as we discussed just now. Therefore, we need the connection pool to simplify and accelerate the process in this case.
Now let’s assume there is a pool, which can communicat with the database server as soon as initialization. And caches …let’s say…5 DB connection waiting for use.
So, if we have such a pool, when there’s in need, APP Server need not to request the database server again and again, waiting so much time. APP Server only need to communicate with the connection pool and access to the cached connection off the shelf. It will saving numorous time in a large program.
The simple principle has been discussed. And you can also refer to the following picture to deepen understanding.

EMMMMMMM…
As for how to acheive the connection pool and the configuration…
Let’s reconsideration…
Tommorow high probability.
Good night…though I will stay up late high probability…
connection pool连接池
mechanism 机制
precondition前提,事先具备条件
database server数据库服务器
initialization初始化
cache缓存。。。这个单词竟然忘了。。。难道我忘了被计组支配的恐惧了么。。。
off the shelf现成的
principle原理
reference参考
configuration配置
reconsideration再议。。。
Java反射与连接池解析
本文深入探讨Java反射机制,介绍其如何获取类的构造方法、成员变量等信息,并通过实例展示其应用。同时,文章详细解释数据库连接池的概念与工作原理,分析其在大型程序中提高效率的作用。
719

被折叠的 条评论
为什么被折叠?



