FileDocCategorySizeDatePackage
PooledParallelSender.javaAPI DocApache Tomcat 6.0.143012Fri Jul 20 04:20:34 BST 2007org.apache.catalina.tribes.transport.nio

PooledParallelSender

public class PooledParallelSender extends org.apache.catalina.tribes.transport.PooledSender implements org.apache.catalina.tribes.transport.MultiPointSender

Title:

Description:

Company:

author
not attributable
version
1.0

Fields Summary
protected boolean
connected
Constructors Summary
public PooledParallelSender()

      
        super();
    
Methods Summary
public synchronized voidconnect()

        this.connected = true;
        super.connect();
    
public synchronized voiddisconnect()

        this.connected = false;
        super.disconnect();
    
public org.apache.catalina.tribes.transport.DataSendergetNewDataSender()

        try {
            ParallelNioSender sender = new ParallelNioSender();
            sender.transferProperties(this,sender);
            return sender;
        } catch ( IOException x ) {
            throw new RuntimeException("Unable to open NIO selector.",x);
        }
    
public voidsendMessage(org.apache.catalina.tribes.Member[] destination, org.apache.catalina.tribes.ChannelMessage message)

        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 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();
            } finally {
                if (!connected) disconnect();
                returnSender(sender);
            }
        }