Java源码示例:org.apache.catalina.tribes.ChannelException

示例1
@Override
public void broadcast(ChannelMessage message) throws ChannelException {
    if (impl==null || (impl.startLevel & Channel.MBR_TX_SEQ)!=Channel.MBR_TX_SEQ )
        throw new ChannelException("Multicast send is not started or enabled.");
    
    byte[] data = XByteBuffer.createDataPackage((ChannelData)message);
    if (data.length>McastServiceImpl.MAX_PACKET_SIZE) {
        throw new ChannelException("Packet length["+data.length+"] exceeds max packet size of "+McastServiceImpl.MAX_PACKET_SIZE+" bytes.");
    }
    DatagramPacket packet = new DatagramPacket(data,0,data.length);
    try {
        impl.send(false, packet);
    } catch (Exception x) {
        throw new ChannelException(x);
    }
}
 
示例2
@Test
public void testOptionConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    assertTrue(error);
}
 
示例3
@Override
public void messageReceived(ChannelMessage msg) {
    if ( Arrays.contains(msg.getMessage().getBytesDirect(),0,COORD_ALIVE,0,COORD_ALIVE.length) ) {
        //ignore message, its an alive message
        fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MSG_ARRIVE,this,"Alive Message"));

    } else if ( Arrays.contains(msg.getMessage().getBytesDirect(),0,COORD_HEADER,0,COORD_HEADER.length) ) {
        try {
            CoordinationMessage cmsg = new CoordinationMessage(msg.getMessage());
            Member[] cmbr = cmsg.getMembers();
            fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MSG_ARRIVE,this,"Coord Msg Arrived("+Arrays.toNameString(cmbr)+")"));
            processCoordMessage(cmsg, msg.getAddress());
        }catch ( ChannelException x ) {
            log.error("Error processing coordination message. Could be fatal.",x);
        }
    } else {
        super.messageReceived(msg);
    }
}
 
示例4
public V put(K key, V value, boolean notify) {
    MapEntry<K,V> entry = new MapEntry<>(key, value);
    entry.setBackup(false);
    entry.setProxy(false);
    entry.setCopy(false);
    entry.setPrimary(channel.getLocalMember(false));

    V old = null;

    //make sure that any old values get removed
    if ( containsKey(key) ) old = remove(key);
    try {
        if ( notify ) {
            Member[] backup = publishEntryInfo(key, value);
            entry.setBackupNodes(backup);
        }
    } catch (ChannelException x) {
        log.error(sm.getString("abstractReplicatedMap.unable.put"), x);
    }
    innerMap.put(key,entry);
    return old;
}
 
示例5
@Override
public void broadcast(ChannelMessage message) throws ChannelException {
    if (impl==null || (impl.startLevel & Channel.MBR_TX_SEQ)!=Channel.MBR_TX_SEQ )
        throw new ChannelException("Multicast send is not started or enabled.");
    
    byte[] data = XByteBuffer.createDataPackage((ChannelData)message);
    if (data.length>McastServiceImpl.MAX_PACKET_SIZE) {
        throw new ChannelException("Packet length["+data.length+"] exceeds max packet size of "+McastServiceImpl.MAX_PACKET_SIZE+" bytes.");
    }
    DatagramPacket packet = new DatagramPacket(data,0,data.length);
    try {
        impl.send(false, packet);
    } catch (Exception x) {
        throw new ChannelException(x);
    }
}
 
示例6
@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();
        }
    }
}
 
示例7
@Test
public void testTcpMcastFail() throws Exception {
    System.out.println("testTcpMcastFail()");
    clear();
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
    //Thread.sleep(1000);
    assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
    channel2.stop(Channel.MBR_TX_SEQ);
    ByteMessage msg = new ByteMessage(new byte[1024]);
    try {
        Thread.sleep(5000);
        assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
        channel1.send(channel1.getMembers(), msg, 0);
    } catch ( ChannelException x ) {
        fail("Message send should have succeeded.");
    }
    channel1.stop(Channel.DEFAULT);
    channel2.stop(Channel.DEFAULT);
}
 
示例8
@Test
public void testOptionConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    assertTrue(error);
}
 
