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

鍍金池/ 問答/ Java問答
司令 回答

private BlackInfoDaoImpl blackInfoDao; 沒有初始化呀,

加上@Autowired注解吧,spring的依賴注入。

@Autowired
private BlackInfoDaoImpl blackInfoDao;
吢丕 回答

官方文檔也太簡單了,最重要的config.json怎么配置都不說明,只能去gg,bd,gh上大海撈針,折騰了兩天終于搞定了。

    {
        "url": "http://www.vikibeta.com",
        "secret": "NSFW",
        "database": "redis",
         "socket.io": {
            "transports": ["websocket", "polling"],
            "address": "http://www.vikibeta.com"
        },  
        "port": [
            "4567",
            "4568",
            "4569"
        ],  
        "redis": {
            "host": "127.0.0.1",
            "port": "6379",
            "password": "PASSWORD",
            "database": "0" 
        }   
    }

其中最重要的就是

"socket.io": {
    "transports": ["websocket", "polling"],
    "address": "http://www.vikibeta.com"
}, 
囍槑 回答

https代理在建立代理隧道之后只需要轉(zhuǎn)發(fā)原始報文就好了,這樣做代理服務(wù)器并不能拿到https明文,而中間人攻擊是能拿到明文的
可以看看https://segmentfault.com/a/11...

筱饞貓 回答

點開network,看看返回的內(nèi)容是不是js.

礙你眼 回答

Java 由于類型擦除不能獲取到 T.class,一般的做法是將 Class<T> 當作參數(shù)傳入

愿如初 回答

去掉style上的scoped試試

單眼皮 回答

a, c 是傳值, 所以函數(shù)內(nèi)的 a, c 是 a,c 的拷貝. b, d是傳引用, 但是 Integer 是 immutable, 自身的值無法改變. 所以只有 d 的值會變.

毀憶 回答

vendor的文件都是其他的ISV提供的,不需要修改,這是共識。

安淺陌 回答

1:基本數(shù)據(jù)類型的訪問讀寫是具備原子性的(主要注意:對于32位操作系統(tǒng)來說,單次次操作能處理的最長長度為32bit,而long類型8字節(jié)64bit,所以對long的讀寫都要兩條指令才能完成(即每次讀寫64bit中的32bit)。)
2:同步塊(synchronized關(guān)鍵字)

悶騷型 回答

首先要明確一點:ArrayList用for循環(huán)遍歷比iterator迭代器遍歷快,LinkedList用iterator迭代器遍歷比for循環(huán)遍歷快。
至于Iterator為什么比順序遍歷鏈表要節(jié)省時間,我的理解是,由于arrayList基于數(shù)組,下標明確,使用for循環(huán)的時候,get(i)效率很高;
而linkedList基于鏈表,get(i)復雜度是O(n),加上循環(huán)的次數(shù)就是O(n^2),但是用iterator.next()則不需要下標,只需要算上循環(huán)的復雜度就可以了

念舊 回答
是不是我只有一臺服務(wù)器就沒有必要用rpc?

不是的, 你裝的操作系統(tǒng)進程間通信大量的大用rpc技術(shù),因為當軟件復雜到一定程度時需要通過模塊化解耦,便于分別升級維護,便于團隊開發(fā)。

rpc是不是要可以用于遠程的客戶端服務(wù)器通信?

可以的,http-rpc了解下。處理好現(xiàn)在的微服務(wù)也是類似的概念,需要做的是處理好安全,和流量管理的問題,這些都有現(xiàn)成的方案。問題是哪種技術(shù)更適合。

rpc是否可以跨語言?

當然沒問題,跨平臺跨語言的早就發(fā)明出來了。但如果用同一種語言的序列化方式,顯然會更方便也效率更高,成本更低,前提是你沒有跨語言的要求。

愿如初 回答
//遞歸查找出id所在數(shù)組,返回其數(shù)據(jù)及所在下標
function findParent(data,id){
  for(let i=0; i<data.length; i++){
    if(data[i].id == id){
      return {data: data, index:i}
    }else if(data[i].children && data[i].children.length){
      let res = findParent(data[i].children,id);
      if(res) reuturn res
    } 
  }
}

let parentData = findParent(data,id);
if(parentData){
  let child = parentData.data[parentData.index].children || [];
  parentData.data.splice(parentData.index,1,...child); //子數(shù)據(jù)替換父數(shù)據(jù)
}
裸橙 回答

