Search in sources :

Example 1 with Configuration

use of org.dcache.srm.util.Configuration in project dcache by dCache.

the class QOSPluginFactory method createInstance.

public static QOSPlugin createInstance(SRM srm) {
    Configuration configuration = srm.getConfiguration();
    QOSPlugin qosPlugin = null;
    String qosPluginClass = configuration.getQosPluginClass();
    if (qosPluginClass != null) {
        try {
            Class<? extends QOSPlugin> pluginClass = Thread.currentThread().getContextClassLoader().loadClass(qosPluginClass).asSubclass(QOSPlugin.class);
            qosPlugin = pluginClass.newInstance();
            qosPlugin.setSrm(srm);
            LOGGER.debug("Created new qos plugin of type {}", qosPluginClass);
        } catch (Exception e) {
            LOGGER.error("Could not create class " + qosPluginClass, e);
        }
    }
    return qosPlugin;
}
Also used : Configuration(org.dcache.srm.util.Configuration)

Example 2 with Configuration

use of org.dcache.srm.util.Configuration in project dcache by dCache.

the class FileRequest method reassessLifetime.

protected void reassessLifetime(long fileSize) {
    long currentLifetime = getLifetime();
    Configuration config = SRM.getSRM().getConfiguration();
    long newLifetime = Lifetimes.calculateRequestLifetimeWithWorkaround(currentLifetime, fileSize, config.getMaximumClientAssumedBandwidth(), config.getGetLifetime());
    try {
        if (newLifetime > currentLifetime) {
            extendLifetime(newLifetime);
        }
    } catch (SRMException e) {
        LOGGER.debug("Unable to adjust lifetime: {}", e.getMessage());
    }
}
Also used : SRMException(org.dcache.srm.SRMException) Configuration(org.dcache.srm.util.Configuration)

Aggregations

Configuration (org.dcache.srm.util.Configuration)2 SRMException (org.dcache.srm.SRMException)1