在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ Java問答
礙你眼 回答

區(qū)別很大,第一種創(chuàng)建一個myTest對象,第二種兩個,第二種使用synchronized (this)無法鎖住同步代碼塊.

若相惜 回答

創(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

別瞎鬧 回答

(?P<charset>1+)這是我不懂之處,查閱博客之后才知道這個算是為分組命名,在.group('charset')這里將原先的分組的名字當(dāng)做字符串參數(shù)傳入,可以準(zhǔn)確獲取到正則表達(dá)式匹配到的值。


  1. ;s ?
兔寶寶 回答

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好像沒有這個功能~
clipboard.png