`
文章列表
    ApplicationContext easy creation and bean retrieve =================================================  context = new ClassPathXmlApplicationContext(new String[] {"classpath:com/citigroup/eqtg/mamba/quoteengine/ connection/messageListener/rfq/orderCancelJobTest.xml"}); Assert.asse ...

Buffer

4 attributes of Buffer   capacity -- the size of buffer limit -- 1st element is used to store how many elements are there in the buffer position -- current position to be read or written. (Just let the notion of Iterator, when you call iter.next()) mark -- util attribute, very useful for program ...
以前实习的时候用过JAXB1.x,据说JAXB2.0使用了Java 5.0的新特性,例如注解、泛型,使得JAXB更容易使用,于是从网上下来试了一下: 从https://jaxb.dev.java.net/servlets/ProjectDocumentList?folderID=6344&expandFolder=6344&folderID=0下载到JAXB2_20061115.jar,为了方便使用把JAXB2_20061115.jar拷到工程中,本事例使用Eclipse开发,工程目录为:D:\eclipse\workspace\JaxbTest,可以新建一个目录jaxb来存放 ...
java.util.concurrent.CyclicBarrier A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point. CyclicBarriers are useful in programs involving a fixed sized party of threads that must occasionally wait for each other. The barrier is called cyclic be ...
/**  * A standard implementation for Delayed interface   *  *
Key point :   1) 1 task is composed of several portion.   2) every portion finished, the portion will call latch.countDown()   3) Threads depending on this task will call latch.await()   4) latch will be initialized using portion number, countDown() will decrese the number, when the number re ...
1) supply special resources.   This resource can be only used by one special thread.   2) permit held up resources can be required by other threads.   threads manager should be able to signal interrupt command to let locked up threads giving up resources.   3) resources have different level ...
Q: modifier in $ (/) A: Don't use $PATH, instead, use ${PATH}    
3 implementations: LinkedBlockingQueue, ArrayBlockingQueue, SynchronousQueue,     About threading communication, use wait()/notify()/notifyAll() is really quite low level. And it's error-prone, and it's difficult to debug.   In java5, we strongly suggest using BlockingQueue to take the place of ...
//: concurrency/waxomatic2/WaxOMatic2.java // Using Lock and Condition objects. package concurrency.waxomatic2;   import static java.lang.System.out; import java.util.concurrent.ExecutorService;
 a thread can be really interrupted by aThread.interrupt() only under 1 situation -- in blocked status wrapped with catch(InterruptedException e) {...}. Precisely,    a) aThread.sleep();  b) aObject.wait();  c) BlockingQueue operations;  d) Lock.lockInterruptibly();   Regarding d). When a th ...
In Java 5, Thread.interrupt() is not encouraged. Instead, you are encouraged to use <1st way> aExecutorService.shutdownnow(); <2nd way> aFuture<?>.cancel(true); For the 1st way, a interrupt message is sent to all Runnables. For the 2nd way, true means, a interrupt message can ...

interrupt

1) Each thread has a boolean interrupted status.   2) 3 interrupt related methods defined in Thread class   public class Thread {     public void interrupt() {...} // interrupts the target thread       public boolean isInterrupted() {...} //return the interrupted status of the target thread. ...
ExecutorService exec = Executors.newCachedThreadPool(); for(int i = 0; i < 10; i++) {     exec.execute(new Entrance(i));//obviously Entrance is another class which implements Runnable } TimeUnit.SECONDS.sleep(3); // this sleep code is very elegant! exec.shutdown(); if(!exec.awaitTermination ...
ThreadLocal usage – from Javadoc This class provides thread-local variables. These variables differ from their normal counterparts in that each thread that accesses one (via its get or set method) has its own, independently initialized copy of the variable. ThreadLocal instances are typically privat ...
Global site tag (gtag.js) - Google Analytics