本文整理了Java中java.net.ConnectException.setStackTrace()
方法的一些代码示例,展示了ConnectException.setStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConnectException.setStackTrace()
方法的具体详情如下:
包路径:java.net.ConnectException
类名称:ConnectException
方法名:setStackTrace
暂无
代码示例来源:origin: io.netty/netty
private static void connect(SelectionKey k) throws IOException {
NioClientSocketChannel ch = (NioClientSocketChannel) k.attachment();
try {
if (ch.channel.finishConnect()) {
k.cancel();
if (ch.timoutTimer != null) {
ch.timoutTimer.cancel();
}
ch.worker.register(ch, ch.connectFuture);
}
} catch (ConnectException e) {
ConnectException newE = new ConnectException(e.getMessage() + ": " + ch.requestedRemoteAddress);
newE.setStackTrace(e.getStackTrace());
throw newE;
}
}
代码示例来源:origin: wildfly/wildfly-core
@Override
public final ConnectException couldNotConnect(final URI uri) {
final ConnectException result = new ConnectException(String.format(getLoggingLocale(), couldNotConnect$str(), uri));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String invalidByteToken = "WFLYPRT0030: Invalid byte token. Expecting '%d' received '%d'";
代码示例来源:origin: org.wildfly.core/wildfly-protocol
@Override
public final ConnectException couldNotConnect(final URI uri) {
final ConnectException result = new ConnectException(String.format(getLoggingLocale(), couldNotConnect$str(), uri));
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String invalidByteToken = "WFLYPRT0030: Invalid byte token. Expecting '%d' received '%d'";
代码示例来源:origin: nyankosama/simple-netty-source
private static void connect(SelectionKey k) throws IOException {
NioClientSocketChannel ch = (NioClientSocketChannel) k.attachment();
try {
if (ch.channel.finishConnect()) {
k.cancel();
if (ch.timoutTimer != null) {
ch.timoutTimer.cancel();
}
ch.worker.register(ch, ch.connectFuture);
}
} catch (ConnectException e) {
ConnectException newE = new ConnectException(e.getMessage() + ": " + ch.requestedRemoteAddress);
newE.setStackTrace(e.getStackTrace());
throw newE;
}
}
代码示例来源:origin: harbby/presto-connectors
private static void connect(SelectionKey k) throws IOException {
NioClientSocketChannel ch = (NioClientSocketChannel) k.attachment();
try {
if (ch.channel.finishConnect()) {
k.cancel();
if (ch.timoutTimer != null) {
ch.timoutTimer.cancel();
}
ch.worker.register(ch, ch.connectFuture);
}
} catch (ConnectException e) {
ConnectException newE = new ConnectException(e.getMessage() + ": " + ch.requestedRemoteAddress);
newE.setStackTrace(e.getStackTrace());
throw newE;
}
}
代码示例来源:origin: org.wildfly.core/wildfly-protocol
@Override
public final ConnectException failedToConnect(final URI uri, final Exception cause) {
final ConnectException result = new ConnectException(String.format(getLoggingLocale(), failedToConnect$str(), uri));
result.initCause(cause);
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String channelClosed = "WFLYPRT0054: Channel closed";
代码示例来源:origin: wildfly/wildfly-core
@Override
public final ConnectException failedToConnect(final URI uri, final Exception cause) {
final ConnectException result = new ConnectException(String.format(getLoggingLocale(), failedToConnect$str(), uri));
result.initCause(cause);
final StackTraceElement[] st = result.getStackTrace();
result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
return result;
}
private static final String channelClosed = "WFLYPRT0054: Channel closed";
代码示例来源:origin: org.apache.apex/apex-shaded-ning19
private static void connect(SelectionKey k) throws IOException {
NioClientSocketChannel ch = (NioClientSocketChannel) k.attachment();
try {
if (ch.channel.finishConnect()) {
k.cancel();
if (ch.timoutTimer != null) {
ch.timoutTimer.cancel();
}
ch.worker.register(ch, ch.connectFuture);
}
} catch (ConnectException e) {
ConnectException newE = new ConnectException(e.getMessage() + ": " + ch.requestedRemoteAddress);
newE.setStackTrace(e.getStackTrace());
throw newE;
}
}
代码示例来源:origin: net.anthavio/hatatitla
private IOException translateException(HttpURLConnection connection, Exception exception) throws IOException {
if (exception instanceof SocketTimeoutException) {
//enhance message with timeout values
if (exception.getMessage().equals("connect timed out")) {
ConnectException cx = new ConnectException("Connect timeout " + connection.getConnectTimeout() + " ms");
cx.setStackTrace(exception.getStackTrace());
throw cx;
} else if (exception.getMessage().equals("Read timed out")) {
SocketTimeoutException stx = new SocketTimeoutException("Read timeout " + connection.getReadTimeout() + " ms");
stx.setStackTrace(exception.getStackTrace());
throw stx;
} else {
throw (SocketTimeoutException) exception;
}
} else if (exception instanceof ConnectException) {
//enhance message with url
ConnectException ctx = new ConnectException("Connection refused " + config.getUrl());
ctx.setStackTrace(exception.getStackTrace());
throw ctx;
} else if (exception instanceof IOException) {
throw (IOException) exception;
} else {
IOException iox = new IOException(exception.getMessage());
iox.setStackTrace(exception.getStackTrace());
throw iox;
}
}
代码示例来源:origin: net.anthavio/hatatitla
cx.setStackTrace(x.getStackTrace());
throw cx;
} else if (x instanceof ConnectTimeoutException) {
ConnectException cx = new ConnectException("Connect timeout " + config.getConnectTimeoutMillis() + " ms");
cx.setStackTrace(x.getStackTrace());
throw cx;
} else if (x instanceof SocketTimeoutException) {
ctx.setStackTrace(x.getStackTrace());
throw ctx;
} else if (x instanceof IOException) {
代码示例来源:origin: net.anthavio/hatatitla
if (x instanceof ConnectionPoolTimeoutException) {
ConnectException ctx = new ConnectException("Pool timeout " + config.getPoolAcquireTimeoutMillis() + " ms");
ctx.setStackTrace(x.getStackTrace());
throw ctx;
} else if (x instanceof ConnectTimeoutException) {
ConnectException ctx = new ConnectException("Connect timeout " + config.getConnectTimeoutMillis() + " ms");
ctx.setStackTrace(x.getStackTrace());
throw ctx;
} else if (x instanceof HttpHostConnectException) {
ctx.setStackTrace(x.getStackTrace());
throw ctx;
} else if (x instanceof SocketTimeoutException) {
代码示例来源:origin: net.anthavio/hatatitla
} else if (x instanceof SocketTimeoutException) {
ConnectException cx = new ConnectException("Connect timeout " + config.getConnectTimeoutMillis() + " ms");
cx.setStackTrace(x.getStackTrace());
throw cx;
内容来源于网络,如有侵权,请联系作者删除!