區(qū)別很大,第一種創(chuàng)建一個myTest對象,第二種兩個,第二種使用synchronized (this)無法鎖住同步代碼塊.
放到Map里面
http://php.net/manual/zh/func...
學(xué)習(xí)都不看文檔的嗎
創(chuàng)建對象是用 包名.類名 去創(chuàng)建對象.這不就能區(qū)分是哪個對象調(diào)用的哪個方法.
data那里設(shè)置有問題,需要制定一個-data-dir參數(shù)
version: '3'
services:
nsqlookupd:
image: nsqio/nsq
command: /nsqlookupd
ports:
- "4160:4160"
- "4161:4161"
nsqd:
image: nsqio/nsq
command: /nsqd -data-path=/data --broadcast-address=192.168.2.13 --lookupd-tcp-address=nsqlookupd:4160
volumes:
- {{your data path}}:/data
depends_on:
- nsqlookupd
ports:
- "4150:4150"
- "4151:4151"
nsqadmin:
image: nsqio/nsq
command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
depends_on:
- nsqlookupd
ports:
- "4171:4171"可以讀另外一本叫《java并發(fā)編程的藝術(shù)》了解為什么,大概意思就是沒有加volatile的話,和可能這個cache一直是線程cache,前年校招的時候讀過一次。。
@RequestParam("num")改為@RequestBody試試
discovery.zen.ping.unicast.hosts: ["192.168.33.10","192.168.33.11",'192.168.33.12']
不應(yīng)當(dāng)包含本機(jī)的ip,5.6.x版本是這樣的,不知道6.x版本是不是
在表格里面對應(yīng)的每一項,判斷該表頭checked=true;此列顯示,否則不顯示。
如:<td class="lecture_id" v-show="tableTitleTable[0].isChecked">{{item.id}}</td>;表頭順序是變化的化,就不能直接寫死tableTitleTable[0],索引根據(jù)實際的索引來就可以了
沒試過netty,但換jetty是這樣:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
自問自答了....
final static int threadNum = 3; //線程數(shù)
static CountDownLatch countDownLatch = null;
@Override
public synchronized void staticizeIndexBySubsites(List<Integer> subsiteIds) throws Exception{
if(CollectionUtils.isNotEmpty(subsiteIds)){
countDownLatch = new CountDownLatch(threadNum);
int length = subsiteIds.size();
int tl = length % threadNum == 0 ? length / threadNum : (length/ threadNum + 1);
for (int i = 0; i < threadNum; i++) {
int end = (i + 1) * tl;
HandleThread thread = new HandleThread(subsiteIds, i * tl, end > length ? length : end);
thread.start();
}
countDownLatch.await();
}
}
class HandleThread extends Thread {
private List<Integer> data;
private int start;
private int end;
public HandleThread(List<Integer> data, int start, int end) {
this.data = data;
this.start = start;
this.end = end;
}
@Override
public void run() {
long startTime = System.currentTimeMillis();
List<Integer> subList = data.subList(start, end);
for(Integer item:subList){
staticizeIndexBySubsite(item);
}
countDownLatch.countDown();
System.out.println("線程:"+Thread.currentThread().getId()+"消費(fèi)了"+subList.size()+"個分站,耗時:"+((System.currentTimeMillis() - startTime)/1000) + "s");
}
}你看看這個是否有幫助
寫庫,因為主要鎖的是寫入
如果是檢驗的是對象的屬性
可以封裝一下方法(validator注入,你的bean是getValidator):
public static void validateWithException(Object object, Class<?>... groups) {
Set constraintViolations = validator.validate(object, groups);
if (!constraintViolations.isEmpty()) {
Iterator iterator = constraintViolations.iterator();
//取第一個錯誤拋出
ConstraintViolation constraintViolation = (ConstraintViolation) iterator.next();
throw new IllegalArgumentException(constraintViolation.getMessage());
}
}
當(dāng)然也可以使用AOP的方式對請求方法進(jìn)行校驗。
對單個參數(shù)/多個參數(shù),非對象的屬性,則需要添加@Validated于類上,提前需配置MethodValidationPostProcessor bean
getOne 是 lazy load 的
你加上這個 spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
4G,僅是32位操作系統(tǒng)的限制, 64位不受此限制, 理論上是264.
但最終都要受物理內(nèi)存的限制.超出物理內(nèi)存肯定是不行的.
可配置參數(shù)不代表真的可以分配內(nèi)存, 新jvm允許分配多至512倍的物理/虛擬內(nèi)存.
java -Xmx100000g Demo
在我的機(jī)器上跑得起來, 但實際是沒有用的. 真分配的時候還是會 OutOffMemory
Chrome會先嘗試用UTF8解碼,不對就換本地locale(GBK)編碼。Postman這種高冷程序員專用工具看起來并不鳥locale,于是直接亂碼。
總之經(jīng)驗告訴我們,面向消費(fèi)者的軟件總是比面向程序員的更魯棒。
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
M2_HOME=/Applications/apache-maven-3.5.3
PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export M2_HOME
export JAVA_HOME
export PATH
export CLASSPATH
為什么不這樣寫呢,沒在MAC上配過,只是猜測.
來這系統(tǒng)學(xué)習(xí)一下~
https://github.com/judasn/Int...
idea好像沒有這個功能~
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國制造2025”,實現(xiàn)中華民族偉大復(fù)興的升級產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗,技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。