All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.broadleafcommerce.core.util.ThirdPartyInteractionLatencySimulationActivity Maven / Gradle / Ivy

There is a newer version: 3.1.15-GA
Show newest version
package org.broadleafcommerce.core.util;

import org.broadleafcommerce.core.workflow.BaseActivity;
import org.broadleafcommerce.core.workflow.ProcessContext;

/**
 * Simple workflow activity to simulate an amount of latency introduced by communicating
 * with a third party provider (e.g. credit card processing). Useful for load testing.
 *
 * @author Jeff Fischer
 */
public class ThirdPartyInteractionLatencySimulationActivity extends BaseActivity {

    private long waitTime = 1000L;

    @Override
    public ProcessContext execute(ProcessContext context) throws Exception {
        try {
            Thread.sleep(waitTime);
        } catch (Throwable e) {
            //do nothing
        }

        return context;
    }

    public long getWaitTime() {
        return waitTime;
    }

    public void setWaitTime(long waitTime) {
        this.waitTime = waitTime;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy