Java程序员修炼之道
最新书摘:
-
Marble Arch2013-11-20模因(Meme)也称弥,是文化资讯传承单位。
-
Marble Arch2013-11-20一个非常强的理论:不可能在没出现的源码中弄出bug来。
-
[已注销]2012-07-26A fake object can be seen as an enhanced stub that almost does the same work as your production code, but that takes a few shortcuts in order to fulfill your testing requirements.
-
[已注销]2012-07-26Escape analysis is, at first sight, quite a surprising idea. The basic idea is to analyze a method and see which local variables (of reference type) are only used inside themethod, determining which variables aren’t passed in to other methods or returnedfrom the current method.
-
[已注销]2012-07-26The large jumps in the Linux timings turn out to be due to discrepancies between the TSC counters held on different CPUs. The JVM will periodically suspend the running Java thread and migrate it to running on a different core
-
[已注销]2012-07-26An invokedynamic instruction starts off without a target method—it’s said to beunlinked. The first time that the call is executed, the bootstrap method for the site iscalled. The bootstrap method returns a CallSite, which is then linked to the invokedynamicinstruction. This can be seen in figure 5.5.
-
[已注销]2012-07-26javac won’t emit invokedynamicThere is no direct Java language support for invokedynamic in Java 7 — no Javaexpression will be directly compiled into an invokedynamic bytecode by javac.
-
[已注销]2012-07-26TimSortWith the arrival of Java 7, the default sort algorithm for arrays has changed. Previouslyit had been a form of QuickSort, but with Java 7 it has become “TimSort”—aversion of MergeSort that has been hybridized with an insertion sort. TimSort wasoriginally developed for Python by Tim Peters, and it has been the default sort inPython since version 2.3 (2002).Want to see evidence of TimSort’s presence in Java 7? Just pass a null array ofUpdate objects into listing 4.16. The comparisons inside the array sorting routineArrays.sort() will fail with a null pointer exception, and you’ll see the TimSortclasses in the stack trace.
-
[已注销]2012-07-26If we were going to reengineer the support for locks, there are several things we could potentially change for the better:■ Add different types of locks (such as reader and writer locks).■ Not restrict locks to blocks (allow a lock in one method and unlock in another). 这个倒是不错,只能在C/C++里做到吧■ If a thread cannot acquire a lock (for example, if another thread has the lock), allow the thread to back out or carry on or do something else—a try-Lock() method.■ Allow a thread to attempt to acquire a lock and give up after a certain amount of time.
-
[已注销]2012-07-26The javax.inject package consists of five annotation types (@Inject, @Qualifier,@Named, @Scope, and @Singleton) and a single Provider<T> interface.