Package org.apache.catalina.tribes

Examples of org.apache.catalina.tribes.ChannelException


            msg.getMessage().trim(msg.getMessage().getLength());
            msg.getMessage().append(data,0,data.length);
            getNext().sendMessage(destination, msg, payload);
        } catch ( IOException x ) {
            log.error("Unable to compress byte contents");
            throw new ChannelException(x);
        }
    }
View Full Code Here


            while ( (remaining>0) && (delta<timeout) ) {
                remaining -= doLoop(selectTimeout,retryAttempts);
            }
            if ( remaining > 0 ) {
                //timeout has occured
                ChannelException cx = new ChannelException("Operation has timed out("+timeout+" ms.).");
                for (int i=0; i<senders.length; i++ ) {
                    if (!senders[i].isComplete() ) cx.addFaultyMember(senders[i].getDestination());
                }
                throw cx;
            }
        } catch (Exception x ) {
            try { this.disconnect(); } catch (Exception ignore) {}
            if ( x instanceof ChannelException ) throw (ChannelException)x;
            else throw new ChannelException(x);
        }
       
    }
View Full Code Here

                        sender.setMessage(data);
                    }catch ( Exception ignore){
                        //dont report the error on a resend
                    }
                } else {
                    ChannelException cx = new ChannelException(x);
                    cx.addFaultyMember(sender.getDestination());
                    throw cx;
                }//end if
            }
        }
        return completed;
View Full Code Here

        return completed;

    }
   
    private void connect(NioSender[] senders) throws ChannelException {
        ChannelException x = null;
        for (int i=0; i<senders.length; i++ ) {
            try {
                if (!senders[i].isConnected()) senders[i].connect();
            }catch ( IOException io ) {
                if ( x==null ) x = new ChannelException(io);
                x.addFaultyMember(senders[i].getDestination());
            }
        }
        if ( x != null ) throw x;
    }
View Full Code Here

        }
        if ( x != null ) throw x;
    }
   
    private void setData(NioSender[] senders, byte[] data) throws ChannelException {
        ChannelException x = null;
        for (int i=0; i<senders.length; i++ ) {
            try {
                senders[i].setMessage(data);
            }catch ( IOException io ) {
                if ( x==null ) x = new ChannelException(io);
                x.addFaultyMember(senders[i].getDestination());
            }
        }
        if ( x != null ) throw x;
    }
View Full Code Here

        setConnected(true);
    }
   
   
    private synchronized void close() throws ChannelException  {
        ChannelException x = null;
        Object[] members = nioSenders.keySet().toArray();
        for (int i=0; i<members.length; i++ ) {
            Member mbr = (Member)members[i];
            try {
                NioSender sender = (NioSender)nioSenders.get(mbr);
                sender.disconnect();
            }catch ( Exception e ) {
                if ( x == null ) x = new ChannelException(e);
                x.addFaultyMember(mbr);
            }
            nioSenders.remove(mbr);
        }
        if ( x != null ) throw x;
    }
View Full Code Here

     * Send data to one member
     * @see org.apache.catalina.tribes.ClusterSender#sendMessage(org.apache.catalina.tribes.ClusterMessage, org.apache.catalina.tribes.Member)
     */
    public void sendMessage(ChannelMessage message, Member[] destination) throws ChannelException {
        if ( !isParallel() ) {
            ChannelException exception = null;
            for (int i = 0; i < destination.length; i++) {
                try {
                    sendMessage(message, destination[i]);
                } catch (Exception x) {
                    if (exception == null) exception = new ChannelException(x);
                    exception.addFaultyMember(destination[i]);
                }
            }
            if (exception != null)throw exception;
        } else {
            MultiPointSender sender = getParallelSender();
View Full Code Here

            buffer.append(b,0,b.length);
            data.setMessage(buffer);
            getFirstInterceptor().sendMessage(destination, data, null);
        }catch ( Exception x ) {
            if ( x instanceof ChannelException ) throw (ChannelException)x;
            throw new ChannelException(x);
        }
    }
View Full Code Here

            if ( (svc & Channel.MBR_RX_SEQ) == Channel.MBR_RX_SEQ) membershipService.start(MembershipService.MBR_RX);
            if ( (svc & Channel.MBR_TX_SEQ) == Channel.MBR_TX_SEQ) membershipService.start(MembershipService.MBR_TX);
        }catch ( ChannelException cx ) {
            throw cx;
        }catch ( Exception x ) {
            throw new ChannelException(x);
        }
    }
View Full Code Here

            if ( (svc & Channel.MBR_RX_SEQ) == Channel.MBR_RX_SEQ) membershipService.stop();
            if ( (svc & Channel.SND_RX_SEQ) == Channel.SND_RX_SEQ) clusterReceiver.stop();
            if ( (svc & Channel.SND_TX_SEQ) == Channel.SND_TX_SEQ) clusterSender.stop();
            if ( (svc & Channel.MBR_TX_SEQ) == Channel.MBR_RX_SEQ) membershipService.stop();
        }catch ( Exception x ) {
            throw new ChannelException(x);
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.tribes.ChannelException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.