Summer Review and Course Design —— 1. Reflection and connection pool

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:

  1. the API belong to the package java.lang.reflect
  2. 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再议。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值