Java Code Examples for ucar.unidata.io.RandomAccessFile#setDebugLeaks()

The following examples show how to use ucar.unidata.io.RandomAccessFile#setDebugLeaks() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestGribIndexCreation.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@BeforeClass
static public void before() {
  GribIosp.debugIndexOnlyCount = 0;
  GribCollectionImmutable.countGC = 0;
  PartitionCollectionImmutable.countPC = 0;
  RandomAccessFile.enableDefaultGlobalFileCache();
  RandomAccessFile.setDebugLeaks(true);
  // Grib.setDebugFlags(new DebugFlagsImpl("Grib/indexOnly"));
  GribCdmIndex.setGribCollectionCache(new ucar.nc2.util.cache.FileCacheGuava("GribCollectionCacheGuava", 100));
  GribCdmIndex.gribCollectionCache.resetTracking();

  // make sure that the indexes are created with the data files
  DiskCache2 diskCache = GribIndexCache.getDiskCache2();
  diskCache.setNeverUseCache(true);
  diskCache.setAlwaysUseCache(false);
}
 
Example 2
Source File: TestGribCollectionsDense.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeClass
static public void before() {
  GribIosp.debugIndexOnlyCount = 0;
  GribCollectionImmutable.countGC = 0;
  PartitionCollectionImmutable.countPC = 0;
  RandomAccessFile.enableDefaultGlobalFileCache();
  RandomAccessFile.setDebugLeaks(true);
  Grib.setDebugFlags(new DebugFlagsImpl("Grib/indexOnly"));
  GribCdmIndex.setGribCollectionCache(new ucar.nc2.util.cache.FileCacheGuava("GribCollectionCacheGuava", 100));
  GribCdmIndex.gribCollectionCache.resetTracking();
}
 
Example 3
Source File: TestGribCollectionsDense.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@AfterClass
static public void after() {
  Grib.setDebugFlags(new DebugFlagsImpl());
  Formatter out = new Formatter(System.out);

  FileCacheIF cache = GribCdmIndex.gribCollectionCache;
  if (cache != null) {
    cache.showTracking(out);
    cache.showCache(out);
    cache.clearCache(false);
  }

  FileCacheIF rafCache = RandomAccessFile.getGlobalFileCache();
  if (rafCache != null) {
    rafCache.showCache(out);
  }

  System.out.printf("            countGC=%7d%n", GribCollectionImmutable.countGC);
  System.out.printf("            countPC=%7d%n", PartitionCollectionImmutable.countPC);
  System.out.printf("    countDataAccess=%7d%n", GribIosp.debugIndexOnlyCount);
  System.out.printf(" total files needed=%7d%n",
      GribCollectionImmutable.countGC + PartitionCollectionImmutable.countPC + GribIosp.debugIndexOnlyCount);

  FileCache.shutdown();
  RandomAccessFile.setGlobalFileCache(null);
  TestDir.checkLeaks();
  RandomAccessFile.setDebugLeaks(false);
}
 
Example 4
Source File: TestGribIndexCreationOther.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeClass
static public void before() {
  GribIosp.debugIndexOnlyCount = 0;
  GribCollectionImmutable.countGC = 0;
  PartitionCollectionImmutable.countPC = 0;
  RandomAccessFile.enableDefaultGlobalFileCache();
  RandomAccessFile.setDebugLeaks(true);
  // Grib.setDebugFlags(new DebugFlagsImpl("Grib/indexOnly"));
  GribCdmIndex.setGribCollectionCache(new ucar.nc2.util.cache.FileCacheGuava("GribCollectionCacheGuava", 100));
  GribCdmIndex.gribCollectionCache.resetTracking();
}
 
