當前位置: 首頁>>代碼示例>>Java>>正文


Java BindException.getMessage方法代碼示例

本文整理匯總了Java中java.net.BindException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java BindException.getMessage方法的具體用法?Java BindException.getMessage怎麽用?Java BindException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.net.BindException的用法示例。


在下文中一共展示了BindException.getMessage方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import java.net.BindException; //導入方法依賴的package包/類
public void init()
    throws Exception {

    if (initialized)
        return;
    
    // Initialize thread count defaults for acceptor
    if (acceptorThreadCount == 0) {
        acceptorThreadCount = 1;
    }
    if (serverSocketFactory == null) {
        serverSocketFactory = ServerSocketFactory.getDefault();
    }
    if (serverSocket == null) {
        try {
            if (address == null) {
                serverSocket = serverSocketFactory.createSocket(port, backlog);
            } else {
                serverSocket = serverSocketFactory.createSocket(port, backlog, address);
            }
        } catch (BindException be) {
            if (address == null) {
                throw new BindException(be.getMessage() + "<null>:" + port);
            } else {
                throw new BindException(be.getMessage() + " " +
                        address.toString() + ":" + port);
            }
        }
    }
    //if( serverTimeout >= 0 )
    //    serverSocket.setSoTimeout( serverTimeout );
    
    initialized = true;
    
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:36,代碼來源:JIoEndpoint.java

示例2: bindExceptionHandler

import java.net.BindException; //導入方法依賴的package包/類
@ExceptionHandler(BindException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
@ResponseBody
public Result<Object> bindExceptionHandler(BindException e){
    String errorMsg="請求數據校驗不合法: ";
    if(e!=null){
        errorMsg=e.getMessage();
        log.warn(errorMsg);
    }
    return new ResultUtil<>().setErrorMsg(errorMsg);
}
 
開發者ID:Exrick,項目名稱:xmall,代碼行數:12,代碼來源:RestCtrlExceptionHandler.java

示例3: bind

import java.net.BindException; //導入方法依賴的package包/類
@Override
protected void bind(InetSocketAddress socketAddress) throws IOException {
    initChannel();
    try {
        datagramSocket.bind(socketAddress);
    } catch (BindException e) {
        throw new BindException(e.getMessage() + " at " + socketAddress.getPort());
    }
    initSelectorLoops();
}
 
開發者ID:generallycloud,項目名稱:baseio,代碼行數:11,代碼來源:DatagramChannelAcceptor.java

示例4: bind

import java.net.BindException; //導入方法依賴的package包/類
@Override
protected void bind(InetSocketAddress socketAddress) throws IOException {
    initChannel();
    initSelectorLoops();
    initNioSessionMananger();
    try {
        this.serverSocket.bind(socketAddress, 50);
    } catch (BindException e) {
        throw new BindException(e.getMessage() + " at " + socketAddress.getPort());
    }
}
 
開發者ID:generallycloud,項目名稱:baseio,代碼行數:12,代碼來源:NioSocketChannelAcceptor.java

示例5: bind

import java.net.BindException; //導入方法依賴的package包/類
@Override
public void bind() throws Exception {

    // Initialize thread count defaults for acceptor
    if (acceptorThreadCount == 0) {
        acceptorThreadCount = 1;
    }
    // Initialize maxConnections
    if (getMaxConnections() == 0) {
        // User hasn't set a value - use the default
        setMaxConnections(getMaxThreadsInternal());
    }

    if (serverSocketFactory == null) {  //構造serverSocketFactory
        if (isSSLEnabled()) {
            serverSocketFactory =
                handler.getSslImplementation().getServerSocketFactory(this);
        } else {
            serverSocketFactory = new DefaultServerSocketFactory(this);
        }
    }

    if (serverSocket == null) {
        try {
            if (getAddress() == null) {
                serverSocket = serverSocketFactory.createSocket(getPort(),
                        getBacklog());
            } else {
                serverSocket = serverSocketFactory.createSocket(getPort(),
                        getBacklog(), getAddress());
            }
        } catch (BindException orig) {
            String msg;
            if (getAddress() == null)
                msg = orig.getMessage() + " <null>:" + getPort();
            else
                msg = orig.getMessage() + " " +
                        getAddress().toString() + ":" + getPort();
            BindException be = new BindException(msg);
            be.initCause(orig);
            throw be;
        }
    }

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:46,代碼來源:JIoEndpoint.java

示例6: bind

import java.net.BindException; //導入方法依賴的package包/類
@Override
public void bind() throws Exception {

    // Initialize thread count defaults for acceptor
    // 接收sokcet請求的線程的數量 非常輕量級 隻負責拿到後稍微包裝後轉發給processor 可以適量增大線程數 比如3個或者5個
    if (acceptorThreadCount == 0) {
        acceptorThreadCount = 1;
    }
    // Initialize maxConnections
    // 如果server.xml中沒有配置maxConnections參數 默認為200
    if (getMaxConnections() == 0) {
        // User hasn't set a value - use the default
        setMaxConnections(getMaxThreadsInternal());//200 所以tomcat默認的最大連接數量是200個
    }

    if (serverSocketFactory == null) {
        if (isSSLEnabled()) {
            serverSocketFactory =
                handler.getSslImplementation().getServerSocketFactory(this);
        } else {
            //
            serverSocketFactory = new DefaultServerSocketFactory(this);
        }
    }

    if (serverSocket == null) {
        try {
            if (getAddress() == null) {
                serverSocket = serverSocketFactory.createSocket(getPort(),
                        getBacklog());
            } else {
                serverSocket = serverSocketFactory.createSocket(getPort(),
                        getBacklog(), getAddress());
            }
        } catch (BindException orig) {
            String msg;
            if (getAddress() == null)
                msg = orig.getMessage() + " <null>:" + getPort();
            else
                msg = orig.getMessage() + " " +
                        getAddress().toString() + ":" + getPort();
            BindException be = new BindException(msg);
            be.initCause(orig);
            throw be;
        }
    }

}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:49,代碼來源:JIoEndpoint.java

示例7: bind

import java.net.BindException; //導入方法依賴的package包/類
@Override
public void bind() throws Exception {

	// Initialize thread count defaults for acceptor
	if (acceptorThreadCount == 0) {
		acceptorThreadCount = 1;
	}
	// Initialize maxConnections
	if (getMaxConnections() == 0) {
		// User hasn't set a value - use the default
		setMaxConnections(getMaxThreadsInternal());
	}

	if (serverSocketFactory == null) {
		if (isSSLEnabled()) {
			serverSocketFactory = handler.getSslImplementation().getServerSocketFactory(this);
		} else {
			serverSocketFactory = new DefaultServerSocketFactory(this);
		}
	}

	if (serverSocket == null) {
		try {
			if (getAddress() == null) {
				serverSocket = serverSocketFactory.createSocket(getPort(), getBacklog());
			} else {
				serverSocket = serverSocketFactory.createSocket(getPort(), getBacklog(), getAddress());
			}
		} catch (BindException orig) {
			String msg;
			if (getAddress() == null)
				msg = orig.getMessage() + " <null>:" + getPort();
			else
				msg = orig.getMessage() + " " + getAddress().toString() + ":" + getPort();
			BindException be = new BindException(msg);
			be.initCause(orig);
			throw be;
		}
	}

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:42,代碼來源:JIoEndpoint.java


注:本文中的java.net.BindException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。