`
DavyJones2010
  • 浏览: 154139 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论
文章列表
1. Debug无法开启:   ERROR:transport error 202: gethostbyname: unknown host A configuration error occurred during startup. Please verify the preference field with the prompt: ERROR: transport error 202: gethostbyname: unknown host ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT( ...
All the functionality of ClassLoader is nested in org.apache.catalina.loader.WebappClassLoader 1) Structure of WebappClassLoader public class WebappClassLoader extends URLClassLoader implements Lifecycle{ /** * The cache of ResourceEntry for classes and resources we have loaded ...
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 pattern in ServletModule, they will be created by Guice instead, their service() will called by guice f ...
  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 English, broke up with my beloved ex-girlfriend and then fall in love with the girl who loves me so much. ...
1) Act as a simple log interceptor: public class DynamicProxy { private static final Logger logger = Logger.getLogger(DynamicProxy.class); @SuppressWarnings("unchecked") @Test public void useProxyTest() { String str = "Hello world"; LoggingInvocationHandler handle ...

SCJP

  1> Wrapper     1) Boxing, ==, and equals() public class WrapperTest { @Test public void integerEqualsTest() { assertFalse(new Integer(127) == new Integer(127)); assertTrue((new Integer(127)).equals(new Integer(127))); Integer i = 127; Integer j = 127; assertTrue(i == j) ...
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 // recurisive sort file size under current folder 2. Sort file by siz ...
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 Sort (Reduced comparison count and move record time)     4> Shell's Sort 2. Swap Sort     1> Bu ...
  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<Character, ? extends Traversable> getChildren(); }   package edu.xmu.guava.jcip; import java.ut ...
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 activity is cancellable if external code can move it to completion before its normal completion. There ...
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 subsequent lock on that same monitor.     3) A write to a volatile field happens before every subsequen ...
Use the Advanced Concurrent Tools instead of the legacy wait() and notify(). Java Advanced Concurrent Tools:     1> Executor Framework: ExecutorService, Callable, Executors ...     2> Concurrent Collection: ConcurrentMap, BlockingQueue ... (Is there any ConcurrentSet*(1) and ConcurrentList ...
1.  public String convertExcelToCsv(File uploadedFile, String reportType) throws InvalidFormatException, IOException, InterruptedException { logger.info(String .format("Start convertExcelToCsv, uploadedFile.name: [%s], reportTYpe: [%s]", ...
1. Risks of Threads:     1> Safety Hazards          We can add annotation: @NotThreadSafe, @ThreadSafe, @Immutable     2> Liveness Hazards          Deadlock, Starvation, Livelock          Bugs that cause liveness failures can be elusive because they depend on the relative timing of event ...
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 closed and no thread can pass, and in the terminal state the gate opens, allowing all threads to pas ...
Global site tag (gtag.js) - Google Analytics