This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 使用如下命令运行: | |
* java -XX:+UseBiasedLocking //开启偏向锁,如果关闭用 -XX:-UseBiasedLocking | |
* -XX:+UnlockDiagnosticVMOptions //打开诊断模式,才能使用PrintBiasedLockingStatistics打印偏向锁信息 | |
* -XX:+PrintBiasedLockingStatistics//在C1中打印偏向锁信息 | |
* -XX:TieredStopAtLevel=1 //设置JIT编译器为C1 | |
* -XX:BiasedLockingStartupDelay=0 //关闭偏向锁启动延时,jdk6有4秒延时,4秒内用lightweight,4秒后才开始启动biased lock | |
* BiasedLockAndHashCodeTest | |
*/ | |
public class BiasedLockAndHashCodeTest { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|----------------------------------------------------------------------------------------|--------------------| | |
| Object Header (64 bits) | State | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| Mark Word (32 bits) | Klass Word (32 bits) | | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| identity_hashcode:25 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| thread:23 | epoch:2 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased | | |
|-------------------------------------------------------|--------------------------------|--------------------| | |
| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
phpinfo(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract Counter{ | |
uint public count=10; | |
function inc(uint num) public returns (uint){ | |
return count+=num; | |
} | |
} | |
contract CallCounter{ | |
uint public count=20; | |
function callByAddr(address addr) public returns(uint){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FreemarkerModelInterceptor implements HandlerInterceptor { | |
private static final Logger logger = LoggerFactory.getLogger(FreemarkerModelInterceptor.class); | |
private Map<String, String> utilClasses; | |
private TemplateHashModel staticModels; | |
public FreemarkerModelInterceptor() { | |
BeansWrapperBuilder builder = new BeansWrapperBuilder(Configuration.VERSION_2_3_26); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<? extends Number> extendsList = null; | |
List<? super Number> superList = null; | |
List<Object> objList = null; | |
List<Number> numberList = null; | |
List<Integer> integerList = null; | |
//extendsList=objList; //compile error | |
extendsList = numberList; | |
extendsList = integerList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A<T extends Comparable & List> { | |
public void test(T t) { | |
t.add("cc"); | |
} | |
} | |
public class Test { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DateTime dateTime = DateTime.now().plusSeconds(2); | |
Supplier<String> supplier = Suppliers.memoizeWithExpiration(() -> { | |
DateTime now = DateTime.now(); | |
if (now.getSecondOfDay() == dateTime.getSecondOfDay()) { | |
throw new RuntimeException("haha~~" + now.toString("yyyy-MM-hh HH:mm:ss")); | |
} | |
return "time:" + now.toString("yyy-MM-dd HH:mm:ss"); | |
}, 1, TimeUnit.SECONDS); | |
for (int i = 0; i < 10; i++) { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="InspectionProjectProfileManager"> | |
<profile version="1.0"> | |
<option name="myName" value="JD_PLT_EXT" /> | |
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false"> | |
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" /> | |
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" /> | |
</inspection_tool> | |
<inspection_tool class="MissortedModifiers" enabled="true" level="WARNING" enabled_by_default="true"> | |
<option name="m_requireAnnotationsFirst" value="true" /> | |
</inspection_tool> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<code_scheme name="JD_PLT_EXT_codeStyle"> | |
<option name="LINE_SEPARATOR" value="
" /> | |
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="100" /> | |
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="100" /> | |
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND"> | |
<value /> | |
</option> | |
<option name="IMPORT_LAYOUT_TABLE"> | |
<value> | |
<package name="" withSubpackages="true" static="true" /> |
NewerOlder