- 博客(146)
- 资源 (2)
- 收藏
- 关注
错误收集
1. Debug无法开启: ERROR:transport error 202: gethostbyname: unknown hostA configuration error occurred during startup. Please verify the preference field with the prompt: ERROR: transport error 20...
2016-07-21 10:34:38
204
原创 Tomcat 5.0.18 ClassLoader source code insight
All the functionality of ClassLoader is nested in org.apache.catalina.loader.WebappClassLoader1) Structure of WebappClassLoaderpublic class WebappClassLoader extends URLClassLoader imp...
2015-07-13 21:38:04
192
原创 Guice Webapp Insight
guice web dataflow:Basic Design Concept: 1) HttpRequest/HttpResponse will always be created by WebContainer(jetty/tomcat) and Guice will reuse/wrap them. 2) For Servlet that match the url pa...
2015-07-01 19:29:06
172
原创 2014 Year in Review
The passed 2014 is a really tough and struggling year for me. During the course of previous 12 months, I wrote a dozens of tec blogs, read a handful books, practiced listening and speaking Engl...
2015-01-13 10:27:17
212
原创 Java Dynamic Proxy
1) Act as a simple log interceptor:public class DynamicProxy { private static final Logger logger = Logger.getLogger(DynamicProxy.class); @SuppressWarnings("unchecked") @Test public void u...
2015-01-06 15:09:30
160
原创 SCJP
1> Wrapper 1) Boxing, ==, and equals()public class WrapperTest { @Test public void integerEqualsTest() { assertFalse(new Integer(127) == new Integer(127)); assertTrue((new Int...
2014-12-26 09:58:09
266
原创 Linux: Frequently used command
1. List disk space usage:df -hl// "l" means "local", limit listing to local file systems// "h" means "human-readable", print sizes in human readable format du -cks *|sort -rn|head// recuri...
2014-11-03 17:05:56
172
原创 Java Algorithm: Sorting
1. Insertion Sort 1> Straight Insertion Sort: O(n^2), if the records are already sorted, then O(n). 2> Binary Insertion Sort (Reduced comparison count) 3> 2-Way Insertion Sor...
2014-09-27 18:07:38
186
原创 A simple implementation of "Input Method" in Java
package edu.xmu.guava.jcip;import java.util.Map;public interface Traversable { public void addWord(String word, int index); public Traversable getNext(Character c); public Map<Cha...
2014-09-26 19:49:24
155
原创 Java Concurrency: Cancellation and Shutdown
Dealing well with failure, shutdown, and cancellation is one of the characteristics that distinguishes a well-behaved application from one that merely works. 1> Task Cancellation: An ac...
2014-09-21 21:54:49
211
原创 Java Concurrency: Java Memory Model
1. Happen Before Operation: 1) Each action in a thread happens before every action in that thread that comes later in the program's order. 2) An unlock on a monitor happens before every sub...
2014-09-20 20:51:35
146
原创 Java SE: Effective Java Notes "Concurrency"
Use the Advanced Concurrent Tools instead of the legacy wait() and notify().Java Advanced Concurrent Tools: 1> Executor Framework: ExecutorService, Callable, Executors ... 2> Concu...
2014-09-12 15:33:12
154
原创 Java POI: Convert Excel to CSV by XSSFReader
1. public String convertExcelToCsv(File uploadedFile, String reportType) throws InvalidFormatException, IOException, InterruptedException { logger.info(String ...
2014-09-12 09:47:24
382
原创 Java Concurrency: JCIP Notes
1. Risks of Threads: 1> Safety Hazards We can add annotation: @NotThreadSafe, @ThreadSafe, @Immutable 2> Liveness Hazards Deadlock, Starvation, Livelock ...
2014-09-12 09:31:50
188
原创 Java Concurrency: Latches & Barriers
Latches: A latch is a synchronizer that can delay the process of threads until it reaches its terminal state. A latch acts as a gate: until the latch reaches the terminal state the gate is...
2014-09-03 22:45:15
181
原创 Java SE: How to iterate Stack
How to iterate a stack in Java? 1> Pitfall: Using iterator to iterate Stack@Testpublic void iterateTest() { Stack<String> stack = new Stack<String>(); stack.push("I...
2014-09-02 22:03:28
159
Java SE: Effective Java Notes "Methods"
Effective Java 2nd Edition, Chapter 7, Item 42Be careful when using var args. Do not abuse var args in our custmoized methods.1) Painful Arrays.asList for Primitive Typespackage edu.xmu.guava.c...
2014-08-28 19:35:53
137
原创 Java SE: Tips
1. How to compare equals for two List: 1> Writing boiler plate code 2> Use org.apache.commons.collections.ListUtils.isEqualList() Benefit: Help us handle boiler plate code ...
2014-08-28 09:41:02
186
原创 Guava: Cache
1> MapMaker for creating ConcurrentMap instances.2> CacheBuilder for creating LoadingCache and Cache instances.3> CacheBuilderSpec for creating CacheBuilder instance from a formatted st...
2014-08-26 22:53:24
217
原创 Java SE: hashCode() & equals() and HashMap
1. Both hashCode() and equals() are defined in Object:public native int hashCode();public boolean equals(Object obj) { return (this == obj);} If our customized object doesn't override...
2014-08-15 17:34:02
147
原创 Java SE: Bitwise and Bit Shift Operations
1. Java provides operators to perform bitwise and bit shift operations on int type. The operators discussed in the section are less commonly used, the intent is to simply make you aware that th...
2014-07-30 22:12:46
184
原创 Guava: Working with Collections II
1. Table2. ImmutableCollections3. Comparision Chain & Range4. Ordering 1. Table: Map<R, Map<C, V>> 1> Create tablepackage edu.xmu.guava.collection;import stat...
2014-07-21 23:33:15
145
原创 Design Pattern: Builder Pattern
Builder Pattern: The builder pattern is a design pattern that allows for the step-by-step creation of complex objects using the correct sequence of actions. The construction is controlled...
2014-07-21 15:39:55
197
原创 Guava: Working with Collections I
1. Classes with useful static methods for working with lists, maps and sets2. The Range class used to represent the boundaries around a continuous set of values3. Immutable Collections4. Bimap...
2014-07-19 17:25:31
158
原创 Missions for 2014
1. Books to read: 1) Technology related 1> Getting Started with Google Guava -Bill Bejeck 2> Google Guice -Robbie Vanbrabant -Pending to Next Year 3> Effecti...
2014-07-18 17:52:16
178
原创 Guru's Excerpt
1) "Prefer composition to Inherentance."--From GOF 2) A word about checked exceptions: The great value of exceptions is the unification of error reporting: a standard machanism by which t...
2014-07-18 17:25:33
143
原创 Question List
1) How to start jetty in Maven?http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin#http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#maven-http-connector<proj...
2014-07-18 16:38:26
377
原创 Guava: Functional Programming with Guava
1. Function<F, T> & Functions2. Predicate<T> & Predicates3. Supplier<T> & Suppliers 1. Function & Functions 1> Function With Java in its curren...
2014-07-18 11:59:00
140
原创 Guava: Joiner & Splitter
1. Joiner Comparasion between traditional approach and Guava approach: @Test public void buildStringTest() { List<String> data = Lists.newArrayList("A", "B", "C", null, "D", "...
2014-07-17 17:02:20
136
Java SE: How to Decompress File (.zip)
import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.util.ArrayList;import java.util.List;...
2014-07-11 17:07:04
207
原创 Design Pattern: Decorator Pattern
Decorator Pattern 1) Motivation: Extending an object's functionality can be done statically (at compile time) by using inherientence. However it might be necessary to extend an object's fun...
2014-07-06 23:03:21
226
原创 Java: Primitive Types
Primitive Types:1) byte: size: 8-Bit = 1-Byte range: -128~+127 usage: 1> The byte data type can be useful for saving memory in large arrays, where memory saving actually...
2014-07-06 22:19:18
161
原创 DesignPattern: Composite Pattern
Composite Design Pattern1) Motivation: There are many times when a program need to manipulate a tree data structure and it is necessary to treat both Branches as well as Leaf Nodes unifor...
2014-07-06 17:23:36
189
原创 UML: Dependency, Association, Aggregation and Composition
1. Dependency: A dependency is a weak relationship between two classes. In this example, there is dependency between Point and LineSegment, because LineSegment's draw() operation u...
2014-07-06 13:21:20
363
1
原创 Eclipse: How to build a web project with Eclipse And Maven
1 Using Eclipse 1) Create project using archetype: maven-archetype-webapp 2) Update Build Path Using JDK-1.7 and Compiler Level to 1.7 3) Add "javax.servlet" dependency in pom.xml...
2014-06-22 11:03:07
163
原创 Spring Batch: Intro II -- Read-Write-Process for Derby
1. In the following example, we will read data from multiple csv files and then write to Derby DB. 1) In order to read from multiple csv, we need "org.springframework.batch.item.file.MultiResou...
2014-06-20 14:53:39
156
原创 Spring Batch: Intro I -- Tasklet & Read-Process-Write example
1. Intro to Spring Batch 1) Spring Batch is a framework for Batch Processing - Execution of a series of Jobs. 2) Each "Job" contains many "Steps". And one "Step" can be a single "tasklet" ...
2014-06-20 14:33:32
273
原创 Java SE: Concurrency Utils DelayQueue
1) DelayQueue class implements the BlockingQueue interface. The DelayQueue keeps the elements internally until a certain delay has expired. The elements must implement the interface java.u...
2014-06-09 16:42:34
139
原创 Java SE: String.replaceAll() with special character "$"
1. Problem Description: When replacement contains "$", either IllegalArgumentException or StringIndexOutOfBoundsException will be thrown. The reason is that replaceAll() is not simply char...
2014-06-03 10:55:10
190
原创 Java Concurrency: Thread&Locks
Synchronized & ReentrantLock 1) Basic Thread Operations 1) void notifyAll() 1> unblocks the threads that called wait on this object. 2> This method can only be...
2014-05-27 15:19:10
147
SCJP6StudyGuide
2015-05-12
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人