Java Code Examples for org.apache.catalina.tribes.ChannelException#addFaultyMember()

The following examples show how to use org.apache.catalina.tribes.ChannelException#addFaultyMember() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PooledParallelSender.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void sendMessage(Member[] destination, ChannelMessage message) throws ChannelException {
    if (!isConnected()) {
        throw new ChannelException(sm.getString("pooledParallelSender.sender.disconnected"));
    }
    ParallelNioSender sender = (ParallelNioSender)getSender();
    if (sender == null) {
        ChannelException cx = new ChannelException(sm.getString(
                "pooledParallelSender.unable.retrieveSender.timeout",
                Long.toString(getMaxWait())));
        for (int i = 0; i < destination.length; i++)
            cx.addFaultyMember(destination[i], new NullPointerException(sm.getString("pooledParallelSender.unable.retrieveSender")));
        throw cx;
    } else {
        try {
            if (!sender.isConnected()) sender.connect();
            sender.sendMessage(destination, message);
            sender.keepalive();
        } catch (ChannelException x) {
            sender.disconnect();
            throw x;
        } finally {
            returnSender(sender);
        }
    }
}
 
Example 2
Source File: PooledParallelSender.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void sendMessage(Member[] destination, ChannelMessage message) throws ChannelException {
    if ( !connected ) throw new ChannelException("Sender not connected.");
    ParallelNioSender sender = (ParallelNioSender)getSender();
    if (sender == null) {
        ChannelException cx = new ChannelException("Unable to retrieve a data sender, time out("+getMaxWait()+" ms) error.");
        for (int i = 0; i < destination.length; i++) cx.addFaultyMember(destination[i], new NullPointerException("Unable to retrieve a sender from the sender pool"));
        throw cx;
    } else {
        try {
            sender.sendMessage(destination, message);
            sender.keepalive();
        } catch (ChannelException x) {
            sender.disconnect();
            throw x;
        } finally {
            returnSender(sender);
            if (!connected) disconnect();
        }
    }
}
 
Example 3
Source File: PooledParallelSender.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void sendMessage(Member[] destination, ChannelMessage message) throws ChannelException {
    if ( !connected ) throw new ChannelException("Sender not connected.");
    ParallelNioSender sender = (ParallelNioSender)getSender();
    if (sender == null) {
        ChannelException cx = new ChannelException("Unable to retrieve a data sender, time out("+getMaxWait()+" ms) error.");
        for (int i = 0; i < destination.length; i++) cx.addFaultyMember(destination[i], new NullPointerException("Unable to retrieve a sender from the sender pool"));
        throw cx;
    } else {
        try {
            sender.sendMessage(destination, message);
            sender.keepalive();
        } catch (ChannelException x) {
            sender.disconnect();
            throw x;
        } finally {
            returnSender(sender);
            if (!connected) disconnect();
        }
    }
}
 
Example 4
Source File: OrderInterceptor.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    if ( !okToProcess(msg.getOptions()) ) {
        super.sendMessage(destination, msg, payload);
        return;
    }
    ChannelException cx = null;
    for (int i=0; i<destination.length; i++ ) {
        try {
            int nr = 0;
            outLock.writeLock().lock();
            try {
                nr = incCounter(destination[i]);
            } finally {
                outLock.writeLock().unlock();
            }
            //reduce byte copy
            msg.getMessage().append(nr);
            try {
                getNext().sendMessage(new Member[] {destination[i]}, msg, payload);
            } finally {
                msg.getMessage().trim(4);
            }
        }catch ( ChannelException x ) {
            if ( cx == null ) cx = x;
            cx.addFaultyMember(x.getFaultyMembers());
        }
    }//for
    if ( cx != null ) throw cx;
}
 
Example 5
Source File: OrderInterceptor.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    if ( !okToProcess(msg.getOptions()) ) {
        super.sendMessage(destination, msg, payload);
        return;
    }
    ChannelException cx = null;
    for (int i=0; i<destination.length; i++ ) {
        try {
            int nr = 0;
            try {
                outLock.writeLock().lock();
                nr = incCounter(destination[i]);
            } finally {
                outLock.writeLock().unlock();
            }
            //reduce byte copy
            msg.getMessage().append(nr);
            try {
                getNext().sendMessage(new Member[] {destination[i]}, msg, payload);
            } finally {
                msg.getMessage().trim(4);
            }
        }catch ( ChannelException x ) {
            if ( cx == null ) cx = x;
            cx.addFaultyMember(x.getFaultyMembers());
        }
    }//for
    if ( cx != null ) throw cx;
}
 
Example 6
Source File: OrderInterceptor.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    if ( !okToProcess(msg.getOptions()) ) {
        super.sendMessage(destination, msg, payload);
        return;
    }
    ChannelException cx = null;
    for (int i=0; i<destination.length; i++ ) {
        try {
            int nr = 0;
            try {
                outLock.writeLock().lock();
                nr = incCounter(destination[i]);
            } finally {
                outLock.writeLock().unlock();
            }
            //reduce byte copy
            msg.getMessage().append(nr);
            try {
                getNext().sendMessage(new Member[] {destination[i]}, msg, payload);
            } finally {
                msg.getMessage().trim(4);
            }
        }catch ( ChannelException x ) {
            if ( cx == null ) cx = x;
            cx.addFaultyMember(x.getFaultyMembers());
        }
    }//for
    if ( cx != null ) throw cx;
}