com.sap.cloud.mt.subscription.AbstractSubscriber Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multi-tenant-subscription Show documentation
Show all versions of multi-tenant-subscription Show documentation
Spring Boot Enablement Parent
/******************************************************************************
* © 2020 SAP SE or an SAP affiliate company. All rights reserved. *
******************************************************************************/
package com.sap.cloud.mt.subscription;
public abstract class AbstractSubscriber implements Subscriber {
protected static final int MINIMUM_TIME = 1000;
protected void waitSomeTime(long startTime) {
long endTime = System.nanoTime();
long passedTimeMillis = (endTime - startTime) * 1000000;
if (passedTimeMillis < MINIMUM_TIME) {
try {
//Un-subscribe and subscribe can be too fast.
//Then the callback of this task can overtake the "accepted" response of the called unsubscribe endpoint.
//The saas registry doesn't allow this. The status remains on processing in the cockpit.
Thread.sleep(MINIMUM_TIME - passedTimeMillis);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy