@Override public synchronized void handlePacket(Packet packet) { if (onHold != null && deliver) { deliver(); } if (typeToIntercept == PacketImpl.REPLICATION_START_FINISH_SYNC) { if (packet.getType() == PacketImpl.REPLICATION_START_FINISH_SYNC && mustHold) { ReplicationStartSyncMessage syncMsg = (ReplicationStartSyncMessage) packet; if (syncMsg.isSynchronizationFinished() && !deliver) { receivedUpToDate = true; assert onHold == null; onHold = packet; PacketImpl response = new ReplicationResponseMessage(); channel.send(response); return; } } } else if (typeToIntercept == packet.getType()) { channel.send(new ReplicationResponseMessage()); return; } handler.handlePacket(packet); }
@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; }