基本上,你可以忽略這個警告,和你的FileOutputStream沒關(guān)系,是因為JDBC驅(qū)動沒有unregister,但這僅發(fā)生在tomcat關(guān)閉的時候,所以可以忽略。 如果你一定要解決,這樣做:

在web.xml里注冊一個listener:

<web-app version="2.5"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <listener>
      <listener-class>
          example.ServletContextExample
      </listener-class>
  </listener>
</web-app>

然后在這個listener實現(xiàn)里,把jdbc驅(qū)動unregister:

Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
    Driver driver = drivers.nextElement();
    try {
        DriverManager.deregisterDriver(driver);
    } catch (SQLException e) {
    }
}

假灑脫 回答

請參考我這個答案。鏈接描述

補充代碼,代碼不是完整的,不過可以參考一下。

public class ChanHandler extends ChannelInboundHandlerAdapter {

    private static final Logger logger = LoggerFactory.getLogger(ChanHandler.class);

    @Resource
    private BusinessService businessService;
    @Resource
    private ChannelManager channelManager;


    /**
     * 建立連接時
     * @param ctx
     */
    @Override
    public void channelRegistered(ChannelHandlerContext ctx) {

        //...
    }

    @Override
    public void channelUnregistered(ChannelHandlerContext ctx) {

        //...
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) {
        try {
            String requestStr = (String)msg;
            if(ctx.executor().inEventLoop()){
                businessLogic(ctx,requestStr);
            }else {
                ctx.executor().execute(() -> businessLogic(ctx,requestStr));
            }

        }finally {
            ReferenceCountUtil.release(msg);
        }
    }

    /**
     * 處理業(yè)務(wù)邏輯
     * @param ctx
     * @param requestStr
     */
    private void businessLogic(ChannelHandlerContext ctx,String requestStr){
        Response res = null;
        try {
            JSONObject request = JSON.parseObject(requestStr);
            switch (request.getString("action")){
                case "dev_login":
                    res = businessService.dev_login(request,ctx);
                    break;
                case "ping":
                    res = new Response("pong",null);
                    break;
                case "msg":
                    res = businessService.processing_msg(request,ctx);
                    break;
                case "quit":
                    String key = ConnUtils.getKey(ctx);
                    channelManager.removeConnection(key);
            }
        }catch (Exception e){
            res = new Response("error",400,"無法解析的字符","");
        }finally {
            IOUtil.writeAndFlush(ctx,res);
        }
    }
    
    // ...
}
EventLoopGroup bossGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();

EventExecutorGroup logicGroup = new DefaultEventExecutorGroup(16);

try {

    ServerBootstrap bootstrap = new ServerBootstrap();
    bootstrap.group(bossGroup,workerGroup);
    bootstrap.channel(NioServerSocketChannel.class);
    bootstrap.handler(new LoggingHandler(LogLevel.INFO));
    bootstrap.childHandler(new ChannelInitializer<SocketChannel>() {
        @Override
        protected void initChannel(SocketChannel socketChannel) {
            ChannelPipeline pipeline = socketChannel.pipeline();
            pipeline.addLast(new LoggingHandler(LogLevel.INFO));

            ByteBuf byteBuf = Unpooled.copiedBuffer(Const.DELIMITER.getBytes());
            pipeline.addLast(new DelimiterBasedFrameDecoder(1024,byteBuf));

            pipeline.addLast(new IdleStateHandler(readWaitSeconds, 0, 0));

            pipeline.addLast(new StringDecoder());
            pipeline.addLast(new StringEncoder());

            pipeline.addLast(logicGroup,chanHandler);
        }
    });

    bootstrap.option(ChannelOption.SO_BACKLOG, 128);
    bootstrap.childOption(ChannelOption.SO_KEEPALIVE, true);

    ChannelFuture future = bootstrap.bind(port).sync();

    future.channel().closeFuture().sync();

} catch (InterruptedException e) {
    logger.error("Server error,{}",e);
} finally {
    bossGroup.shutdownGracefully();
    workerGroup.shutdownGracefully();
    logicGroup.shutdownGracefully();
}
尐飯團 回答

ViewPager內(nèi)的Fragment間交互處理起來會比較麻煩,而最簡單的方法就是使用EventBus
參考:Communication between Fragments in ViewPager

另外也可以參考:
Dynamically updating a fragment

黑與白 回答

可以考慮使用concurrent.futures中的ThreadPoolExecutor

from concurrent.futures import ThreadPoolExecutor
executor = ThreadPoolExecutor(2) #參數(shù)為要再開的線程數(shù)
...
executor.submit(your_function)