随笔分类 -  00.Java & j2ee

上一页 1 ··· 3 4 5 6 7 8 下一页
摘要:转自:http://www.ibm.com/developerworks/cn/java/j-jtp06197.html简介:Java™ 语言包含两种内在的同步机制:同步块(或方法)和 volatile 变量。这两种机制的提出都是为了实现代码线程的安全性。其中 Volatile 变量的同步性较差(但有时它更简单并且开销更低),而且其使用也更容易出错。在这期的Java 理论与实践中,Brian Goetz 将介绍几种正确使用 volatile 变量的模式,并针对其适用性限制提出一些建议。Java 语言中的 volatile 变量可以被看作是一种 “程度较轻的synchronized”;与sync 阅读全文
posted @ 2011-03-21 01:50 庚武 阅读(204) 评论(0) 推荐(0) 编辑
摘要://TestLock.javapackage com.test.thread;import java.util.ArrayList;import java.util.List;import java.util.concurrent.ExecutionException;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.Future;import java.util.concurrent.TimeUnit;import java 阅读全文
posted @ 2011-03-20 21:24 庚武 阅读(218) 评论(0) 推荐(0) 编辑
摘要:I/OCreateing a good input/ouput (I/O) system is one of the most difficult tasks for alanguage designer. This is evidenced by the number of different approaches.The challenge seems to be in covering all possibilities. Not only are there differentsources and sinks of I/O that you want to communicate w 阅读全文
posted @ 2011-03-18 11:09 庚武 阅读(153) 评论(0) 推荐(0) 编辑
摘要:AnnotationAnnotaions (also known as metadata) provide a formalized way to add information to yourcode so that you can easily use that data at some later point.Defining annotationsHere is the definition of the annotation above. You can see that annotation definitionslook a lot like interface definiti 阅读全文
posted @ 2011-03-18 11:08 庚武 阅读(330) 评论(0) 推荐(0) 编辑
摘要:Anytime you want to use type information at runtime, you must first get a reference to the appropriate Class object. Class.forName() is one convenient way to do this, because you don't need an object of that type in order to get the Class reference.However, if you already have an object of the t 阅读全文
posted @ 2011-03-16 19:39 庚武 阅读(492) 评论(1) 推荐(0) 编辑
摘要:package dynamicproxy;public interface SimpleInterface { void doSth(); void doSthElse(String s);}package dynamicproxy;public class RealObject implements SimpleInterface { @Override public void doSth() { System.out.println("Real Object do sth"); } @Override public void doSthElse(String s) { 阅读全文
posted @ 2011-03-16 19:17 庚武 阅读(341) 评论(1) 推荐(0) 编辑
摘要:Scanner scan=new Scanner("11, " + "22, 33, 44"); scan.useDelimiter("\\s*,\\s*"); while(scan.hasNextInt()){ System.out.println(scan.nextInt()); } 阅读全文
posted @ 2011-03-15 18:44 庚武 阅读(213) 评论(0) 推荐(0) 编辑
摘要:Where storage lives1.Registers2.The stack3.The heap4.Constant storage5.Non-RAM storagejava Primitive type: Wrapper type1.boolean Boolean2.char 16 bits Character3.byte 8 bits Byte4.short 16 bits Short5.int 32 bits Integer6.long 64 bits Long7.float 32 bits Float8.double 64 bits Double9.void VoidHigh-p 阅读全文
posted @ 2011-03-14 20:02 庚武 阅读(151) 评论(0) 推荐(0) 编辑
摘要:Step1:编写java类,e.g.:Step2: javac HelloWorld.javaStep3: javah HelloWorld生成头文件如下:Step4:用vc6建立一个win32 dll项目, 项目名helloStep5: tools->option->directory(标签)directories增加两个include 路径(具体看java的实际include路径):D:\java\jdk\jdk1.6.0_21\includeD:\java\jdk\jdk1.6.0_21\include\win32Step6:新建hello.cpp 阅读全文
posted @ 2011-02-17 12:23 庚武 阅读(336) 评论(0) 推荐(0) 编辑
摘要:Action.java 阅读全文
posted @ 2010-12-05 21:00 庚武 阅读(213) 评论(0) 推荐(0) 编辑
摘要:1.被代理对象的接口:2.被代理的对象:3.InvocationHandler包装:4.测试类: 阅读全文
posted @ 2010-11-28 19:43 庚武 阅读(250) 评论(0) 推荐(0) 编辑
摘要:Struts2 Resul Types 配置在 struts-core-2.xxx.jar中的 struts-default.xml中。[代码] 阅读全文
posted @ 2010-11-26 12:03 庚武 阅读(735) 评论(0) 推荐(0) 编辑
该文被密码保护。
posted @ 2010-11-24 12:35 庚武 阅读(1) 评论(0) 推荐(0) 编辑
摘要:xwork-convertion.propertiesactionName-convertion.properties注意 point=test.converter.PointerConverter最后不能有空格,否则查找出错.myeclipse svn使用: 阅读全文
posted @ 2010-11-23 00:32 庚武 阅读(133) 评论(0) 推荐(0) 编辑
摘要:<!--struts2配置--><package name="default" namespace="/login" extends="struts-default"> <action name="myLogin" class="test.action.LoginAction"> <result name="input">/index.jsp&l... 阅读全文
posted @ 2010-11-21 13:52 庚武 阅读(1608) 评论(0) 推荐(0) 编辑
摘要:The middle-tier component of the Java EE architecture consists of an application server often fronted by a web server. These servers serve up web content and execute servlets and JSP pages in response... 阅读全文
posted @ 2010-11-15 18:21 庚武 阅读(240) 评论(0) 推荐(0) 编辑
摘要:package tags;import java.util.Collection;import java.util.Iterator;import javax.servlet.jsp.JspException;import javax.servlet.jsp.tagext.TagSupport;public class IteratorTag extends TagSupport { privat... 阅读全文
posted @ 2010-11-13 19:48 庚武 阅读(454) 评论(0) 推荐(0) 编辑
摘要:[代码]Simple Tag[代码] 阅读全文
posted @ 2010-11-13 18:34 庚武 阅读(339) 评论(0) 推荐(0) 编辑
摘要:package test;import java.sql.*;public class TestJdbcForSqlserver2008 { /** * @param args */ public static void main(String[] args) { final String JDriver = "com.microsoft.sqlserver.jdbc.SQLServerDr... 阅读全文
posted @ 2010-11-13 10:36 庚武 阅读(1200) 评论(0) 推荐(0) 编辑
摘要:The JSTL is often referred to as a single tag library when in fact it's a collection of four tag libraries. Each tag library provides useful actions (or tags) based on the following functional areas:C... 阅读全文
posted @ 2010-11-11 18:18 庚武 阅读(130) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 下一页