List of usage examples for io.netty.channel ChannelException ChannelException
public ChannelException(Throwable cause)
From source file:com.addthis.meshy.SourceHandler.java
License:Apache License
protected void start(String targetUuid) { this.readTime = JitterClock.globalTime(); Collection<ChannelState> matches = master.getChannels(targetUuid); if (matches.isEmpty()) { throw new ChannelException("no matching mesh peers"); }//from w ww . j a va 2 s . c o m this.session = master.newSession(); Set<Channel> group = new HashSet<>(matches.size()); for (ChannelState state : matches) { group.add(state.getChannel()); } this.channels = Collections.synchronizedSet(group); this.targetHandler = master.targetHandlerId(targetClass); setReadTimeout(DEFAULT_RESPONSE_TIMEOUT); setCompleteTimeout(DEFAULT_COMPLETE_TIMEOUT); activeSources.add(this); for (ChannelState state : matches) { /* add channel callback path to source */ state.addSourceHandler(session, this); if (!state.getChannel().isOpen()) { channels.remove(state.getChannel()); // may or may not be needed } } log.debug("{} start target={} uuid={} group={} sessionID={}", this, targetHandler, targetUuid, channels, session); }
From source file:com.eucalyptus.util.async.AsyncRequestHandler.java
License:Open Source License
private void checkFinished(final ChannelHandlerContext ctx, final boolean inactive) { if ((this.acquireFuture != null) && !this.acquireFuture.isSuccess() && (this.acquireFuture.cause() instanceof IOException)) { final Throwable ioError = this.acquireFuture.cause(); if (!this.writeComplete.get()) { this.teardown(new RetryableConnectionException( "Channel was closed before the write operation could be completed: " + ioError.getMessage(), ioError, this.request.get())); } else {/*from w w w . j av a 2 s . co m*/ this.teardown(new ConnectionException( "Channel was closed before the response was received: " + ioError.getMessage(), ioError, this.request.get())); } } else { if (!this.writeComplete.get()) { this.teardown(new RetryableConnectionException( "Channel was closed before the write operation could be completed", this.request.get())); } else if (!this.response.isDone()) { this.teardown(new ConnectionException("Channel was closed before the response was received.", this.request.get())); } else { //GRZE:WOO:HA: guess we either failed to connect asynchronously or did the write but didn't actually read anything. So.... this.teardown(new ChannelException("Channel was closed before connecting.")); } } }
From source file:cyril.server.io.LessThanNullSuite.java
License:Open Source License
public static final void runStandalone(NorthernerServer ns) { try {//w w w.j a v a 2 s.co m ServerSocketChannel ch = (ServerSocketChannel) ns.channelFuture.sync().channel(); System.out.println("Using channel " + ch + " (" + ch.getClass().getSimpleName() + ")"); ch.closeFuture().sync(); System.out.println("Has closed?!"); } catch (InterruptedException e) { throw new ChannelException(e); } finally { System.out.println("Shutting down..."); ns.bootstrap.shutdown(); } }
From source file:divconq.http.multipart.AbstractHttpData.java
License:Apache License
@Override public ByteBuf content() { try {/* ww w . j a v a2 s . c om*/ return getByteBuf(); } catch (IOException e) { throw new ChannelException(e); } }
From source file:divconq.http.multipart.DiskAttribute.java
License:Apache License
@Override public Attribute copy() { DiskAttribute attr = new DiskAttribute(getName()); attr.setCharset(getCharset());// w ww . java 2s .c o m ByteBuf content = content(); if (content != null) { try { attr.setContent(content.copy()); } catch (IOException e) { throw new ChannelException(e); } } return attr; }
From source file:divconq.http.multipart.DiskAttribute.java
License:Apache License
@Override public Attribute duplicate() { DiskAttribute attr = new DiskAttribute(getName()); attr.setCharset(getCharset());/*from w w w .j a v a 2 s .com*/ ByteBuf content = content(); if (content != null) { try { attr.setContent(content.duplicate()); } catch (IOException e) { throw new ChannelException(e); } } return attr; }
From source file:divconq.http.multipart.DiskFileUpload.java
License:Apache License
@Override public FileUpload copy() { DiskFileUpload upload = new DiskFileUpload(getName(), getFilename(), getContentType(), getContentTransferEncoding(), getCharset(), size); ByteBuf buf = content();/*from w w w . j a v a2 s . c om*/ if (buf != null) { try { upload.setContent(buf.copy()); } catch (IOException e) { throw new ChannelException(e); } } return upload; }
From source file:divconq.http.multipart.DiskFileUpload.java
License:Apache License
@Override public FileUpload duplicate() { DiskFileUpload upload = new DiskFileUpload(getName(), getFilename(), getContentType(), getContentTransferEncoding(), getCharset(), size); ByteBuf buf = content();// w ww. j a v a2 s.com if (buf != null) { try { upload.setContent(buf.duplicate()); } catch (IOException e) { throw new ChannelException(e); } } return upload; }
From source file:divconq.http.multipart.MemoryAttribute.java
License:Apache License
@Override public Attribute copy() { MemoryAttribute attr = new MemoryAttribute(getName()); attr.setCharset(getCharset());/*from ww w.j a va 2 s . com*/ ByteBuf content = content(); if (content != null) { try { attr.setContent(content.copy()); } catch (IOException e) { throw new ChannelException(e); } } return attr; }
From source file:divconq.http.multipart.MemoryAttribute.java
License:Apache License
@Override public Attribute duplicate() { MemoryAttribute attr = new MemoryAttribute(getName()); attr.setCharset(getCharset());/* w w w. j a v a2 s . c o m*/ ByteBuf content = content(); if (content != null) { try { attr.setContent(content.duplicate()); } catch (IOException e) { throw new ChannelException(e); } } return attr; }