public class SessionExpiryTransition extends MockTransition {
private final AtomicBoolean _done = new AtomicBoolean();
@Override
public void doTransition(Message message, NotificationContext context) {
MockParticipantManager manager = (MockParticipantManager) context.getManager();
String instance = message.getTgtName();
String partition = message.getPartitionName();
if (instance.equals("localhost_12918") && partition.equals("TestDB0_1") // TestDB0_1 is SLAVE
// on localhost_12918
&& _done.getAndSet(true) == false) {
try {
ZkTestHelper.expireSession(manager.getZkClient());
} catch (Exception e) {
LOG.error("Exception expire zk-session", e);
}
}
}