Month: August 2008

今天试用了JDK自带的Logger

配置文件可以这样写: handlers=java.util.logging.ConsoleHandler .level=<font color=red> ALL</font> java.util.logging.ConsoleHandler.level = <font color=red>ALL</font> java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter jdk的logging将日志分为七个级别,详细我就不列了 要修改日志级别,需要将上面两处红色的地方都替换掉 带LOG运行的方法是: java.exe <b>-Djava.util.logging.config.file=loggingfile.properties</b>  SomeClass

我常在Spring Controller 中使用的 toSv()

把successView当作http parameter传进来,可以方便重用Controller ==========================================================            private ModelAndView toSv(HttpServletRequest request, HttpServletResponse response, Map model) { String sv = request.getParameter("sv"); return new ModelAndView(sv, model); }

将数组的下标分段的算法

比如将最大下标为13的数组分段,每段最多5个,则为 0   1    2   3  4 5    6   7   8  9 10 11 12 13 将最大小标为n的数组分段,每段最多m个,则为 0   …                                m-1 1*m  …                                2m -1 k*m…                               (k+1)*m – 1 (n 整除于 m) * m,  …          n

多线程学习笔记

1.局部变量永远不会被多个线程共同访问。因为:If two threads happen to execute the same method, each thread   gets a separate copy of the local variables of that method. 2.成员变量可能被多个线程共同访问,但是Java threads cannot arbitrarily access each other’s data objects:   they need permission to access the objects, and one thread needs to pass the object reference to the   other thread. 3.用设置flag的方法来终止线程 …

多线程学习笔记 Read More »