java.net.ConnectException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中java.net.ConnectException.<init>()方法的一些代码示例,展示了ConnectException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConnectException.<init>()方法的具体详情如下:
包路径:java.net.ConnectException
类名称:ConnectException
方法名:<init>

ConnectException.<init>介绍

[英]Constructs a new instance.
[中]构造一个新实例。

代码示例

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> transfer(byte[] request) {
 if (transferHandler != null) {
  return transferHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> heartbeat(byte[] request) {
 if (heartbeatHandler != null) {
  return heartbeatHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> closeSession(byte[] request) {
 if (closeSessionHandler != null) {
  return closeSessionHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> command(byte[] request) {
 if (commandHandler != null) {
  return commandHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> leave(byte[] request) {
 if (leaveHandler != null) {
  return leaveHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> poll(byte[] request) {
 if (pollHandler != null) {
  return pollHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> openSession(byte[] request) {
 if (openSessionHandler != null) {
  return openSessionHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> query(byte[] request) {
 if (queryHandler != null) {
  return queryHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> keepAlive(byte[] request) {
 if (keepAliveHandler != null) {
  return keepAliveHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> configure(byte[] request) {
 if (configureHandler != null) {
  return configureHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> reconfigure(byte[] request) {
 if (reconfigureHandler != null) {
  return reconfigureHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> metadata(byte[] request) {
 if (metadataHandler != null) {
  return metadataHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> join(byte[] request) {
 if (joinHandler != null) {
  return joinHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> install(byte[] request) {
 if (installHandler != null) {
  return installHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

CompletableFuture<byte[]> append(byte[] request) {
 if (appendHandler != null) {
  return appendHandler.apply(decode(request)).thenApply(this::encode);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: redisson/redisson

final boolean failConnectPromise(Throwable cause) {
  if (connectPromise != null) {
    // SO_ERROR has been shown to return 0 on macOS if detect an error via read() and the write filter was
    // not set before calling connect. This means finishConnect will not detect any error and would
    // successfully complete the connectPromise and update the channel state to active (which is incorrect).
    ChannelPromise connectPromise = AbstractKQueueChannel.this.connectPromise;
    AbstractKQueueChannel.this.connectPromise = null;
    if (connectPromise.tryFailure((cause instanceof ConnectException) ? cause
            : new ConnectException("failed to connect").initCause(cause))) {
      closeIfClosed();
      return true;
    }
  }
  return false;
}

代码示例来源:origin: apache/zeppelin

protected <T, U> CompletableFuture<U> sendAndReceive(MemberId memberId,
                           String type, T request) {
 Address address = address(memberId);
 if (address == null) {
  return Futures.exceptionalFuture(new ConnectException());
 }
 return messagingService.sendAndReceive(address, type, serializer.encode(request))
   .thenApply(serializer::decode);
}

代码示例来源:origin: apache/zeppelin

private CompletableFuture<LocalRaftServerProtocol> getServer(MemberId memberId) {
 LocalRaftServerProtocol server = server(memberId);
 if (server != null) {
  return Futures.completedFuture(server);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: apache/zeppelin

private CompletableFuture<LocalRaftClientProtocol> getClient(MemberId memberId) {
 LocalRaftClientProtocol client = client(memberId);
 if (client != null) {
  return Futures.completedFuture(client);
 } else {
  return Futures.exceptionalFuture(new ConnectException());
 }
}

代码示例来源:origin: square/okhttp

/** Does all the work necessary to build a full HTTP or HTTPS connection on a raw socket. */
private void connectSocket(int connectTimeout, int readTimeout, Call call,
  EventListener eventListener) throws IOException {
 Proxy proxy = route.proxy();
 Address address = route.address();
 rawSocket = proxy.type() == Proxy.Type.DIRECT || proxy.type() == Proxy.Type.HTTP
   ? address.socketFactory().createSocket()
   : new Socket(proxy);
 eventListener.connectStart(call, route.socketAddress(), proxy);
 rawSocket.setSoTimeout(readTimeout);
 try {
  Platform.get().connectSocket(rawSocket, route.socketAddress(), connectTimeout);
 } catch (ConnectException e) {
  ConnectException ce = new ConnectException("Failed to connect to " + route.socketAddress());
  ce.initCause(e);
  throw ce;
 }
 // The following try/catch block is a pseudo hacky way to get around a crash on Android 7.0
 // More details:
 // https://github.com/square/okhttp/issues/3245
 // https://android-review.googlesource.com/#/c/271775/
 try {
  source = Okio.buffer(Okio.source(rawSocket));
  sink = Okio.buffer(Okio.sink(rawSocket));
 } catch (NullPointerException npe) {
  if (NPE_THROW_WITH_NULL.equals(npe.getMessage())) {
   throw new IOException(npe);
  }
 }
}

相关文章