Example 5
Source File: TestGribIndexCreationOther.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@AfterClass
static public void after() {
  Grib.setDebugFlags(new DebugFlagsImpl());
  Formatter out = new Formatter(System.out);

  FileCacheIF cache = GribCdmIndex.gribCollectionCache;
  if (show && cache != null) {
    cache.showTracking(out);
    cache.showCache(out);
    cache.clearCache(false);
  }

  FileCacheIF rafCache = RandomAccessFile.getGlobalFileCache();
  if (show && rafCache != null) {
    rafCache.showCache(out);
  }

  System.out.printf("            countGC=%7d%n", GribCollectionImmutable.countGC);
  System.out.printf("            countPC=%7d%n", PartitionCollectionImmutable.countPC);
  System.out.printf("    countDataAccess=%7d%n", GribIosp.debugIndexOnlyCount);
  System.out.printf(" total files needed=%7d%n",
      GribCollectionImmutable.countGC + PartitionCollectionImmutable.countPC + GribIosp.debugIndexOnlyCount);

  FileCache.shutdown();
  RandomAccessFile.setGlobalFileCache(null);
  TestDir.checkLeaks();
  RandomAccessFile.setDebugLeaks(false);
}
 
Example 6
Source File: TestGribCollectionMissing.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeClass
static public void before() {
  GribIosp.debugIndexOnlyCount = 0;
  GribCollectionImmutable.countGC = 0;
  PartitionCollectionImmutable.countPC = 0;
  RandomAccessFile.enableDefaultGlobalFileCache();
  RandomAccessFile.setDebugLeaks(true);
  Grib.setDebugFlags(new DebugFlagsImpl("Grib/indexOnly"));
  GribCdmIndex.setGribCollectionCache(new ucar.nc2.util.cache.FileCacheGuava("GribCollectionCacheGuava", 100));
  GribCdmIndex.gribCollectionCache.resetTracking();
}
 
Example 7
Source File: TestGribCollectionMissing.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@AfterClass
static public void after() {
  Grib.setDebugFlags(new DebugFlagsImpl());
  Formatter out = new Formatter(System.out);

  FileCacheIF cache = GribCdmIndex.gribCollectionCache;
  if (cache != null) {
    cache.showTracking(out);
    cache.showCache(out);
    cache.clearCache(false);
  }

  FileCacheIF rafCache = RandomAccessFile.getGlobalFileCache();
  if (rafCache != null) {
    rafCache.showCache(out);
  }

  System.out.printf("            countGC=%7d%n", GribCollectionImmutable.countGC);
  System.out.printf("            countPC=%7d%n", PartitionCollectionImmutable.countPC);
  System.out.printf("    countDataAccess=%7d%n", GribIosp.debugIndexOnlyCount);
  System.out.printf(" total files needed=%7d%n",
      GribCollectionImmutable.countGC + PartitionCollectionImmutable.countPC + GribIosp.debugIndexOnlyCount);

  FileCache.shutdown();
  RandomAccessFile.setGlobalFileCache(null);
  TestDir.checkLeaks();
  RandomAccessFile.setDebugLeaks(false);
}
 
Example 8
Source File: TestGribCollectionCoordinates.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeClass
static public void before() throws IOException {
  GribIosp.debugIndexOnlyCount = 0;
  GribCollectionImmutable.countGC = 0;
  PartitionCollectionImmutable.countPC = 0;
  RandomAccessFile.enableDefaultGlobalFileCache();
  RandomAccessFile.setDebugLeaks(true);
  Grib.setDebugFlags(new DebugFlagsImpl("Grib/indexOnly"));
  GribCdmIndex.setGribCollectionCache(new ucar.nc2.util.cache.FileCacheGuava("GribCollectionCacheGuava", 100));
  GribCdmIndex.gribCollectionCache.resetTracking();
}
 
Example 9
Source File: TestGribIndexCreation.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@AfterClass
static public void after() {
  Grib.setDebugFlags(new DebugFlagsImpl());
  Formatter out = new Formatter(System.out);

  FileCacheIF cache = GribCdmIndex.gribCollectionCache;
  if (show && cache != null) {
    cache.showTracking(out);
    cache.showCache(out);
    cache.clearCache(false);
  }

  FileCacheIF rafCache = RandomAccessFile.getGlobalFileCache();
  if (show && rafCache != null) {
    rafCache.showCache(out);
  }

  System.out.printf("            countGC=%7d%n", GribCollectionImmutable.countGC);
  System.out.printf("            countPC=%7d%n", PartitionCollectionImmutable.countPC);
  System.out.printf("    countDataAccess=%7d%n", GribIosp.debugIndexOnlyCount);
  System.out.printf(" total files needed=%7d%n",
      GribCollectionImmutable.countGC + PartitionCollectionImmutable.countPC + GribIosp.debugIndexOnlyCount);

  FileCache.shutdown();
  RandomAccessFile.setGlobalFileCache(null);
  TestDir.checkLeaks();
  RandomAccessFile.setDebugLeaks(false);
}
 
