Merge pull request #113 from imont/harvest-timeout
Introduce harvesting timeout option
This commit is contained in:
commit
e099d4acbe
@ -232,6 +232,12 @@ public class StackProperties
|
|||||||
public static final String USE_DYNAMIC_HOST_HARVESTER
|
public static final String USE_DYNAMIC_HOST_HARVESTER
|
||||||
= "org.ice4j.ice.harvest.USE_DYNAMIC_HOST_HARVESTER";
|
= "org.ice4j.ice.harvest.USE_DYNAMIC_HOST_HARVESTER";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timeout, in seconds, of how long to wait for an individual harvest before timing out
|
||||||
|
*/
|
||||||
|
public static final String HARVESTING_TIMEOUT
|
||||||
|
= "org.ice4j.ice.harvest.HARVESTING_TIMEOUT";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the String value of the specified property (minus all
|
* Returns the String value of the specified property (minus all
|
||||||
* encompassing whitespaces)and null in case no property value was mapped
|
* encompassing whitespaces)and null in case no property value was mapped
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
|
|
||||||
|
import org.ice4j.*;
|
||||||
import org.ice4j.ice.*;
|
import org.ice4j.ice.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -197,7 +198,17 @@ public class CandidateHarvesterSet
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
future.get();
|
future.get(StackProperties.getInt(StackProperties.HARVESTING_TIMEOUT, 15), TimeUnit.SECONDS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (TimeoutException te)
|
||||||
|
{
|
||||||
|
CandidateHarvesterSetElement harvester = task.getKey().getHarvester();
|
||||||
|
if (harvester != null)
|
||||||
|
{
|
||||||
|
harvester.setEnabled(false);
|
||||||
|
}
|
||||||
|
logger.warning("timed out while harvesting from " + harvester);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (CancellationException ce)
|
catch (CancellationException ce)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user