示例9
@Override
public void memberDisappeared(Member member) {
    try {
        
        membership.removeMember((MemberImpl)member);
        super.memberDisappeared(member);
        try {
            fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MBR_DEL,this,"Member remove("+member.getName()+")"));
            if ( started && (isCoordinator() || isHighest()) ) 
                startElection(true); //to do, if a member disappears, only the coordinator can start
        }catch ( ChannelException x ) {
            log.error("Unable to start election when member was removed.",x);
        }
    }finally {
    }
}
 
示例10
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    if ( access.addAndGet(1) == 1 ) txStart = System.currentTimeMillis();
    long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
    try {
        super.sendMessage(destination, msg, payload);
    }catch ( ChannelException x ) {
        msgTxErr.addAndGet(1);
        if ( access.get() == 1 ) access.addAndGet(-1);
        throw x;
    }
    mbTx += (bytes*destination.length)/(1024d*1024d);
    mbAppTx += bytes/(1024d*1024d);
    if ( access.addAndGet(-1) == 0 ) {
        long stop = System.currentTimeMillis();
        timeTx += (stop - txStart) / 1000d;
        if ((msgTxCnt.get() / (double) interval) >= lastCnt) {
            lastCnt++;
            report(timeTx);
        }
    }
    msgTxCnt.addAndGet(1);
}
 
示例11
protected void sendElectionMsgToNextInline(MemberImpl local, CoordinationMessage msg) throws ChannelException { 
    int next = Arrays.nextIndex(local,msg.getMembers());
    int current = next;
    msg.leader = msg.getMembers()[0];
    boolean sent =  false;
    while ( !sent && current >= 0 ) {
        try {
            sendElectionMsg(local, msg.getMembers()[current], msg);
            sent = true;
        }catch ( ChannelException x  ) {
            log.warn("Unable to send election message to:"+msg.getMembers()[current]);
            current = Arrays.nextIndex(msg.getMembers()[current],msg.getMembers());
            if ( current == next ) throw x;
        }
    }
}
 
示例12
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload)
        throws ChannelException {
    try {
        byte[] data = msg.getMessage().getBytes();

        // See #encrypt(byte[]) for an explanation of the return value
        byte[][] bytes = encryptionManager.encrypt(data);

        XByteBuffer xbb = msg.getMessage();

        // Completely replace the message
        xbb.clear();
        xbb.append(bytes[0], 0, bytes[0].length);
        xbb.append(bytes[1], 0, bytes[1].length);

        super.sendMessage(destination, msg, payload);

    } catch (GeneralSecurityException gse) {
        log.error(sm.getString("encryptInterceptor.encrypt.failed"));
        throw new ChannelException(gse);
    }
}
 
示例13
@Test
public void testTcpSendFailureMemberDrop() throws Exception {
    System.out.println("testTcpSendFailureMemberDrop()");
    clear();
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
    //Thread.sleep(1000);
    assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
    channel2.stop(Channel.SND_RX_SEQ);
    ByteMessage msg = new ByteMessage(new byte[1024]);
    try {
        channel1.send(channel1.getMembers(), msg, 0);
        fail("Message send should have failed.");
    } catch ( ChannelException x ) {
        // Ignore
    }
    assertEquals("Expecting member count to not be equal",mbrlist1.members.size()+1,mbrlist2.members.size());
    channel1.stop(Channel.DEFAULT);
    channel2.stop(Channel.DEFAULT);
}
 
示例14
protected void handleViewConf(CoordinationMessage msg, Membership merged) throws ChannelException {
    if ( viewId != null && msg.getId().equals(viewId) ) return;//we already have this view
    view = new Membership(getLocalMember(false),AbsoluteOrder.comp,true);
    Arrays.fill(view,msg.getMembers());
    viewId = msg.getId();

    if ( viewId.equals(suggestedviewId) ) {
        suggestedView = null;
        suggestedviewId = null;
    }

    if (suggestedView != null && AbsoluteOrder.comp.compare(suggestedView.getMembers()[0],merged.getMembers()[0])<0 ) {
        suggestedView = null;
        suggestedviewId = null;
    }

    fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_CONF_RX,this,"Accepted View"));

    if ( suggestedviewId == null && hasHigherPriority(merged.getMembers(),membership.getMembers()) ) {
        startElection(false);
    }
}
 