Example 10
Source File: TestGribCollectionsBig.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@BeforeClass
static public void before() {
  GribIosp.debugIndexOnlyCount = 0;
  GribCollectionImmutable.countGC = 0;
  PartitionCollectionImmutable.countPC = 0;
  RandomAccessFile.enableDefaultGlobalFileCache();
  RandomAccessFile.setDebugLeaks(true);
  Grib.setDebugFlags(new DebugFlagsImpl("Grib/indexOnly"));
  GribCdmIndex.setGribCollectionCache(new ucar.nc2.util.cache.FileCacheGuava("GribCollectionCacheGuava", 100));
  GribCdmIndex.gribCollectionCache.resetTracking();
}
 
Example 11
Source File: TestGribCollectionsBig.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@AfterClass
static public void after() {
  Grib.setDebugFlags(new DebugFlagsImpl());
  Formatter out = new Formatter(System.out);

  FileCacheIF cache = GribCdmIndex.gribCollectionCache;
  if (cache != null) {
    cache.showTracking(out);
    cache.showCache(out);
    cache.clearCache(false);
  }

  FileCacheIF rafCache = RandomAccessFile.getGlobalFileCache();
  if (rafCache != null) {
    rafCache.showCache(out);
  }

  System.out.printf("            countGC=%7d%n", GribCollectionImmutable.countGC);
  System.out.printf("            countPC=%7d%n", PartitionCollectionImmutable.countPC);
  System.out.printf("    countDataAccess=%7d%n", GribIosp.debugIndexOnlyCount);
  System.out.printf(" total files needed=%7d%n",
      GribCollectionImmutable.countGC + PartitionCollectionImmutable.countPC + GribIosp.debugIndexOnlyCount);

  FileCache.shutdown();
  RandomAccessFile.setGlobalFileCache(null);
  TestDir.checkLeaks();
  RandomAccessFile.setDebugLeaks(false);
}
 
Example 12
Source File: DebugCommands.java    From tds with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void makeDebugActions() {
  Category debugHandler = findCategory("Debug");
  Action act;

  act = new Action("enableRafHandles", "Toggle tracking open RAF") {
    public void doAction(Event e) {
      try {
        RandomAccessFile.setDebugLeaks(!RandomAccessFile.getDebugLeaks());
        e.pw.println("  Tracking RAF=" + RandomAccessFile.getDebugLeaks());
      } catch (Exception ioe) {
        e.pw.println(ioe.getMessage());
      }
    }
  };
  debugHandler.addAction(act);

  act = new Action("showRafHandles", "Show open RAF") {
    public void doAction(Event e) {
      try {
        List<String> names = RandomAccessFile.getOpenFiles();
        e.pw.println("count=" + names.size());
        for (String s : names) {
          e.pw.println("  " + s);
        }
      } catch (Exception ioe) {
        e.pw.println(ioe.getMessage());
      }
    }
  };
  debugHandler.addAction(act);
}
 
Example 13
Source File: TestMiscIosp.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@BeforeClass
static public void startup() {
  RandomAccessFile.setDebugLeaks(true);
  RandomAccessFile.enableDefaultGlobalFileCache();
  leaks = RandomAccessFile.getOpenFiles().size();
}
 
Example 14
Source File: OpenRAFMonitorImpl.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void setDebugLeaks(boolean b) {
  RandomAccessFile.setDebugLeaks(b);
}
 
Example 15
Source File: OpenRAFMonitorImpl.java    From tds with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void setDebugLeaks(boolean b) {
  RandomAccessFile.setDebugLeaks(b);
}