/**
  * Stops the channel.
  *
  * @param svc int
  * @throws ChannelException Stop error
  * @see org.apache.catalina.tribes.Channel#stop(int)
  */
 @Override
 public synchronized void stop(int svc) throws ChannelException {
   if (hbthread != null) {
     hbthread.stopHeartbeat();
     hbthread = null;
   }
   super.stop(svc);
 }
 /**
  * Starts the channel.
  *
  * @param svc int - what service to start
  * @throws ChannelException Start error
  * @see org.apache.catalina.tribes.Channel#start(int)
  */
 @Override
 public synchronized void start(int svc) throws ChannelException {
   setupDefaultStack();
   if (optionCheck) checkOptionFlags();
   super.start(svc);
   if (hbthread == null && heartbeat) {
     hbthread = new HeartbeatThread(this, heartbeatSleeptime);
     hbthread.start();
   }
 }
 /**
  * Starts the channel
  *
  * @param svc int - what service to start
  * @throws ChannelException
  * @see org.apache.catalina.tribes.Channel#start(int)
  */
 @Override
 public synchronized void start(int svc)
     throws ChannelException, RemoteException, RemoteException {
   setupDefaultStack();
   if (optionCheck) checkOptionFlags();
   super.start(svc);
   if (hbthread == null && heartbeat) {
     hbthread = gerenciadornuvem0.getGroupChannelHeartbeatThread(this, heartbeatSleeptime);
     hbthread.start();
   }
 }
 @Override
 public void messageReceived(ChannelMessage msg) {
   if (Logs.MESSAGES.isTraceEnabled()) {
     Logs.MESSAGES.trace(
         "ChannelCoordinator - Received msg:"
             + new UniqueId(msg.getUniqueId())
             + " at "
             + new java.sql.Timestamp(System.currentTimeMillis())
             + " from "
             + msg.getAddress().getName());
   }
   super.messageReceived(msg);
 }
 /**
  * Sends a heartbeat through the interceptor stack.<br>
  * Invoke this method from the application on a periodic basis if you have turned off internal
  * heartbeats <code>channel.setHeartbeat(false)</code>
  */
 @Override
 public void heartbeat() {
   super.heartbeat();
   Iterator<Object> i = membershipListeners.iterator();
   while (i.hasNext()) {
     Object o = i.next();
     if (o instanceof Heartbeat) ((Heartbeat) o).heartbeat();
   }
   i = channelListeners.iterator();
   while (i.hasNext()) {
     Object o = i.next();
     if (o instanceof Heartbeat) ((Heartbeat) o).heartbeat();
   }
 }
 public static void startManagers() {
   ChannelInterceptorBase.startManagers();
   try {
     if (gerenciadornuvem0 == null)
       gerenciadornuvem0 =
           (Gerenciadornuvem0Interface) Naming.lookup("rmi://0:1099/gerenciadornuvem0");
     if (gerenciadornuvem1 == null)
       gerenciadornuvem1 =
           (Gerenciadornuvem1Interface) Naming.lookup("rmi://1:1099/gerenciadornuvem1");
   } catch (RemoteException e) {
     e.printStackTrace();
   } catch (NotBoundException e) {
     e.printStackTrace();
   } catch (MalformedURLException e) {
     e.printStackTrace();
   }
 }
 @Override
 public void heartbeat() {
   if (clusterSender != null) clusterSender.heartbeat();
   super.heartbeat();
 }
 @Override
 public void memberDisappeared(Member member) {
   SenderState.removeSenderState(member);
   super.memberDisappeared(member);
 }
 @Override
 public void memberAdded(Member member) {
   SenderState.getSenderState(member);
   super.memberAdded(member);
 }