- 浏览: 257436 次
- 性别:
- 来自: 北京
-
最新评论
-
Nabulio:
厉害
tomcat 源码学习 -
zbz:
例子很简单,可是怎么设置访问账号和密码呢?注释掉的那段不起作用 ...
jmx 实例--最简单的例子 -
zk302:
格式可以优化下
sql-经典例子练习 -
tuspark:
eclipse的访问控制图标,可以看这篇《eclipse的访问 ...
Eclipse(四)常用设置 -
xlshl43:
流比呀。。。但这排版看的有点蛋疼。。。
Java核心代码(二)Class loader
文章列表
Semaphore.acquire():最多n个运行,与Executors.newFixedThreadPool( 2 )作用相似
CyclicBarrier.await(): 加到n才开始
CountDownLatch.await(): 减到0才开始
/**
* CyclicBarrier.await(): Waits until all parties have invoked await on this barrier.
* @author timeriver.wang
* @date Mar 10, 2014 10:43:52 AM
*/
public ...
Semaphore.acquire():Acquires a permit from this semaphore, blocking until one is available
与Executors.newFixedThreadPool( 2 )作用相似
CyclicBarrier.await(): Waits until all parties have invoked await on this barrier.
CountDownLatch.await(): Causes the current thread to wait until the latch has coun ...
Semaphore.acquire():Acquires a permit from this semaphore, blocking until one is available
与Executors.newFixedThreadPool( 2 )作用相似
CyclicBarrier.await(): Waits until all parties have invoked await on this barrier.
CountDownLatch.await(): Causes the current thread to wait until the latch has coun ...
/**
* 3个线程,依次执行
* @author timeriver.wang
* @date 2014-03-10 2:06:19 PM
*/
public class ThreeThreadCommunication {
public static void main( String[] args ) {
final Bunnies bunnies = new Bunnies();
new Thread( new Runnable() {
public void run() {
...
被加锁的对象是共享数据,不是线程
1,put,get方法入口处设置断点,debug验证:可以同时有2个读线程,但最多只能有一个写线程
2,用ReentrantReadWriteLock实现线程安全的cache
/**
* @author timeriver.wang
* @date 2014-03-10 1:37:11 PM
*/
public class ReadWriteLockTest {
public static void main(String[] args) {
final Queue3 q3 = new Queue3();
fo ...
1,swing 优于 awt,SWT最优(Standard Widget Toolkit, Swing/AWT的非标准替代者)
2,swing框架
Object
java.awt.Component
--PropertyChangeSupport changeSupport;firePropertyChange
java.awt.Container
javax.swing.JComponent 窗口上的组件
...
1,创建接口及实现类
package com.timeriver.classloader;
/**
* @author rivertime.wang
* @date 2014-3-9 上午10:17:04
*/
public interface IPluginModule {
public void helloWorld();
}
public class AModule implements IPluginModule{
@Override
public void helloWorld() {
System ...
/**
* 构造线程的2种方式,第三个线程是混合方式
*
* @author timeriver.wang
* @date Mar 10, 2014 3:11:05 PM
*/
public class TraditionThread {
public static void main( String[] args ) {
/**
* 也可以用匿名内部类(new 父类或接口),不一定非要extends
*/
Thread thread = new Thread() {
...
JAXB(三)xsd 验证
- 博客分类:
- JAVA-JAXB
现在只有最简单的关联映射验证,
关键点:jaxbMarshaller.setSchema( sch );
还不会验证集合类型:List,Set,Map,以后再把JAXB(二)的例子加上,
/**
* @author timeriver.wang
* @date 2014-03-06 0:57:01 AM
*/
@XmlRootElement
public class Address {
private String area;
private String street;
@XmlElement(nam ...
JAXB(二)Map属性映射
- 博客分类:
- JAVA-JAXB
//JAXB support Collection(List,Set),does not support Map(not Collection).
//XmlAdapter<ValueType,BoundType> : !use List to implement Map's feature,like (List students)!!!
//<ValueType> : to be persisted format, The type that JAXB knows how to handle out of the box
//<BoundType& ...
JAXB(一)入门--概述,简单例子
- 博客分类:
- JAVA-JAXB
JAXB(Java Architecture for XML Binding)
主要方法:Marshaller的marshal()方法,
// marshal 整理,编列,元帅的意思
/**
* @author timeriver.wang
* @date 2013-01-09 8:07:01 PM
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Student {
private String id;
private String name;
pub ...
Windows 模拟生成日志 命令
- 博客分类:
- OS-windows
转自http://technet.microsoft.com/en-us/library/bb490899.aspx,用来备份
例子:
eventcreate /t error /id 100 /l application /d "Create event in application log"
eventcreate /t information /id 1000 /so winmgmt /d "Create event in WinMgmt source" eventcreate /t error /id 2001 /so winwor ...