FileDocCategorySizeDatePackage
ChannelException.javaAPI DocApache Tomcat 6.0.145938Fri Jul 20 04:20:32 BST 2007org.apache.catalina.tribes

ChannelException

public class ChannelException extends Exception
Channel Exception
A channel exception is thrown when an internal error happens somewhere in the channel.
When a global error happens, the cause can be retrieved using getCause()

If an application is sending a message and some of the recipients fail to receive it, the application can retrieve what recipients failed by using the getFaultyMembers() method. This way, an application will always know if a message was delivered successfully or not.
author
Filip Hanik
version
$Revision: 532400 $, $Date: 2007-04-25 18:16:37 +0200 (mer., 25 avr. 2007) $

Fields Summary
protected static final FaultyMember[]
EMPTY_LIST
Empty list to avoid reinstatiating lists
private ArrayList
faultyMembers
Constructors Summary
public ChannelException()
Constructor, creates a ChannelException

see
java.lang.Exception#Exception()

    
               
      
        super();
    
public ChannelException(String message)
Constructor, creates a ChannelException with an error message

see
java.lang.Exception#Exception(String)

        super(message);
    
public ChannelException(String message, Throwable cause)
Constructor, creates a ChannelException with an error message and a cause

param
message String
param
cause Throwable
see
java.lang.Exception#Exception(String,Throwable)

        super(message, cause);
    
public ChannelException(Throwable cause)
Constructor, creates a ChannelException with a cause

param
cause Throwable
see
java.lang.Exception#Exception(Throwable)

        super(cause);
    
Methods Summary
public booleanaddFaultyMember(Member mbr, java.lang.Exception x)
Adds a faulty member, and the reason the member failed.

param
mbr Member
param
x Exception

        return addFaultyMember(new FaultyMember(mbr,x));
    
public intaddFaultyMember(org.apache.catalina.tribes.ChannelException$FaultyMember[] mbrs)
Adds a list of faulty members

param
mbrs FaultyMember[]

        int result = 0;
        for (int i=0; mbrs!=null && i<mbrs.length; i++ ) {
            if ( addFaultyMember(mbrs[i]) ) result++;
        }
        return result;
    
public booleanaddFaultyMember(org.apache.catalina.tribes.ChannelException$FaultyMember mbr)
Adds a faulty member

param
mbr FaultyMember

        if ( this.faultyMembers==null ) this.faultyMembers = new ArrayList();
        if ( !faultyMembers.contains(mbr) ) return faultyMembers.add(mbr);
        else return false;
    
public org.apache.catalina.tribes.ChannelException$FaultyMember[]getFaultyMembers()
Returns an array of members that failed and the reason they failed.

return
FaultyMember[]

        if ( this.faultyMembers==null ) return EMPTY_LIST;
        return (FaultyMember[])faultyMembers.toArray(new FaultyMember[faultyMembers.size()]);
    
public java.lang.StringgetMessage()
Returns the message for this exception

return
String
see
java.lang.Exception#getMessage()

        StringBuffer buf = new StringBuffer(super.getMessage());
        if (faultyMembers==null || faultyMembers.size() == 0 ) {
            buf.append("; No faulty members identified.");
        } else {
            buf.append("; Faulty members:");
            for ( int i=0; i<faultyMembers.size(); i++ ) {
                FaultyMember mbr = (FaultyMember)faultyMembers.get(i);
                buf.append(mbr.getMember().getName());
                buf.append("; ");
            }
        }
        return buf.toString();