Example usage for org.apache.commons.collections MapUtils getLongValue

List of usage examples for org.apache.commons.collections MapUtils getLongValue

Introduction

In this page you can find the example usage for org.apache.commons.collections MapUtils getLongValue.

Prototype

public static long getLongValue(final Map map, final Object key, long defaultValue) 

Source Link

Document

Gets a long from a Map in a null-safe manner, using the default value if the the conversion fails.

Usage

From source file:net.me2day.async.processor.sample.DummyDistributableEventProcessor.java

@Override
public void initializeCompleted(Scope scope, Map<String, Object> configurationMap) {
    if (!ticket.equals(scope.getTarget())) {
        return;/*  w  w  w. j  ava 2 s.c  o  m*/
    }

    int percentage = MapUtils.getIntValue(configurationMap, "failPercentage", 10);
    if (percentage > 100) {
        percentage = 100;
    }
    configurationMap.put("failPercentage", percentage);

    long time = MapUtils.getLongValue(configurationMap, "sleepTime", 100);
    configurationMap.put("sleepTime", time);

    failPercentage = percentage;
    sleepTime = time;
}