示例15
@Override
public void stop(int svc) throws ChannelException {
    try {
        halt();
        synchronized (electionMutex) {
            if (!started)return;
            started = false;
            fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_STOP, this, "Before stop"));
            super.stop(startsvc);
            this.view = null;
            this.viewId = null;
            this.suggestedView = null;
            this.suggestedviewId = null;
            this.membership.reset();
            fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_STOP, this, "After stop"));
        }
    }finally {
        release();
    }
}
 
示例16
@Override
public void messageReceived(ChannelMessage msg) {
    if ( Arrays.contains(msg.getMessage().getBytesDirect(),0,COORD_ALIVE,0,COORD_ALIVE.length) ) {
        //ignore message, its an alive message
        fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MSG_ARRIVE,this,"Alive Message"));

    } else if ( Arrays.contains(msg.getMessage().getBytesDirect(),0,COORD_HEADER,0,COORD_HEADER.length) ) {
        try {
            CoordinationMessage cmsg = new CoordinationMessage(msg.getMessage());
            Member[] cmbr = cmsg.getMembers();
            fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MSG_ARRIVE,this,"Coord Msg Arrived("+Arrays.toNameString(cmbr)+")"));
            processCoordMessage(cmsg);
        }catch ( ChannelException x ) {
            log.error(sm.getString("nonBlockingCoordinator.processCoordinationMessage.failed"),x);
        }
    } else {
        super.messageReceived(msg);
    }
}
 
示例17
protected void handleMyToken(MemberImpl local, CoordinationMessage msg, Member sender,Membership merged) throws ChannelException {
    if ( local.equals(msg.getLeader()) ) {
        //no leadership change
        if ( Arrays.sameMembers(msg.getMembers(),merged.getMembers()) ) {
            msg.type = COORD_CONF;
            super.sendMessage(Arrays.remove(msg.getMembers(),local),createData(msg,local),null);
            handleViewConf(msg,local,merged);
        } else {
            //membership change
            suggestedView = new Membership(local,AbsoluteOrder.comp,true);
            suggestedviewId = msg.getId();
            Arrays.fill(suggestedView,merged.getMembers());
            msg.view = merged.getMembers();
            sendElectionMsgToNextInline(local,msg);
        }
    } else {
        //leadership change
        suggestedView = null;
        suggestedviewId = null;
        msg.view = merged.getMembers();
        sendElectionMsgToNextInline(local,msg);
    }
}
 
示例18
@Override
public synchronized void start(int svc) throws ChannelException {
    super.start(svc);
    running = true;
    if ( thread == null && useThread) {
        thread = new PingThread();
        thread.setDaemon(true);
        thread.setName("TcpPingInterceptor.PingThread-"+cnt.addAndGet(1));
        thread.start();
    }
    
    //acquire the interceptors to invoke on send ping events
    ChannelInterceptor next = getNext();
    while ( next != null ) {
        if ( next instanceof TcpFailureDetector ) 
            failureDetector = new WeakReference<TcpFailureDetector>((TcpFailureDetector)next);
        if ( next instanceof StaticMembershipInterceptor ) 
            staticMembers = new WeakReference<StaticMembershipInterceptor>((StaticMembershipInterceptor)next);
        next = next.getNext();
    }
    
}
 
示例19
@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);
    }
}
 
示例20
@Test
public void testOptionConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    Assert.assertTrue(error);
}
 
示例21
@Test
public void testOptionNoConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(64);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(256);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    Assert.assertFalse(error);
}
 
示例22
@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    if ( access.addAndGet(1) == 1 ) txStart = System.currentTimeMillis();
    long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
    try {
        super.sendMessage(destination, msg, payload);
    }catch ( ChannelException x ) {
        msgTxErr.addAndGet(1);
        if ( access.get() == 1 ) access.addAndGet(-1);
        throw x;
    } 
    mbTx += (bytes*destination.length)/(1024d*1024d);
    mbAppTx += bytes/(1024d*1024d);
    if ( access.addAndGet(-1) == 0 ) {
        long stop = System.currentTimeMillis();
        timeTx += (stop - txStart) / 1000d;
        if ((msgTxCnt.get() / interval) >= lastCnt) {
            lastCnt++;
            report(timeTx);
        }
    }
    msgTxCnt.addAndGet(1);
}
 
