Search in sources :

Example 26 with ChannelException

use of org.apache.catalina.tribes.ChannelException in project tomcat by apache.

the class GzipInterceptor method sendMessage.

@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    try {
        byte[] data = compress(msg.getMessage().getBytes());
        msg.getMessage().trim(msg.getMessage().getLength());
        msg.getMessage().append(data, 0, data.length);
        super.sendMessage(destination, msg, payload);
    } catch (IOException x) {
        log.error(sm.getString("gzipInterceptor.compress.failed"));
        throw new ChannelException(x);
    }
}
Also used : IOException(java.io.IOException) ChannelException(org.apache.catalina.tribes.ChannelException)

Example 27 with ChannelException

use of org.apache.catalina.tribes.ChannelException in project tomcat by apache.

the class McastService method broadcast.

@Override
public void broadcast(ChannelMessage message) throws ChannelException {
    if (impl == null || (impl.startLevel & Channel.MBR_TX_SEQ) != Channel.MBR_TX_SEQ)
        throw new ChannelException(sm.getString("mcastService.noStart"));
    byte[] data = XByteBuffer.createDataPackage((ChannelData) message);
    if (data.length > McastServiceImpl.MAX_PACKET_SIZE) {
        throw new ChannelException(sm.getString("mcastService.exceed.maxPacketSize", Integer.toString(data.length), Integer.toString(McastServiceImpl.MAX_PACKET_SIZE)));
    }
    DatagramPacket packet = new DatagramPacket(data, 0, data.length);
    try {
        impl.send(false, packet);
    } catch (Exception x) {
        throw new ChannelException(x);
    }
}
Also used : DatagramPacket(java.net.DatagramPacket) IOException(java.io.IOException) ChannelException(org.apache.catalina.tribes.ChannelException) ChannelException(org.apache.catalina.tribes.ChannelException)

Aggregations

ChannelException (org.apache.catalina.tribes.ChannelException)27 IOException (java.io.IOException)10 Member (org.apache.catalina.tribes.Member)8 UnknownHostException (java.net.UnknownHostException)4 UniqueId (org.apache.catalina.tribes.UniqueId)4 Test (org.junit.Test)4 ByteMessage (org.apache.catalina.tribes.ByteMessage)3 FaultyMember (org.apache.catalina.tribes.ChannelException.FaultyMember)3 ChannelInterceptor (org.apache.catalina.tribes.ChannelInterceptor)3 Serializable (java.io.Serializable)2 Response (org.apache.catalina.tribes.group.Response)2 ChannelData (org.apache.catalina.tribes.io.ChannelData)2 XByteBuffer (org.apache.catalina.tribes.io.XByteBuffer)2 DatagramPacket (java.net.DatagramPacket)1 SelectionKey (java.nio.channels.SelectionKey)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1