/** * Notifies all writers of an error condition. * * @param ex the exception to notify */ protected synchronized final void reportExceptionToAllWriters(Exception ex) { for (ChannelHandlerWriteSubscription subscription : writeSubscriptions.values()) { subscription.getExceptionWriteFunction().writeValue(ex); } }
@Override public void run() { for (Map.Entry<ChannelHandler, Collection<ChannelHandlerWriteSubscription>> entry : handlers.entrySet()) { ChannelHandler channelHandler = entry.getKey(); Collection<ChannelHandlerWriteSubscription> subscriptions = entry.getValue(); for (ChannelHandlerWriteSubscription subscription : subscriptions) { try { channelHandler.addWriter(subscription); } catch (Exception ex) { // If an error happens while adding the write subscription, // notify the appropriate handler subscription.getExceptionWriteFunction().writeValue(ex); } } } } });
/** * Notifies all readers and writers of an error condition. * * @param ex the exception to notify */ protected synchronized final void reportExceptionToAllReadersAndWriters(Exception ex) { for (MonitorHandler monitor : monitors.values()) { monitor.subscription.getExceptionWriteFunction().writeValue(ex); } for (ChannelHandlerWriteSubscription subscription : writeSubscriptions.values()) { subscription.getExceptionWriteFunction().writeValue(ex); } }
@Override protected synchronized void addWriter(ChannelHandlerWriteSubscription subscription) { super.addWriter(subscription); // If already connected and read only, we need to notify this writer if (sentReadOnlyException) { subscription.getExceptionWriteFunction().writeValue(createReadOnlyException()); } }
channelWriteRecipe.getWriteSubscription().getExceptionWriteFunction().writeValue(ex);