(Probably) Fix bug where unclosed WatchServices cause inotify limit to fill upp. Also cache the values for a minor speedup.
This commit is contained in:
parent
b3e117277e
commit
0c2e624f10
@ -3,6 +3,7 @@ package com.massivecraft.massivecore.store;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.FileSystems;
|
import java.nio.file.FileSystems;
|
||||||
|
import java.nio.file.WatchService;
|
||||||
import java.util.AbstractMap.SimpleEntry;
|
import java.util.AbstractMap.SimpleEntry;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -218,12 +219,15 @@ public class DriverFlatfile extends DriverAbstract
|
|||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private boolean supportsPusher = this.supportsPusherCalc();
|
||||||
public boolean supportsPusher()
|
private boolean supportsPusherCalc()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return ! ( FileSystems.getDefault().newWatchService().getClass().getName().equals("sun.nio.fs.PollingWatchService"));
|
WatchService watchService = FileSystems.getDefault().newWatchService();
|
||||||
|
boolean ret = ! watchService.getClass().getName().equals("sun.nio.fs.PollingWatchService");
|
||||||
|
watchService.close();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
@ -231,6 +235,12 @@ public class DriverFlatfile extends DriverAbstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsPusher()
|
||||||
|
{
|
||||||
|
return this.supportsPusher;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PusherColl getPusher(Coll<?> coll)
|
public PusherColl getPusher(Coll<?> coll)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user