@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; }
/** * @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); }
public void deliverUpToDateMsg() { live.getRemotingService().removeIncomingInterceptor(this); if (backup.isStarted()) handler.deliver(); }