- 博客(169)
- 收藏
- 关注
原创 方法替换MethodReplacer
package com.astute.sparrow.spring.ioc.method_injection;import org.springframework.beans.BeansException;import org.springframework.beans.factory.BeanFactory;import org.springframework.bea...
2011-06-19 10:08:28
280
原创 ObjectFactoryCreatingFactoryBean
package com.astute.sparrow.spring.ioc.method_injection;import org.springframework.beans.BeansException;import org.springframework.beans.factory.BeanFactory;import org.springframework.beans....
2011-06-18 21:43:37
569
原创 ObjectFactoryCreatingFactoryBean
/** * A FactoryBean implementation that * returns a value which is an ObjectFactory * that in turn returns a bean sourced from a BeanFactory. * * As such, this may be used to avoid having...
2011-06-18 21:22:11
336
原创 BeanFactoryAware
package com.astute.sparrow.spring.ioc.method_injection;import org.springframework.beans.BeansException;import org.springframework.beans.factory.BeanFactory;import org.springframework.beans....
2011-06-18 20:24:09
144
原创 Spring方法注入method_injection
package com.astute.sparrow.spring.ioc.method_injection;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Qualifier;import org...
2011-06-18 19:37:38
261
原创 Spring类路径扫描注入Bean
package com.astute.sparrow.spring.ioc.method_injection;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Qualifier;import org...
2011-06-18 19:00:28
487
原创 Spring xml注入
构造方法注入:<bean id="a" class="com.astute.sparrow.spring.ioc.test.A"> <constructor-arg type="int"> <value>12345</value> </constructor-arg> <
2011-06-18 13:15:53
161
原创 Spring ioc注解方式获取bean
package com.ls.spring.ioc.dummy;import org.springframework.stereotype.Component;@Componentpublic class B { public void put() { System.out.println("B is outing..."); } }pa...
2011-06-18 09:19:52
366
原创 xml配置格式加载
package com.ls.spring.ioc.dummy;import org.springframework.stereotype.Component;@Componentpublic class B { public void put() { System.out.println("B is outing..."); } }pa...
2011-06-18 09:17:41
145
原创 Properties配置格式加载
package com.ls.spring.ioc.dummy;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component;@Componentpublic class A { @Autowired p...
2011-06-18 09:15:39
149
原创 使用编码方式创建和绑定Bean
package com.astute.sparrow.spring.ioc.test;public class B { public void output() { System.out.println("B.output"); } } package com.astute.sparrow.spring.ioc.test;publ...
2011-06-17 13:31:19
152
原创 eclipse快捷键
1. Ctrl + / 所选择的行用 "//"注释2. Ctrl + Shift + / 所选择的行 用 "/* */" 来注释3. Alt + / 补全提示 , 参数提示, 方法提示4 Ctrl + d 删除整行5 ctrl + F11 快速运行6 全局 调试上次启动 F11 7 ctrl + shift + o 自动导入未导入(import)的类。8 全局 单...
2011-06-15 16:31:28
115
原创 免安装Oracle客户端使用PL/SQL连接Oracle
免安装Oracle客户端使用PL/SQL连接Oracle 免安装Oracle客户端使用PL/SQL连接Oracle 大家都知道,用PL/SQL连接Oracle,是需要安装Oracle客户端软件的。有没要想过不安装Oracle客户端直接连接Oracle呢? 利用Oracle 提供的Instant Client Package 只需要在Oracle下载...
2011-06-14 16:09:11
126
原创 NIO字符集操作
示例程序在打开相应的文件、将输入数据读入名为 inputData 的 ByteBuffer 之后,我们的程序必须创建 ISO-8859-1 (Latin1) 字符集的一个实例:Charset latin1 = Charset.forName( "ISO-8859-1" );然后,创建一个解码器(用于读取)和一个编码器 (用于写入):CharsetDecod...
2011-05-16 01:30:16
168
原创 MultiPortEcho ibm dw nio入门异步io的例子
ibm dw nio入门异步io的例子 package com.ls.java.newio;import java.io.*;import java.net.*;import java.nio.*;import java.nio.channels.*;import java.util.*;public class MultiPortEcho { priv...
2011-05-15 23:05:49
196
原创 NIO Buffer Slice
package com.ls.java.newio;import java.nio.ByteBuffer;public class TestSlice { public static void main(String[] args) { ByteBuffer buffer = ByteBuffer.allocate(10); for(int i=0...
2011-05-15 19:40:57
213
原创 java.nio.charset.Charset
package com.ls.java.newio;import java.io.IOException;import java.net.InetSocketAddress;import java.nio.ByteBuffer;import java.nio.channels.SocketChannel;import java.nio.charset.Charset;...
2011-05-15 08:16:48
1056
原创 Java NIO入门
package com.ls.java.newio;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.nio.ByteBuffer;imp...
2011-05-15 07:20:15
107
原创 AbstractOwnableSynchronizer
/**A synchronizer that may be exclusively owned by a thread. This * class provides a basis for creating locks and related synchronizers * that may entail a notion of ownership. The * Abstra...
2011-05-14 09:01:06
162
原创 FutureTask&Sync innerRun
/** * The thread running task. When nulled after set/cancel, this * indicates that the results are accessible. Must be * volatile, to ensure visibility upon completio...
2011-05-14 08:25:38
157
原创 CountDownLatch 2
package com.ls.java_concurrency.countdownlatch;import java.util.concurrent.BlockingQueue;import java.util.concurrent.CountDownLatch;import java.util.concurrent.Executors;import java.ut...
2011-05-13 21:42:37
234
原创 CountDownLatch
package com.ls.java_concurrency.countdownlatch;import java.util.concurrent.CountDownLatch;/** * The first is a start signal that prevents any worker from proceeding * until the driver is r...
2011-05-13 21:41:55
74
原创 CountDownLatch CyclicBarrier
package com.ls.java_concurrency.threadpoolexecutor;import java.util.concurrent.BlockingQueue;import java.util.concurrent.CountDownLatch;import java.util.concurrent.CyclicBarrier;import ja...
2011-05-13 21:40:50
85
原创 compareAndSwapObject
/** *比较并更新对象的某一个整数类型的域 *@param obj 被操作的对象 *@param fieldoffset 被操作的域在对象中的偏移量 *@param expect 域的期望值 *@param update 域的更新值 */ boolean compareAndSwapInt(Object obj,long fieldoffset, int expec...
2011-05-10 12:50:11
2224
原创 ConcurrentHashMap
/***The basic strategy is to subdivide the table among Segments,*each of which itself is a concurrently readable hash table.*/public class ConcurrentHashMap<K, V> extends AbstractMap&...
2011-05-10 04:08:25
66
原创 TreeMap
TreeMap是基于红黑树实现的,无容量限制;TreeMap是非线程安全的; public V put(K key, V value) { Entry<K,V> t = root; if (t == null) { // TBD: // 5045147: (coll) Adding null to an empty...
2011-05-10 02:18:01
111
原创 HashMap put
/** * Offloaded version of put for null keys */ private V putForNullKey(V value) { for (Entry<K,V> e = table[0]; e != null; e = e.next) { if (e.key == n...
2011-05-10 01:22:47
97
原创 HashMap内部Entry实现类
static class Entry<K,V> implements Map.Entry<K,V> { final K key; V value; Entry<K,V> next; final int hash; /** * Creates n...
2011-05-10 00:45:02
565
原创 HashMap初始化
public HashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new IllegalArgumentException("Illegal initial capacity: " + ...
2011-05-10 00:42:59
166
原创 HashMap,基于数组来存储数据
HashMap采用数组方式存储key,value构成的Entry,无容量限制;HashMap基于key hash寻找entry对象存放到数组的位置,对于hash冲突采用链表的方式来解决;HashMap在插入元素时可能会要扩大数组的容量,在扩大容量时要重新计算hash,并复制对象到新的数组中;HashMap是非线程安全的;写道Hash table based impleme...
2011-05-10 00:19:17
646
原创 TreeSet,基于TreeMap实现
TreeSet基于TreeMap实现,支持排序;TreeSet是非线程安全的; public class TreeSet<E> extends AbstractSet<E> implements NavigableSet<E>, Cloneable, java.io.Serializable{ /** * The ...
2011-05-09 23:53:28
324
原创 HashSet
Set和List最明显的区别在于Set不允许元素重复,而List允许。Set为了做到不允许元素重复,采用的是基于HashMap来实现。HashSet是非线程安全的。 public class HashSet<E> extends AbstractSet<E> implements Set<E>, Cloneable, java...
2011-05-09 23:03:34
85
原创 Stack
Stack基于Vector实现,支持LIFO。实际上栈是一种抽象数据类型。 publicclass Stack<E> extends Vector<E> { /** * Creates an empty Stack. */ public Stack() { } /** * Pushe...
2011-05-09 22:52:45
152
原创 Vector线程安全的ArrayList
public class Vector<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable{ /** * The array buffer into which the comp...
2011-05-09 22:23:38
97
原创 LinkedList
/*** All of the operations perform as could be expected for a doubly-linked * list. Operations that index into the list will traverse the list from * the beginning or the end, whichever is c...
2011-05-09 21:58:23
78
原创 AbstractList modCount
/** * The number of times this list has been <i>structurally modified</i>. * Structural modifications are those that change the size of the * list, or otherwise perturb i...
2011-05-09 21:38:46
427
原创 AbstractList
/** * Returns an iterator over the elements in this list in proper sequence. * * <p>This implementation returns a straightforward implementation of the * iterator inter...
2011-05-09 21:24:43
80
原创 ArrayList
public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable{ private static final long serialVersionUID = 8683...
2011-05-09 21:16:27
67
原创 WeakHashMap相关
本文将深入地介绍关于引用对象(Reference Objects)的知识。基本上说,引用对象提供了一种对象间接引用所需内存的方式,这些引用对象保存在一个引用对象中(类ReferenceQuene),它监视这些引用对象使得其可以访问。基于这种类型的引用对象,垃圾回收器能够释放内存,而一般的对象引用则可能无法释放。在Java中,有四种类型的对象引用。常用的是直接引用,如: Object o...
2011-05-05 15:06:18
70
原创 Java泛型
Java泛型(generics)是JDK 5中引入的一个新特性,允许在定义类和接口的时候使用类型参数(type parameter)。声明的类型参数在使用时用具体的类型来替换。泛型最主要的应用是在JDK 5中的新集合类框架中。对于泛型概念的引入,开发社区的观点是褒贬不一。从好的方面来说,泛型的引入可以解决之前的集合类框架在使用过程中通常会出现的运行时刻类型错误,因为编译器可以在编译时刻就发现很多明...
2011-05-04 18:58:08
76
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人