示例23
@Test
public void testTcpSendFailureMemberDrop() throws Exception {
    System.out.println("testTcpSendFailureMemberDrop()");
    clear();
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
    //Thread.sleep(1000);
    Assert.assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
    channel2.stop(Channel.SND_RX_SEQ);
    ByteMessage msg = new ByteMessage(new byte[1024]);
    try {
        channel1.send(channel1.getMembers(), msg, 0);
        Assert.fail("Message send should have failed.");
    } catch ( ChannelException x ) {
        // Ignore
    }
    Assert.assertEquals("Expecting member count to not be equal",mbrlist1.members.size()+1,mbrlist2.members.size());
    channel1.stop(Channel.DEFAULT);
    channel2.stop(Channel.DEFAULT);
}
 
示例24
@Override
public void messageReceived(ChannelMessage msg) {
    if ( Arrays.contains(msg.getMessage().getBytesDirect(),0,COORD_ALIVE,0,COORD_ALIVE.length) ) {
        //ignore message, its an alive message
        fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MSG_ARRIVE,this,"Alive Message"));

    } else if ( Arrays.contains(msg.getMessage().getBytesDirect(),0,COORD_HEADER,0,COORD_HEADER.length) ) {
        try {
            CoordinationMessage cmsg = new CoordinationMessage(msg.getMessage());
            Member[] cmbr = cmsg.getMembers();
            fireInterceptorEvent(new CoordinationEvent(CoordinationEvent.EVT_MSG_ARRIVE,this,"Coord Msg Arrived("+Arrays.toNameString(cmbr)+")"));
            processCoordMessage(cmsg, msg.getAddress());
        }catch ( ChannelException x ) {
            log.error("Error processing coordination message. Could be fatal.",x);
        }
    } else {
        super.messageReceived(msg);
    }
}
 
示例25
public void mapMemberAdded(Member member) {
    if ( member.equals(getChannel().getLocalMember(false)) ) return;
    boolean memberAdded = false;
    //select a backup node if we don't have one
    Member mapMember = getChannel().getMember(member);
    if (mapMember == null) {
        log.warn(sm.getString("abstractReplicatedMap.mapMemberAdded.nullMember", member));
        return;
    }
    synchronized (mapMembers) {
        if (!mapMembers.containsKey(mapMember) ) {
            if (log.isInfoEnabled())
                log.info(sm.getString("abstractReplicatedMap.mapMemberAdded.added", mapMember));
            mapMembers.put(mapMember, Long.valueOf(System.currentTimeMillis()));
            memberAdded = true;
        }
    }
    if ( memberAdded ) {
        synchronized (stateMutex) {
            for (Entry<K, MapEntry<K, V>> e : innerMap.entrySet()) {
                MapEntry<K,V> entry = innerMap.get(e.getKey());
                if ( entry == null ) continue;
                if (entry.isPrimary() && (entry.getBackupNodes() == null || entry.getBackupNodes().length == 0)) {
                    try {
                        Member[] backup = publishEntryInfo(entry.getKey(), entry.getValue());
                        entry.setBackupNodes(backup);
                        entry.setPrimary(channel.getLocalMember(false));
                    } catch (ChannelException x) {
                        log.error(sm.getString("abstractReplicatedMap.unableSelect.backup"), x);
                    } //catch
                } //end if
            } //while
        } //synchronized
    }//end if
}
 
示例26
/**
 * Send a message and wait for the response.
 * @param destination Member[] - the destination for the message, and the members you request a reply from
 * @param message Serializable - the message you are sending out
 * @param rpcOptions int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
 * @param channelOptions channel sender options
 * @param timeout long - timeout in milliseconds, if no reply is received within this time null is returned
 * @return Response[] - an array of response objects.
 * @throws ChannelException
 */
public Response[] send(Member[] destination, 
                       Serializable message,
                       int rpcOptions, 
                       int channelOptions,
                       long timeout) throws ChannelException {
    
    if ( destination==null || destination.length == 0 ) return new Response[0];
    
    //avoid dead lock
    int sendOptions =
        channelOptions & ~Channel.SEND_OPTIONS_SYNCHRONIZED_ACK;
    
    RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
    RpcCollector collector = new RpcCollector(key,rpcOptions,destination.length);
    try {
        synchronized (collector) {
            if ( rpcOptions != NO_REPLY ) responseMap.put(key, collector);
            RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
            channel.send(destination, rmsg, sendOptions);
            if ( rpcOptions != NO_REPLY ) collector.wait(timeout);
        }
    } catch ( InterruptedException ix ) {
        Thread.currentThread().interrupt();
    }finally {
        responseMap.remove(key);
    }
    return collector.getResponses();
}
 
