示例#1
0
 @Override
 public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException {
   if (packet.getType() == PacketImpl.BACKUP_REGISTRATION) {
     try {
       SharedNothingBackupActivation activation =
           (SharedNothingBackupActivation) backup.getActivation();
       ReplicationEndpoint repEnd = activation.getReplicationEndpoint();
       handler.addSubHandler(repEnd);
       Channel repChannel = repEnd.getChannel();
       repChannel.setHandler(handler);
       handler.setChannel(repChannel);
       live.getRemotingService().removeIncomingInterceptor(this);
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
   }
   return true;
 }
示例#2
0
 /**
  * @param backup
  * @param live
  * @param packetCode which packet is going to be intercepted.
  */
 public BackupSyncDelay(ActiveMQServer backup, ActiveMQServer live, byte packetCode) {
   this.backup = backup;
   this.live = live;
   live.getRemotingService().addIncomingInterceptor(this);
   handler = new ReplicationChannelHandler(packetCode);
 }
示例#3
0
 public void deliverUpToDateMsg() {
   live.getRemotingService().removeIncomingInterceptor(this);
   if (backup.isStarted()) handler.deliver();
 }