锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产AV日韩A∨亚洲AV电影,亚洲av乱码中文一区二区三区,水蜜桃亚洲一二三四在线 http://m.tkk7.com/miaoyachun/category/50699.htmlzh-cn Fri, 08 Dec 2017 06:50:38 GMT Fri, 08 Dec 2017 06:50:38 GMT 60 Spring boot澶栭儴閰嶇疆-閰嶇疆涓績鍖?/title> http://m.tkk7.com/miaoyachun/archive/2017/12/08/432940.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Fri, 08 Dec 2017 06:13:00 GMT http://m.tkk7.com/miaoyachun/archive/2017/12/08/432940.html http://m.tkk7.com/miaoyachun/comments/432940.html http://m.tkk7.com/miaoyachun/archive/2017/12/08/432940.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/432940.html http://m.tkk7.com/miaoyachun/services/trackbacks/432940.html /** * 閲嶈澆鍚堝茍灞炴у疄鐜?br /> * 鍏堝姞杞絝ile properties錛?鐒跺悗騫跺叆ZK閰嶇疆涓績璇誨彇鐨刾roperties * * @return 鍚堝茍鍚庣殑灞炴ч泦鍚?br /> * @throws IOException 寮傚父 */ @Override protected Properties mergeProperties () throws IOException { Properties result = new Properties(); // 鍔犺澆鐖剁被鐨勯厤緗?br /> Properties mergeProperties = super .mergeProperties(); result.putAll(mergeProperties); // 鍔犺澆浠巣k涓鍙栧埌鐨勯厤緗?br /> Map<String, String> configs = loadZkConfigs(); result.putAll(configs); return result; } 榪欎釜瀹炵幇鍦╯pring欏圭洰閲岀敤璧鋒潵榪樻槸鎸洪『鎵嬬殑, 浣嗘槸榪戞湡閮ㄥ垎spring-boot欏圭洰閲屽彂鐜拌繖縐峱laceholder鐨勫疄鐜拌窡spring boot鐨凘ConfigurationProperties(prefix = "xxx") 涓嶈兘寰堝ソ鐨勯厤鍚堝伐浣? 涔熷氨鏄睘鎬ф病鏈夎resolve澶勭悊, 鐢ˊValue鐨勬柟寮忕‘鍙互璇誨埌, 浣嗘槸@Value閰嶇疆璧鋒潵濡傛灉灞炴у鐨勮瘽榪樻槸鎸虹箒鐞愮殑, 榪樻槸鍊懼悜鐢ˊConfigurationProperties鐨刾refix, 浜庢槸鐪嬩簡涓媠pring boot鐨勬枃妗e彂鐜?code>PropertySource order:
* Devtools global settings properties on your home directory (~/.spring-boot-devtools.properties when devtools is active). * @TestPropertySource annotations on your tests. * @SpringBootTest#properties annotation attribute on your tests. * Command line arguments. * Properties from SPRING_APPLICATION_JSON (inline JSON embedded in an environment variable or system property) * ServletConfig init parameters. * ServletContext init parameters. * JNDI attributes from java:comp/env. * Java System properties (System.getProperties()). * OS environment variables. * A RandomValuePropertySource that only has properties in random.*. * Profile-specific application properties outside of your packaged jar (application-{profile}.properties and YAML variants) * Profile-specific application properties packaged inside your jar (application-{profile}.properties and YAML variants) * Application properties outside of your packaged jar (application.properties and YAML variants). * Application properties packaged inside your jar (application.properties and YAML variants). * @PropertySource annotations on your @Configuration classes. * Default properties (specified using SpringApplication.setDefaultProperties).
涓嶉毦鍙戠幇鍏朵細媯鏌ava system propeties閲岀殑灞炴? 涔熷氨鏄, 鍙鎶妋ergerProperties璇誨埌鐨勫睘鎬у啓鍏ava system props閲屽嵆鍙? 鐪嬩簡涓嬫簮鐮? 鎵懼埌涓垏鍏ョ偣/** * 閲嶈澆澶勭悊灞炴у疄鐜?br /> * 鏍規嵁閫夐」, 鍐沖畾鏄惁灝嗗悎騫跺悗鐨刾rops鍐欏叆緋葷粺灞炴? Spring boot闇瑕?br /> * * @param beanFactoryToProcess * @param props 鍚堝茍鍚庣殑灞炴?br /> * @throws BeansException */ @Override protected void processProperties (ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException { // 鍘熸湁閫昏緫 super .processProperties(beanFactoryToProcess, props); // 鍐欏叆鍒扮郴緇熷睘鎬?br /> if (writePropsToSystem ) { // write all properties to system for spring boot Enumeration<?> propertyNames = props.propertyNames(); while (propertyNames.hasMoreElements()) { String propertyName = (String) propertyNames.nextElement(); String propertyValue = props.getProperty(propertyName); System.setProperty (propertyName, propertyValue); } } } 涓洪伩鍏嶅獎鍝嶈繃澶? 璁劇疆浜嗕釜寮鍏? 鏄惁鍐欏叆緋葷粺灞炴? 濡傛灉鏄痵pring boot鐨勯」鐩? 灝卞紑鍚? 榪欐牱瀵圭嚎涓婇潪spring boot欏圭洰鍋氬埌褰卞搷鏈灝? 鐒跺悗spring boot鐨凘ConfigurationProperties瀹岀編璇誨埌灞炴? 鍏蜂綋浠g爜瑙? org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor@Override public Object postProcessBeforeInitialization (Object bean, String beanName) throws BeansException { ConfigurationProperties annotation = AnnotationUtils .findAnnotation (bean.getClass(), ConfigurationProperties .class ); if (annotation != null ) { postProcessBeforeInitialization(bean, beanName, annotation); } annotation = this .beans .findFactoryAnnotation(beanName, ConfigurationProperties .class ); if (annotation != null ) { postProcessBeforeInitialization(bean, beanName, annotation); } return bean; } ]]> Junit @AfterClass璁塊棶娉ㄥ叆瀵硅薄鐨勬柟娉?/title> http://m.tkk7.com/miaoyachun/archive/2017/04/15/432461.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Sat, 15 Apr 2017 02:32:00 GMT http://m.tkk7.com/miaoyachun/archive/2017/04/15/432461.html http://m.tkk7.com/miaoyachun/comments/432461.html http://m.tkk7.com/miaoyachun/archive/2017/04/15/432461.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/432461.html http://m.tkk7.com/miaoyachun/services/trackbacks/432461.html S pring榛樿涓嶅厑璁稿綾葷殑鍙橀噺, 涔熷氨鏄潤鎬佸彉閲忚繘琛屾敞鍏ユ搷浣? 浣嗘槸鍦ㄦ煇浜涘満鏅瘮濡傚崟鍏冩祴璇曠殑@AfterClass瑕佽闂敞鍏ュ璞? 鑰孞unit鐨勮繖涓柟娉曞繀欏繪槸闈欐佺殑, 涔熷氨浜х敓浜嗘倴璁?瑙e喅鎬濊礬鏈変袱涓?
鎬濊礬1: 鎯沖姙娉曞闈欐佸彉閲忔敞鍏? 涔熷氨鏄粫榪嘢pring鍙兘榪愯闈為潤鎬佸彉閲忔墠鑳芥敞鍏ヤ緷璧栫殑澹佸瀿
鎬濊礬2: 鎯沖姙娉旲AfterClass鏀歸犱負闈為潤鎬?/span>
瀹炵幇Junit RunListener, 瑕嗙洊testRunFinished鏂規硶, 榪欓噷鍘誨疄鐜扮被浼粿AfterClass鐨勫姛鑳? 榪欎釜鏂規硶鏄潪闈欐佺殑
涓嶈鐢↗unit, 鏀圭敤TestNG, TestNG閲岀殑AfterClass鏄潪闈欐佺殑
鐢⊿pring鐨凾estExecutionListeners, 瀹炵幇涓狶istener, 閲岄潰涔熸湁涓被浼奸潪闈欐佺殑AfterClass鐨勫疄鐜? 瑕嗙洊瀹炵幇灝辮
鎬濊礬2鐨勫嚑涓柟娉曢兘鍙互瀹炵幇, 浣嗘槸鍗曞厓嫻嬭瘯Runner闇瑕佺敤
鑰屼笖鏀圭敤TestNG宸ョ▼嫻╁ぇ, 鍙兘鏀懼純鎺夎繖涓濊礬
緇х畫璧版濊礬1, 鍙兘鍘葷粫榪嘢pring鐨勪緷璧栨敞鍏ョ殑static澹佸瀿浜? 鍏蜂綋浠g爜濡備笅:
@Autowired
private Destination dfsOperationQueue ;
private static Destination dfsOperationQueueStatic ; // static version
@Autowired
private MessageQueueAPI messageQueueAPI ;
private static MessageQueueAPI messageQueueAPIStatic ; // static version
@PostConstruct
public void init () {
dfsOperationQueueStatic = this . dfsOperationQueue ;
messageQueueAPIStatic = this . messageQueueAPI ;
}
@AfterClass
public static void afterClass () {
MessageVO messageVO = messageQueueAPIStatic . removeDestination ( dfsOperationQueueStatic );
System . out . println ( messageVO );
}
鍏跺疄灝辨槸鐢ㄤ簡@PostConstruct 鏉ヤ釜鍋鋒鎹㈡煴鑰屽凡, 澶氬0鏄庝釜闈欐佹垚鍛樻寚鍚戦潪闈欐佸璞? 涓よ呭叾瀹炴槸涓涓璞?/span>
]]> 閫氳繃rest api綆$悊activemq http://m.tkk7.com/miaoyachun/archive/2016/10/22/431914.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Sat, 22 Oct 2016 09:31:00 GMT http://m.tkk7.com/miaoyachun/archive/2016/10/22/431914.html http://m.tkk7.com/miaoyachun/comments/431914.html http://m.tkk7.com/miaoyachun/archive/2016/10/22/431914.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/431914.html http://m.tkk7.com/miaoyachun/services/trackbacks/431914.html 鐭ラ亾activemq鐜板湪宸茬粡鏀寔浜唕est api, 浣嗘槸瀹樻柟瀵硅繖閮ㄥ垎鐨勪粙緇嶄竴絎斿甫榪?(http://activemq.apache.org/rest.html),
閫氳繃google灞呯劧涔熸病鎼滃埌涓浜涙湁鐢ㄧ殑, 姣斿鍍忓垹闄や竴涓猟estination, 閮芥槸闂殑澶?鐒跺悗娌′笅鏂? 浜庢槸鑺變簡涓浜涘績鎬濈爺絀朵簡涓涓?
棣栧厛閫氳繃rest api鑾峰彇褰撳墠鐗堟湰鎵鏈夊凡鏀寔鐨勫崗璁?/p>
http://172.30.43.206:8161/api/jolokia/list
鐒跺悗鏍規嵁json杈撳嚭鍏充簬removeTopic, removeQueue鐨刴bean瀹炵幇閫氳繃rest api鍒犻櫎destination鐨勬柟娉? 娉ㄦ剰鍒扮敤GET璇鋒眰鑰屼笉鏄疨OST,涓嶇劧浼氭姤閿?(瀹樼綉鐨勪緥瀛愰噷鐢ㄧ殑wget緇欑殑鐏墊劅, 寮濮嬬敤浜哖OST鑰佹姤閿?
import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQTopic; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.DefaultHttpClient; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; import javax.jms.Destination; import javax.jms.JMSException; import java.util.Arrays; public class MessageQueueAdmin { private static final RestTemplate restTemplate = getRestTemplate( " admin " , " admin " ); private static String brokerHost = " 172.30.43.206 " ; private static String adminConsolePort = " 8161 " ; private static String protocol = " http " ; public static void removeDestination(Destination destination) throws JMSException { String destName, destType; if (destination instanceof ActiveMQQueue) { destName = ((ActiveMQQueue) destination).getQueueName(); destType = " Queue " ; } else { destName = ((ActiveMQTopic) destination).getTopicName(); destType = " Topic " ; } // build urls String url = String.format( " %s://%s:%s/api/jolokia/exec/org.apache.activemq: " + " brokerName=localhost,type=Broker/remove%s/%s " , protocol, brokerHost, adminConsolePort, destType, destName); System.out.println(url); // do operation HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); HttpEntity < String > entity = new HttpEntity < String > ( " parameters " , headers); ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, entity, String. class ); System.out.println(response.getBody()); } public static void main(String[] args) throws JMSException { ActiveMQTopic topic = new ActiveMQTopic( " test-activemq-topic " ); removeDestination(topic); } private static RestTemplate getRestTemplate(String user, String password) { DefaultHttpClient httpClient = new DefaultHttpClient(); BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(user, password)); httpClient.setCredentialsProvider(credentialsProvider); ClientHttpRequestFactory rf = new HttpComponentsClientHttpRequestFactory(httpClient); return new RestTemplate(rf); } }
鍏朵粬鐨勮姹?搴旇閮芥槸綾諱技jolokia鐨別xec get request鐨勬牸寮?
https://jolokia.org/reference/html/protocol.html#exec
<base url>/exec/<mbean name>/<operation name>/<arg1>/<arg2>/ . ]]>JmsTemplate CLIENT_ACKNOWLEDGE 妯″紡涓媟eceive娑堟伅鐨勯棶棰?/title> http://m.tkk7.com/miaoyachun/archive/2016/10/12/431885.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Wed, 12 Oct 2016 08:32:00 GMT http://m.tkk7.com/miaoyachun/archive/2016/10/12/431885.html http://m.tkk7.com/miaoyachun/comments/431885.html http://m.tkk7.com/miaoyachun/archive/2016/10/12/431885.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/431885.html http://m.tkk7.com/miaoyachun/services/trackbacks/431885.html protected Message doReceive(Session session, MessageConsumer consumer) throws JMSException { try { // Use transaction timeout (if available). long timeout = getReceiveTimeout(); JmsResourceHolder resourceHolder = (JmsResourceHolder) TransactionSynchronizationManager.getResource(getConnectionFactory()); if (resourceHolder != null && resourceHolder.hasTimeout()) { timeout = Math.min(timeout, resourceHolder.getTimeToLiveInMillis()); } Message message = doReceive(consumer, timeout); if (session.getTransacted()) { // Commit necessary - but avoid commit call within a JTA transaction. if (isSessionLocallyTransacted(session)) { // Transacted session created by this template -> commit. JmsUtils.commitIfNecessary(session); } } else if (isClientAcknowledge(session)) { // Manually acknowledge message, if any. if (message != null ) { message.acknowledge(); } } return message; } finally { JmsUtils.closeMessageConsumer(consumer); } }
浣嗘槸浣跨敤寮傛listener 灝變笉浼氬嚭鐜拌繖涓儏鍐碉紝鎼滀簡涓媑oogle錛屽彂鐜版灉鐒跺瓨鍦ㄨ繖涓棶棰?br /> https://jira.spring.io/browse/SPR-12995 https://jira.spring.io/browse/SPR-13255 http://louisling.iteye.com/blog/241073
鍚屾鏂瑰紡鎷夊彇娑堟伅錛屾殏鏃舵病鎵懼埌濂界殑灝佽錛屽彧鑳芥殏鏃剁敤榪欍傛垨鑰呭敖閲忕敤listener, 榪欎釜闂鏆傛椂鏍囪涓嬶紝鎴栬呰皝鏈夋洿濂界殑瑙e喅鏂規鍙互comment鎴?img src ="http://m.tkk7.com/miaoyachun/aggbug/431885.html" width = "1" height = "1" /> ]]> Spring涓璫lasspath涓巆lasspath*鐨勫尯鍒?/title> http://m.tkk7.com/miaoyachun/archive/2016/05/26/430666.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Thu, 26 May 2016 06:14:00 GMT http://m.tkk7.com/miaoyachun/archive/2016/05/26/430666.html http://m.tkk7.com/miaoyachun/comments/430666.html http://m.tkk7.com/miaoyachun/archive/2016/05/26/430666.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/430666.html http://m.tkk7.com/miaoyachun/services/trackbacks/430666.html http://stackoverflow.com/questions/3294423/spring-classpath-prefix-difference
SIMPLE DEFINITION The classpath*:conf/appContext.xml simply means that all appContext.xml files under conf folders in all your jars on the classpath will be picked up and joined into one big application context. In contrast, classpath:conf/appContext.xml will load only one such file the first one found on your classpath. < bean id ="propertyConfigurer" class ="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" > < property name ="locations" > < list > < value > classpath:*.properties</ value > < value > classpath*:*.properties</ value > </ list > </ property > </ bean > ]]> When launched from .exe IDEA looks for Java in a following order http://m.tkk7.com/miaoyachun/archive/2016/05/16/430516.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Mon, 16 May 2016 00:49:00 GMT http://m.tkk7.com/miaoyachun/archive/2016/05/16/430516.html http://m.tkk7.com/miaoyachun/comments/430516.html http://m.tkk7.com/miaoyachun/archive/2016/05/16/430516.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/430516.html http://m.tkk7.com/miaoyachun/services/trackbacks/430516.html IDEA_JDK (or IDEA_JDK_64) environment variable jre/ (or jre64/) directory in IDEA home registry JDK_HOME environment variable JAVA_HOME environment variable ]]> java淇敼stdout鐨勫巻鍙茶緭鍑?/title> http://m.tkk7.com/miaoyachun/archive/2016/04/21/430179.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Thu, 21 Apr 2016 09:06:00 GMT http://m.tkk7.com/miaoyachun/archive/2016/04/21/430179.html http://m.tkk7.com/miaoyachun/comments/430179.html http://m.tkk7.com/miaoyachun/archive/2016/04/21/430179.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/430179.html http://m.tkk7.com/miaoyachun/services/trackbacks/430179.html ANSI code 鐢╦ava鍐欎簡涓畝鍗曠殑渚嬪瓙錛屼緥瀛愬氨鏄妸鏇劇粡鐨刼utput淇敼涓哄叾浠栧瓧絎︿覆騫舵仮澶嶄箣鍚庣殑鎵撳嵃錛屼唬鐮侀噷鍔犱簡sleep錛屼富瑕佹柟渚跨悊瑙e悇縐嶆帶鍒跺簭鍒楃殑鍚箟 // print some test messages System.out.println( " 1 " ); Thread.sleep( 1000 ); System.out.println( " 22 " ); Thread.sleep( 1000 ); System.out.println( " 333 " ); Thread.sleep( 1000 ); System.out.println( " 4444 " ); Thread.sleep( 1000 ); /** * modify "333" to "-" */ // Move up two lines int count = 2 ; System.out.print(String.format( " \033[%dA " , count)); Thread.sleep( 1000 ); // Erase current line content System.out.print( " \033[2K " ); Thread.sleep( 1000 ); // update with new content System.out.print( " - " ); Thread.sleep( 1000 ); // Move down two lines System.out.print(String.format( " \033[%dB " , count)); Thread.sleep( 1000 ); // Move cursor to left beginning System.out.print(String.format( " \033[D " , count)); // continue print others Thread.sleep( 1000 ); System.out.println( " 55555 " ); Thread.sleep( 1000 );
]]> zookeeper瀛︿範 http://m.tkk7.com/miaoyachun/archive/2016/03/31/429913.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Thu, 31 Mar 2016 06:06:00 GMT http://m.tkk7.com/miaoyachun/archive/2016/03/31/429913.html http://m.tkk7.com/miaoyachun/comments/429913.html http://m.tkk7.com/miaoyachun/archive/2016/03/31/429913.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/429913.html http://m.tkk7.com/miaoyachun/services/trackbacks/429913.html 2. 璇︾粏浠嬬粛 http://blog.csdn.net/xhh198781/article/details/10949697 ]]> Spring boot 寮鍚痳eponse鍘嬬緝浠ュ強閮ㄥ垎鍙傛暟璁劇疆 http://m.tkk7.com/miaoyachun/archive/2016/03/29/429861.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Tue, 29 Mar 2016 03:50:00 GMT http://m.tkk7.com/miaoyachun/archive/2016/03/29/429861.html http://m.tkk7.com/miaoyachun/comments/429861.html http://m.tkk7.com/miaoyachun/archive/2016/03/29/429861.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/429861.html http://m.tkk7.com/miaoyachun/services/trackbacks/429861.html server.compression.enabled =true server.compression.mime-types =application/json,application/xml,text/html,text/xml,text/plain server.compression.min-response-size =4096 絎竴涓弬鏁版墦寮鍘嬬緝寮鍏籌紝絎簩涓弬鏁版坊鍔爅son reponse錛堝挨鍏舵槸涓簉est api錛?絎笁涓弬鏁版槸鏍規嵁reponse鐨勫ぇ灝忚緗惎鐢ㄥ帇緙╃殑鏈灝忓?榛樿鏄?K錛岃嚜宸辨牴鎹疄闄呮儏鍐佃皟鏁? 鍙傝?div>http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#how-to-enable-http-response-compression ]]> 鍏充簬java榛樿鐨勭被鍔犺澆鍣ㄧ殑綆鍗曚唬鐮佺爺絀?/title> http://m.tkk7.com/miaoyachun/archive/2016/03/16/429685.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Wed, 16 Mar 2016 07:40:00 GMT http://m.tkk7.com/miaoyachun/archive/2016/03/16/429685.html http://m.tkk7.com/miaoyachun/comments/429685.html http://m.tkk7.com/miaoyachun/archive/2016/03/16/429685.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/429685.html http://m.tkk7.com/miaoyachun/services/trackbacks/429685.html 2. 3涓姞杞藉櫒騫朵笉鏄湡姝g殑鐖跺瓙緇ф壙鍏崇郴錛岃屾槸閫昏緫涓婄殑錛孞VM鍚姩鍏堝垱寤篍xtClassloader instance錛岀劧鍚庢瀯閫燗ppClassloader鐨勬椂鍊欎紶鍏xtClassloader瀹炰緥浣滀負parent Launcher.ExtClassLoader extcl; try { extcl = Launcher.ExtClassLoader.getExtClassLoader(); } catch (IOException var10) { throw new InternalError( " Could not create extension class loader " , var10); } try { this .loader = Launcher.AppClassLoader.getAppClassLoader(extcl); } catch (IOException var9) { throw new InternalError( " Could not create application class loader " , var9); }
鍏充簬鍙屼翰濮旀淳鍘熺悊錛?鍦ㄥ姞杞界被鐨勬椂鍊欙紝浼氱湅鐪媝arent鏈夋病鏈夎瀹氾紝濡傛灉璁懼畾浜?灝辮皟鐢╬arent.loadClass鏂規硶錛屽鏋滄病璁懼畾(==null)涔熷氨鏄痯arent搴旇鏄疊ootstrapClassloader, 浼氳皟鐢╪ative鐨刦indBootstrapClass鏉ュ姞杞界被錛屼唬鐮侊細 try { if ( this .parent != null ) { c = this .parent.loadClass(name, false ); } else { c = this .findBootstrapClassOrNull(name); } } catch (ClassNotFoundException var10) { ; }
鐩殑鏄寜鐓т竴瀹氫紭鍏堢駭鍒杞界郴緇熺殑lib錛岀郴緇焑xt鐩綍鐨刲ib錛屼互鍙奵lasspath鐨刲ib錛岄槻姝㈢郴緇熺殑榛樿琛屼負鎴栬呯被鐨勫疄鐜拌淇敼銆?br /> 3. java 綾葷殑鍔ㄦ佸姞杞?br />Java鍐呯疆鐨凜lassLoader鎬諱細鍦ㄥ姞杞戒竴涓狢lass涔嬪墠媯鏌ヨ繖涓狢lass鏄惁宸茬粡琚姞杞借繃錛屽凡緇忚鍔犺澆榪囩殑Class涓嶄細鍔犺澆絎簩嬈°傚洜姝よ鎯抽噸鏂板姞杞紺lass錛屾垜浠渶瑕佸疄鐜拌嚜宸辯殑ClassLoader銆? 鍙﹀涓涓棶棰樻槸錛屾瘡涓鍔犺澆鐨凜lass閮介渶瑕佽閾炬帴(link)錛岃繖鏄氳繃鎵цClassLoader.resolve()鏉ュ疄鐜扮殑錛岃繖涓柟娉曟槸 final鐨勶紝鍥犳鏃犳硶閲嶅啓銆俁esove()鏂規硶涓嶅厑璁鎬竴涓狢lassLoader瀹炰緥link涓涓狢lass涓ゆ錛屽洜姝わ紝褰撲綘闇瑕侀噸鏂板姞杞戒竴涓? Class鐨勬椂鍊欙紝浣犻渶瑕侀噸鏂癗ew涓涓綘鑷繁鐨凜lassLoader瀹炰緥銆?
]]> 欏圭洰涓敤鍒扮殑涓浜沵aven鎻掍歡鎬葷粨 http://m.tkk7.com/miaoyachun/archive/2016/01/26/429206.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Tue, 26 Jan 2016 03:41:00 GMT http://m.tkk7.com/miaoyachun/archive/2016/01/26/429206.html http://m.tkk7.com/miaoyachun/comments/429206.html http://m.tkk7.com/miaoyachun/archive/2016/01/26/429206.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/429206.html http://m.tkk7.com/miaoyachun/services/trackbacks/429206.html
maven-shade-plugin 鐢ㄦ潵鎵撳彲鎵цjar鍖咃紝 鍙互鎶婃墍鏈変緷璧栫殑涓夋柟搴撻兘鍖呮嫭榪涙潵 exec-maven-plugin 鍙互鎵ц澶栭儴鍛戒護錛?nbsp;鍦ㄩ」鐩腑瀵筽ython浠g爜榪涜緙栬瘧錛?nbsp;閰嶅悎maven-assembly-plugin鏉ョ敓鎴恜ackage maven-assembly-plugin 鐢ㄦ潵鏋勫緩欏圭洰鍙戣鍖咃紝 瑕侀厤鍚坸ml閰嶇疆鏂囦歡鏉ョ粍緇囧寘鐨勭粨鏋勶紝鍩烘湰鎬濊礬鏄粠build鐜copy鍒皁utputDirectory license-maven-plugin 鐢ㄦ潵鐢熸垚欏圭洰鐢ㄥ埌鐨?鏂瑰簱鐨勭増鏉冩眹鎬?nbsp;鎴栬呭叾浠栫殑涓浜涚敤娉?br />maven-dependency-plugin 鐢ㄦ潵鐢熸垚欏圭洰搴撲箣闂寸殑渚濊禆鍏崇郴 appassembler-maven-plugin 鍙互涓洪」鐩敓鎴愪紭闆呯殑鍚姩鑴氭湰 鏀寔linux/win rpm-maven-plugin 鐢ㄦ潵涓洪」鐩瀯寤簉pm瀹夎鍖?br />maven-compiler-plugin 鎸囧畾欏圭洰鐨刯dk鐨勭紪璇戝吋瀹圭増鏈互鍙奺ncoding綾誨埆
]]> Idea 榪滅▼璋冨紡閬囧埌浣跨敤exec maven 鎻掍歡涓嶈兘鍛戒腑鏂偣鐨勯棶棰?/title> http://m.tkk7.com/miaoyachun/archive/2015/10/21/427858.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Wed, 21 Oct 2015 09:12:00 GMT http://m.tkk7.com/miaoyachun/archive/2015/10/21/427858.html http://m.tkk7.com/miaoyachun/comments/427858.html http://m.tkk7.com/miaoyachun/archive/2015/10/21/427858.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/427858.html http://m.tkk7.com/miaoyachun/services/trackbacks/427858.html 鐭ラ亾浜嗛棶棰樻墍鍦ㄨВ鍐沖氨瀹規槗浜? 鍙淇敼pom.xml, 鐒跺悗鐩存帴mvn exec:exec灝辮兘姝e父璋冨紡浜?br /> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>${mvnexec.version}</version> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <includeProjectDependencies>true</includeProjectDependencies> <executable>java</executable> <workingDirectory>${basedir}/config/sim</workingDirectory> <classpathScope>runtime</classpathScope> <arguments> <argument>-agentlib:jdwp = transport = dt_socket , server = y , suspend = y , address = 4000 </argument> <argument>-classpath</argument> <classpath/> <argument>com.ymiao.Main</argument> <argument>server</argument> <argument>${basedir}/config/sim/sim.yml</argument> </arguments> </configuration> </plugin> </plugins> </build>
鎬葷粨灝辨槸exec:exec鏄鐙珛涓涓柊榪涚▼鏉ユ墽琛岀▼搴忕殑, exec:java灝辯浉鍙? 鍏跺疄鐢╩vnDebug + exec:java涔熸槸鐞嗚鍙鐨?img src ="http://m.tkk7.com/miaoyachun/aggbug/427858.html" width = "1" height = "1" /> ]]> 鍏充簬jconsole鏄劇ず鑷畾涔夌殑MBean http://m.tkk7.com/miaoyachun/archive/2015/09/08/427184.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Tue, 08 Sep 2015 02:53:00 GMT http://m.tkk7.com/miaoyachun/archive/2015/09/08/427184.html http://m.tkk7.com/miaoyachun/comments/427184.html http://m.tkk7.com/miaoyachun/archive/2015/09/08/427184.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/427184.html http://m.tkk7.com/miaoyachun/services/trackbacks/427184.html 鑷畾涔夌殑Mbean鐨勬櫘閫歮ethod鑳藉湪jconsole鐨凪beans閲屾樉紺哄嚭鏉ワ紝浣嗘槸娑夊強鍒癵eters/seters灝辨棤娉曟樉紺轟簡 濡傛灉MBean娉ㄥ唽鍒頒笅闈㈠艦寮忓垱寤虹殑MBeanServer鍦↗console涓婃棤娉曟樉紺虹殑MBeanServer server = MBeanServerFactory.createMBeanServer() ;
浣嗘槸濡傛灉娉ㄥ唽鍒頒笅闈㈢殑褰㈠紡鍒涘緩鐨凷erver鍦↗console涓婃槸鍙互鏄劇ずMBean鐨?br />MBeanServer server = ManagementFactory.getPlatformMBeanServer() ;
stackoverflow涓婁篃鏈変漢鍙戠幇榪欎釜闂
http://stackoverflow.com/questions/7424009/mbeans-registered-to-mbean-server-not-showing-up-in-jconsole
]]> java 甯擱噺姹犱粠jdk7寮濮嬩粠鏂規硶鍖鴻縼縐誨埌鍫嗗唴 http://m.tkk7.com/miaoyachun/archive/2015/05/06/424894.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Wed, 06 May 2015 09:35:00 GMT http://m.tkk7.com/miaoyachun/archive/2015/05/06/424894.html http://m.tkk7.com/miaoyachun/comments/424894.html http://m.tkk7.com/miaoyachun/archive/2015/05/06/424894.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/424894.html http://m.tkk7.com/miaoyachun/services/trackbacks/424894.html 浠巎dk7鏈寮濮嬬殑release version (http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html)鐨刵otes閲岀湅鍒?br /> Area: HotSpot Synopsis: In JDK 7, interned strings are no longer allocated in the permanent generation of the Java heap, but are instead allocated in the main part of the Java heap (known as the young and old generations), along with the other objects created by the application. This change will result in more data residing in the main Java heap, and less data in the permanent generation, and thus may require heap sizes to be adjusted. Most applications will see only relatively small differences in heap usage due to this change, but larger applications that load many classes or make heavy use of the String.intern() method will see more significant differences. RFE: 6962931 ]]> Ubuntu12.04s涓妀enkins鐢ㄥ惎鍔ㄨ剼鏈惎鍔ㄥけ璐ョ殑涓縐嶅師鍥?/title> http://m.tkk7.com/miaoyachun/archive/2015/02/28/423103.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Sat, 28 Feb 2015 08:51:00 GMT http://m.tkk7.com/miaoyachun/archive/2015/02/28/423103.html http://m.tkk7.com/miaoyachun/comments/423103.html http://m.tkk7.com/miaoyachun/archive/2015/02/28/423103.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/423103.html http://m.tkk7.com/miaoyachun/services/trackbacks/423103.html 浠婂ぉ鏈夊悓浜嬮棶涓轟粈涔坲buntu涓婂惎鍔╦enkins澶辮觸錛屾垜璁板緱涔嬪墠鐜╃殑鏃跺欏茍娌℃湁鍑虹幇榪欑鎯呭喌錛屼簬鏄窡韙簡涓嬶紝鏈緇堥敊璇俊鎭槸:daemon: fatal: refusing to execute unsafe program: /usr/bin/java (/opt is group and world writable)
鏍規湰鍘熷洜鏄満鍣ㄨ浜嗗涓増鏈殑jdk, jdk鎵鍦ㄧ殑/opt鐖剁洰褰曠殑鏉冮檺鏀劇殑姣旇緝澶э紝鎸夌収daemon瑕佹眰鐨勯檺鍒跺埌755chmod -R 755 /opt
闂灝辮В鍐充簡銆?br /> 鍏跺疄榪欎釜鍦烘櫙榪樻槸铔父瑙佺殑錛岄亣鍒扮殑浜哄簲璇ユ尯澶氱殑 ]]> valgrind memory check on java program http://m.tkk7.com/miaoyachun/archive/2013/12/06/407274.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Fri, 06 Dec 2013 02:26:00 GMT http://m.tkk7.com/miaoyachun/archive/2013/12/06/407274.html http://m.tkk7.com/miaoyachun/comments/407274.html http://m.tkk7.com/miaoyachun/archive/2013/12/06/407274.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/407274.html http://m.tkk7.com/miaoyachun/services/trackbacks/407274.html valgrind --error-limit = no --trace-children = yes --smc-check = all --leak-check = full JAVA_CMD
鐗規剰鍐欎簡涓湁leak鐨刯ni鍑芥暟錛岀敤valgrind鎴愬姛媯鏌ュ嚭鏉ヤ簡
== 31915 == 100 bytes in 1 blocks are definitely lost in loss record 447 of 653 == 31915 == at 0x402CE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) == 31915 == by 0x60424F9: Java_MyJNI_hello (MyJNI.c: 16 )
鍦ㄨ佺増鏈瑅algrind(3.5.0) enable浜?-trace-children閫夐」鍚庡彲鑳藉嚭鐜伴敊璇?
Error occurred during initialization of VM Unknown x64 processor: SSE2 not supported
鍗囩駭鍒版渶鏂扮増鍙互瑙e喅榪欎釜闂錛屽崌綰ф柟娉曪細涓嬭澆src鍖?瑙e帇鍚庢墽琛?./configure; make; make install
]]> maven鏈湴涓夋柟渚濊禆鍖呮彃浠禷ddjars-maven-plugin http://m.tkk7.com/miaoyachun/archive/2013/10/30/405795.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Wed, 30 Oct 2013 06:03:00 GMT http://m.tkk7.com/miaoyachun/archive/2013/10/30/405795.html http://m.tkk7.com/miaoyachun/comments/405795.html http://m.tkk7.com/miaoyachun/archive/2013/10/30/405795.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/405795.html http://m.tkk7.com/miaoyachun/services/trackbacks/405795.html < build > < plugins > < plugin > < groupId > com.googlecode.addjars-maven-plugin </ groupId > < artifactId > addjars-maven-plugin </ artifactId > < version > 1.0.2 </ version > < executions > < execution > < goals > < goal > add-jars </ goal > </ goals > < configuration > < resources > < resource > < directory > ${basedir}/../lib </ directory > </ resource > </ resources > </ configuration > </ execution > </ executions > </ plugin > < plugin > < groupId > org.apache.maven.plugins </ groupId > < artifactId > maven-assembly-plugin </ artifactId > < version > ${maven.assembly.version} </ version > < configuration > < descriptorRefs > < descriptorRef > jar-with-dependencies </ descriptorRef > </ descriptorRefs > < appendAssemblyId > false </ appendAssemblyId > </ configuration > < executions > < execution > < phase > package </ phase > < goals > < goal > single </ goal > </ goals > </ execution > </ executions > </ plugin > </ plugins > </ build >
鎶婇」鐩腑渚濊禆鐨勪笁鏂筳ars鍏ㄦ斁鍒發ib鐩綍閲岋紝灝卞叏閮ㄤ細鎵撳寘鍒皉elease jar閲屼簡 ]]> 鍙嶇紪璇慾ava class騫朵紭闆呯殑璋冭瘯 http://m.tkk7.com/miaoyachun/archive/2013/02/22/395575.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Fri, 22 Feb 2013 07:01:00 GMT http://m.tkk7.com/miaoyachun/archive/2013/02/22/395575.html http://m.tkk7.com/miaoyachun/comments/395575.html http://m.tkk7.com/miaoyachun/archive/2013/02/22/395575.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/395575.html http://m.tkk7.com/miaoyachun/services/trackbacks/395575.html 鐢╦d-eclipse 鎻掍歡鏉ュ弽緙栬瘧java class鏂囦歡鐨勮緭鍑鴻繕鏄尯nice鐨勶紝铏界劧闃呰鏂逛究浜?浣嗘槸瀵筪ebug紜犳垚涓瀹氱殑鍥版壈錛屼富瑕侀棶棰樻槸line number鐨勪笉match. Google浜嗕笅閬囧埌綾諱技闂鐨勭湡涓嶅皯銆傛渶緇堟壘鍒頒簡瑙e喅鏂規錛?br />http://sourceforge.net/projects/realignmentjd/files/ -----------------1. Download JD-Eclipse and JD-GUI - http://java.decompiler.free.fr/ and install. 2. Put a file realignment.jd.ide.eclipse_1.0.2.jar in eclipse/plugins directory. To use Realignment feature it is necessary to open the menu Preferences/General/Editors/File Associations and to select "*.class" file type and to choose "Realignment for JD Class File Editor" for Associated editors. Another possibility is the batch realignment after processing JD-GUI. To work properly you must to switch on the property "Display line numbers" in Help/Preferences of JD-GUI. To use this feature it is necessary to open the menu Preferences/Java/Decompiler/Batch Realignment and click button "Open dialog". Existing limitation: the realignment is performed only for the methods. To work properly it is necessary that the property "Display line numbers" in menu "Preferences/Java/Decompiler" was active.
JD-Eclipse鎻掍歡 + realignment 琛ヤ竵璁╀紭闆呯殑debug class 鏂囦歡鎴愪負鍙兘銆?br /> 濡傛灉鍙槸涓轟簡闃呰class浠g爜錛屽緩璁笉瑕佺敤realignment 琛ヤ竵錛岃繖鏍蜂細闄嶄綆浠g爜鐨勫彲璇繪э紙浼氬鍑哄ぇ閲忕殑絀鴻錛?br /> ]]> 涓浜涢」鐩腑鐢ㄥ埌鐨刴vn渚嬪瓙 http://m.tkk7.com/miaoyachun/archive/2013/01/10/394058.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Thu, 10 Jan 2013 05:33:00 GMT http://m.tkk7.com/miaoyachun/archive/2013/01/10/394058.html http://m.tkk7.com/miaoyachun/comments/394058.html http://m.tkk7.com/miaoyachun/archive/2013/01/10/394058.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/394058.html http://m.tkk7.com/miaoyachun/services/trackbacks/394058.html mvn 鎵ц澶栭儴鍛戒護 鍛戒護琛屾ā寮?br />mvn exec:exec -Dexec.executable = sh -Dexec.workingdir = ./bin -Dexec.args = hello.sh
閰嶇疆鏂囦歡褰㈠紡 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <id>test-exec</id> <phase>initialize</phase> <configuration> <executable>sh</executable> <workingDirectory>./bin</workingDirectory> <arguments> <argument>hello.sh</argument> </arguments> </configuration> <goals> <goal>exec</goal> </goals> </execution> </executions> </plugin>
mvn 鐢熸垚java欏圭洰 鐢熸垚楠ㄦ灦mvn archetype:generate -DgroupId = com.abc.product -DartifactId = product -DpackageName = com.abc.product -DarchetypeArtifactId = maven-archetype-quickstart
杞垚eclipse鑳借瘑鍒殑java 欏圭洰mvn eclipse:eclipse
瀵煎叆eclipse 鐒跺悗coding mvn榪涜鍗曞厓嫻嬭瘯 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version> 2.12.4 </version> <configuration> <forkMode>pertest</forkMode> <excludes> <exclude>**/perftest/*.java</exclude> </excludes> <systemProperties> <property> <name>log4j.configuration</name> <value>target/test-classes/log4j.properties</value> </property> </systemProperties> </configuration> </plugin>
mvn榪涜code coverage緇熻 <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>emma-maven-plugin</artifactId> <version>1.0-alpha-3</version> <inherited>true</inherited> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>surefire-report-maven-plugin</artifactId> <inherited>true</inherited> </plugin> </plugins> </reporting>
mvn鐢熸垚javadoc <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version> 2.9 </version> <configuration> <show>private</show> </configuration> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>javadoc</goal> <goal>test-javadoc</goal> </goals> <phase>site</phase> </execution> </executions> </plugin>
]]> 鍏充簬java.library.path http://m.tkk7.com/miaoyachun/archive/2012/12/06/392529.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Thu, 06 Dec 2012 03:05:00 GMT http://m.tkk7.com/miaoyachun/archive/2012/12/06/392529.html http://m.tkk7.com/miaoyachun/comments/392529.html http://m.tkk7.com/miaoyachun/archive/2012/12/06/392529.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/392529.html http://m.tkk7.com/miaoyachun/services/trackbacks/392529.html 鏈榪戦」鐩鐢↗NI, 娑夊強鍒扮敤java.library.path榪欎釜鍙傛暟錛屽紑濮嬩互涓哄彧瑕乴dconfig鑳借瘑鍒埌鐨剆o鏂囦歡java 涓瀹氳兘鎵懼埌錛屽彲鎯滃茍涓嶆槸榪欐牱銆傘?br />瑕佹兂java紼嬪簭鎵懼埌鍏變韓搴撹繕鏄鍦ㄦ墽琛宩ava紼嬪簭鐨勬椂鍊欐寚瀹歫ava.library.path錛岀敤eclipse鐨勮瘽鍙互璁劇疆濡備笅錛?br />
Properties->Run/Debug settings->Arguments->VM arguments ----------------------------------------- -Djava.library.path=/home/miaoyachun/workspace/JNIC/Release
榪欎釜鏄紶緇熺殑鏂瑰紡錛実oogle浜嗕笅鏈変釜tricky鐨勬柟寮忚紼嬪簭鍔ㄦ佷慨鏀筳ava.library.path private static void loadJNILibDynamically() { try { System.setProperty( " java.library.path " , System.getProperty( " java.library.path " ) + " :/home/miaoyachun/workspace/JNIC/Release/ " ); Field fieldSysPath = ClassLoader. class .getDeclaredField( " sys_paths " ); fieldSysPath.setAccessible( true ); fieldSysPath.set( null , null ); System.loadLibrary( " JNIC " ); } catch (Exception e) { // do nothing for exception } }
浜嬪疄涓妉inux涓嬭繕鏈変釜鐜鍙橀噺LD_LIBRARY_PATH錛屽鏋渓ib鑳藉湪榪欎釜path閲屾壘鍒幫紝java.library.path灝變笉鐢ㄩ厤緗簡錛岃屼笖涓嶉渶瑕佸叧蹇僱ib涔嬮棿渚濊禆鐨勯棶棰樸俲ava.library.path鍦ㄨ繖鏂歸潰灝卞急寰堝錛屾瘮濡俵ib渚濊禆鍏朵粬鐩綍鐨刲ib絳夈?img src ="http://m.tkk7.com/miaoyachun/aggbug/392529.html" width = "1" height = "1" /> ]]> Ubuntu涓婄殑alternatives http://m.tkk7.com/miaoyachun/archive/2012/10/26/390260.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Fri, 26 Oct 2012 05:31:00 GMT http://m.tkk7.com/miaoyachun/archive/2012/10/26/390260.html http://m.tkk7.com/miaoyachun/comments/390260.html http://m.tkk7.com/miaoyachun/archive/2012/10/26/390260.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/390260.html http://m.tkk7.com/miaoyachun/services/trackbacks/390260.html 鍏充簬alternatives 鐨勭敤娉?br /> alternatives --install /usr/bin/java java /opt/jdk1.5 .0_ 22 /bin/java 15000 alternatives --install /usr/bin/javac javac /opt/jdk1.5 .0_ 22 /bin/javac 15000 alternatives --config java alternatives --config javac
鏈榪戝垏鎹㈡闈㈢幆澧冨埌ubuntu, 鍙戠幇alternatives 榪欎釜宸ュ叿鏀瑰悕浜?update-alternatives 鐢ㄦ硶榪樻槸涓鏍風殑銆傘?br /> ]]> 鐢↗NI浠嶤浼犻掔粨鏋勪綋鍒癑AVA http://m.tkk7.com/miaoyachun/archive/2012/10/12/389473.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Fri, 12 Oct 2012 08:40:00 GMT http://m.tkk7.com/miaoyachun/archive/2012/10/12/389473.html http://m.tkk7.com/miaoyachun/comments/389473.html http://m.tkk7.com/miaoyachun/archive/2012/10/12/389473.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/389473.html http://m.tkk7.com/miaoyachun/services/trackbacks/389473.html 鐩存帴涓奀鐨勫疄鐜?br />typedef struct Foo { int len; char name[ 100 ]; } Foo_t; JNIEXPORT jint JNICALL Java_TestJNI_foo(JNIEnv * env, jobject obj, jobject fooObj) { Foo_t * bar = malloc( sizeof (Foo_t)); jclass clazz; jfieldID fid; // init the bar data of C strcpy(bar -> name, " Yachun Miao " ); bar -> len = strlen(bar -> name); // mapping bar of C to foo clazz = ( * env) -> GetObjectClass(env, fooObj); if ( 0 == clazz) { printf( " GetObjectClass returned 0\n " ); return ( - 1 ); } fid = ( * env) -> GetFieldID(env, clazz, " len " , " I " ); ( * env) -> SetLongField(env, fooObj, fid, bar -> len); fid = ( * env) -> GetFieldID(env, clazz, " name " , " Ljava/lang/String; " ); jstring name = ( * env) -> NewStringUTF(env, bar -> name); ( * env) -> SetObjectField(env, fooObj, fid, name); free(bar); return 0 ; }
瀵瑰簲鐨凧ava璋冪敤public class Foo { protected int len; protected String name; } private static native int foo(Foo fooObj); public static void main(String args[]) { System.loadLibrary( " mylib " ); Foo foo = new Foo(); foo(foo); System.out.println(foo.name); System.out.println(foo.len); } 鍙傝冮摼鎺?br />http://www.steveolyo.com/JNI/JNI.html#CSTRCJ
http://docs.oracle.com/javase/6/docs/technotes/guides/jni/spec/types.html
]]> Jetty SslSelectChannelConnector about file downloading http://m.tkk7.com/miaoyachun/archive/2012/07/18/383427.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Wed, 18 Jul 2012 10:22:00 GMT http://m.tkk7.com/miaoyachun/archive/2012/07/18/383427.html http://m.tkk7.com/miaoyachun/comments/383427.html http://m.tkk7.com/miaoyachun/archive/2012/07/18/383427.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/383427.html http://m.tkk7.com/miaoyachun/services/trackbacks/383427.html 鍙戠幇鐢╟url浠巎etty鏈嶅姟鍣ㄤ笂download鏂囦歡鐨勯熷害姣旇緝鎱㈠ぇ姒傚彧鏈?M/s, 寮濮嬩互涓篶url鏈夐粯璁ょ殑limit-rate錛岃緗負1G浠ュ悗鍙戠幇榪樻槸鎱€?br />鐒跺悗寮濮嬫鐤戞槸jetty server鐨勯棶棰樸傜湅SslSelectChannelConnector鐨剅esponseBufferSize姣旇緝鍍忥紝鍙嶅瀹為獙鍙戠幇鍘熸潵鏄敱浜巋eaderBufferSize澶皬銆?br /> 鏀逛負32K浠ュ悗錛?br /> SslSelectChannelConnector connector = new SslSelectChannelConnector(); connector.setRequestBufferSize( 32768 ); 鏁堟灉錛?br />curl -k https://USER:PASSWD@HOST:PORT/api/internal/file?filename = /path/to/file > /dest/to/file % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 723M 100 723M 0 0 29 .3M 0 0 : 00 : 24 0 : 00 : 24 --:--:-- 29 .4M
ref: http://wiki.eclipse.org/Jetty/Howto/Configure_Connectors ]]> maven project to eclipse java project http://m.tkk7.com/miaoyachun/archive/2012/06/27/381618.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Wed, 27 Jun 2012 07:56:00 GMT http://m.tkk7.com/miaoyachun/archive/2012/06/27/381618.html http://m.tkk7.com/miaoyachun/comments/381618.html http://m.tkk7.com/miaoyachun/archive/2012/06/27/381618.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/381618.html http://m.tkk7.com/miaoyachun/services/trackbacks/381618.html steps: 1 . download maven project src code 2 . cd project root dir & run " mvn eclipse:eclipse " 3 . import it as eclipse java prject
step2 will generate .classpath & .project file ]]> 欏圭洰渚濊禆鍒嗘瀽宸ュ叿 http://m.tkk7.com/miaoyachun/archive/2012/06/13/380695.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Wed, 13 Jun 2012 08:13:00 GMT http://m.tkk7.com/miaoyachun/archive/2012/06/13/380695.html http://m.tkk7.com/miaoyachun/comments/380695.html http://m.tkk7.com/miaoyachun/archive/2012/06/13/380695.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/380695.html http://m.tkk7.com/miaoyachun/services/trackbacks/380695.html JBoss Tattletale is a tool that can help you get an overview of the project you are working on or a product that you depend on. The tool will provide you with reports that can help you * Identify dependencies between JAR files * Find missing classes from the classpath * Spot if a class/package is located in multiple JAR files * Spot if the same JAR file is located in multiple locations * With a list of what each JAR file requires and provides * Verify the SerialVersionUID of a class * Find similar JAR files that have different version numbers * Find JAR files without a version number * Find unused JAR files * Identify sealed / signed JAR archives * Locate a class in a JAR file * Get the OSGi status of your project
浣跨敤鏂規硶java -Xmx512m -jar tattletale.jar [ -exclude=<excludes> ] <scan-directory> [ output-directory ]
娉ㄦ剰浜嬮」tattletale鍙垎鏋恓ar鍖呬箣闂寸殑渚濊禆錛岄渶瑕佽嚜宸辨妸鎵鏈夌殑class鏂囦歡鎵撳寘鏀懼叆scan-directory錛岀劧鍚庢妸渚濊禆鐨刲ib涔熸斁鍏ュ悓涓洰褰?/span>
]]> Java榪涚▼memory leak鍒嗘瀽 http://m.tkk7.com/miaoyachun/archive/2012/03/16/372005.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Fri, 16 Mar 2012 01:45:00 GMT http://m.tkk7.com/miaoyachun/archive/2012/03/16/372005.html http://m.tkk7.com/miaoyachun/comments/372005.html http://m.tkk7.com/miaoyachun/archive/2012/03/16/372005.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/372005.html http://m.tkk7.com/miaoyachun/services/trackbacks/372005.html jmap & jhat 閫氳繃鍒嗘瀽heap涓璞$殑鏁伴噺榪樻湁澶у皬鍙互瀹氫綅鍝釜綾誨嚭浜嗛棶棰樸?img src ="http://m.tkk7.com/miaoyachun/aggbug/372005.html" width = "1" height = "1" /> ]]> Program exception handling http://m.tkk7.com/miaoyachun/archive/2012/03/12/371745.htmlMilo鐨勬搗鍩?/dc:creator>Milo鐨勬搗鍩?/author>Mon, 12 Mar 2012 08:35:00 GMT http://m.tkk7.com/miaoyachun/archive/2012/03/12/371745.html http://m.tkk7.com/miaoyachun/comments/371745.html http://m.tkk7.com/miaoyachun/archive/2012/03/12/371745.html#Feedback 0 http://m.tkk7.com/miaoyachun/comments/commentRss/371745.html http://m.tkk7.com/miaoyachun/services/trackbacks/371745.html 寮傚父鏄湁浠d環鐨勶紝姣斿灝介噺閬垮厤浣跨敤寮傚父鏉ュ疄鐜版祦紼嬫帶鍒?br />2. 灝介噺澶勭悊寮傚父 鏈夎兘鍔涘鐞嗗紓甯稿垯澶勭悊鎺夛紝涓嶇劧澶栧眰鍑芥暟浼氱瘡縐お澶氱殑寮傚父 3. 澶勭悊涓嶄簡鍒欐姏鍑哄紓甯?br /> 鑷繁闂嚜宸憋紝榪欎釜寮傚父鑳藉澶勭悊涔堬紝涓嶈鐨勮瘽鐩存帴鎶涘嚭錛屽彲浠ュ弬鑰冨師鍒? 4. Throw early and catch late 涓鑸簳灞傚嚱鏁頒笉浼氬鐞嗗紓甯革紝澶栧眰鍑芥暟浼氭牴鎹笂涓嬫枃鎹曡幏寮傚父榪涜澶勭悊鎴栬呰漿鎹?br />5. 涓嶈瑕嗙洊寮傚父 6. try鍧椾笉搴旇澶ぇ錛堜唬鐮佽鑼冿級 7. 鍑芥暟鎶涘嚭鐨勫紓甯鎬笉搴旇澶錛堜唬鐮佽鑼冿級 鍙傝?br />