示例27
public void frag(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
    int size = msg.getMessage().getLength();

    int count = ((size / maxSize )+(size%maxSize==0?0:1));
    ChannelMessage[] messages = new ChannelMessage[count];
    int remaining = size;
    for ( int i=0; i<count; i++ ) {
        ChannelMessage tmp = (ChannelMessage)msg.clone();
        int offset = (i*maxSize);
        int length = Math.min(remaining,maxSize);
        tmp.getMessage().clear();
        tmp.getMessage().append(msg.getMessage().getBytesDirect(),offset,length);
        //add the msg nr
        //tmp.getMessage().append(XByteBuffer.toBytes(i),0,4);
        tmp.getMessage().append(i);
        //add the total nr of messages
        //tmp.getMessage().append(XByteBuffer.toBytes(count),0,4);
        tmp.getMessage().append(count);
        //add true as the frag flag
        //byte[] flag = XByteBuffer.toBytes(true);
        //tmp.getMessage().append(flag,0,flag.length);
        tmp.getMessage().append(true);
        messages[i] = tmp;
        remaining -= length;
        
    }
    for ( int i=0; i<messages.length; i++ ) {
        super.sendMessage(destination,messages[i],payload);
    }
}
 
示例28
/**
 * Shuts down the channel. This can be called multiple times for individual services to shutdown
 * The svc parameter can be the logical or value of any constants
 * @param svc int value of <BR>
 * DEFAULT - will shutdown all services <BR>
 * MBR_RX_SEQ - starts the membership receiver <BR>
 * MBR_TX_SEQ - starts the membership broadcaster <BR>
 * SND_TX_SEQ - starts the replication transmitter<BR>
 * SND_RX_SEQ - starts the replication receiver<BR>
 * @throws ChannelException if a startup error occurs or the service is already started.
 */
protected synchronized void internalStop(int svc) throws ChannelException {
    try {
        //make sure we don't pass down any flags that are unrelated to the bottom layer
        svc = svc & Channel.DEFAULT;

        if (startLevel == 0) return; //we have already stopped up all components
        if (svc == 0 ) return;//nothing to stop

        boolean valid = false;
        if ( Channel.SND_RX_SEQ==(svc & Channel.SND_RX_SEQ) ) {
            clusterReceiver.stop();
            clusterReceiver.setMessageListener(null);
            valid = true;
        }
        if ( Channel.SND_TX_SEQ==(svc & Channel.SND_TX_SEQ) ) {
            clusterSender.stop();
            valid = true;
        }

        if ( Channel.MBR_RX_SEQ==(svc & Channel.MBR_RX_SEQ) ) {
            membershipService.stop(MembershipService.MBR_RX);
            membershipService.setMembershipListener(null);
            valid = true;

        }
        if ( Channel.MBR_TX_SEQ==(svc & Channel.MBR_TX_SEQ) ) {
            valid = true;
            membershipService.stop(MembershipService.MBR_TX);
        }
        if ( !valid) {
            throw new IllegalArgumentException(sm.getString("channelCoordinator.invalid.startLevel"));
        }

        startLevel = (startLevel & (~svc));
        setChannel(null);
    } catch (Exception x) {
        throw new ChannelException(x);
    }
}
 
示例29
protected void sendShutdown(Member[] members) {
    try {
        sendMemberMessage(members, MEMBER_STOP);
    } catch (ChannelException cx) {
        log.warn("Shutdown notification failed.",cx);
    }
}
 
示例30
@Override
public void start(int svc) throws ChannelException {
    //start the thread
    if (!run ) {
        synchronized (this) {
            if ( !run && ((svc & Channel.SND_TX_SEQ)==Channel.SND_TX_SEQ) ) {//only start with the sender
                startQueue();
            }//end if
        }//sync
    }//end if
    super.start(svc);
}