ChannelExceptionpublic 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. |
Fields Summary |
---|
protected static final FaultyMember[] | EMPTY_LISTEmpty list to avoid reinstatiating lists | private ArrayList | faultyMembers |
Constructors Summary |
---|
public ChannelException()Constructor, creates a ChannelException
super();
| public ChannelException(String message)Constructor, creates a ChannelException with an error message
super(message);
| public ChannelException(String message, Throwable cause)Constructor, creates a ChannelException with an error message and a cause
super(message, cause);
| public ChannelException(Throwable cause)Constructor, creates a ChannelException with a cause
super(cause);
|
Methods Summary |
---|
public boolean | addFaultyMember(Member mbr, java.lang.Exception x)Adds a faulty member, and the reason the member failed.
return addFaultyMember(new FaultyMember(mbr,x));
| public int | addFaultyMember(org.apache.catalina.tribes.ChannelException$FaultyMember[] mbrs)Adds a list of faulty members
int result = 0;
for (int i=0; mbrs!=null && i<mbrs.length; i++ ) {
if ( addFaultyMember(mbrs[i]) ) result++;
}
return result;
| public boolean | addFaultyMember(org.apache.catalina.tribes.ChannelException$FaultyMember mbr)Adds a faulty member
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.
if ( this.faultyMembers==null ) return EMPTY_LIST;
return (FaultyMember[])faultyMembers.toArray(new FaultyMember[faultyMembers.size()]);
| public java.lang.String | getMessage()Returns the message for this exception
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();
|
|