MCPcopy Create free account
hub / github.com/OSGeo/gdal / main

Method main

swig/java/apps/OGRFeature.java:28–118  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

26 static Object mutex = new Object();
27
28 public static void main(String[] args)
29 {
30 featureDefn = new FeatureDefn();
31
32 new Thread() {
33 public void run()
34 {
35 while(!bHasFinished)
36 {
37 if (doCleanup)
38 {
39 int refBefore, refAfter;
40 while(true)
41 {
42 refBefore = featureDefn.GetReferenceCount();
43 System.out.print("i=" + i + " ref(before)="+ refBefore );
44 System.runFinalization();
45 refAfter = featureDefn.GetReferenceCount();
46 System.out.println(" ref(after)="+ refAfter );
47 if (refBefore == refAfter)
48 System.gc();
49 else
50 break;
51 }
52 synchronized (mutex) {
53 doCleanup = false;
54 mutex.notify();
55 }
56 }
57
58 synchronized (mutex) {
59 while (doCleanup == false && bHasFinished == false)
60 {
61 //System.out.println("thread wakeup");
62 try
63 {
64 mutex.wait();
65 }
66 catch(InterruptedException ie)
67 {
68 System.out.println("InterruptedException");
69 }
70 }
71 }
72 }
73 }
74 }.start();
75
76 // Add features
77 for (i = 0; i < 5000000; i++)
78 {
79 new Feature(featureDefn);
80
81 if ((i % 100000) == 0)
82 {
83 /* Due to the fact that the Feature class has a finalize() method */
84 /* the garbage collector will differ finalization. So we have to do */
85 /* wait that the cleanup thread has forced finalizations */

Callers

nothing calls this directly

Calls 3

startMethod · 0.80
GetReferenceCountMethod · 0.80
printMethod · 0.45

Tested by

no test coverage detected