Package net.algart.finalizing

Examples of net.algart.finalizing.Finalizer.invokeOnDeallocation()


                : m == TRUSTED_CNW ? aSource.asTrustedImmutable().asCopyOnNextWrite()
                : m == CNW_TRUSTED ? aSource.asCopyOnNextWrite().asTrustedImmutable()
                : null;
            final Array dup = aR.shallowClone();
            // - must be here, not inside the following inner class, to allow deallocation of aR
            fin.invokeOnDeallocation(aR, new Runnable() {
                public void run() {
                    System.out.println("~~~ Checking array @"
                        + Integer.toHexString(identityHashCode) + " while finalization...");
                    long t = System.currentTimeMillis();
                    while (System.currentTimeMillis() - t < 750) ; //emulation of long calculations
View Full Code Here


        mb.bb4 = fc.map(FileChannel.MapMode.READ_WRITE, 0, raf.length());
        pause("File is mapped again: " + mb.bb4.limit() + " bytes " + toString(mb.bb4));

        if (reduceByFinalizer) {
            // This call disables file removing on exit!
            fin.invokeOnDeallocation(mb, new Runnable() {
                public void run() {
                    try {
                        RandomAccessFile rafTemp = new RandomAccessFile(file, "rw");
                        rafTemp.setLength(700);
                        System.out.println("-- File " + file + " is resized to 700: " + rafTemp.length() + " bytes");
View Full Code Here

            mb.new FinHolder();
            pause("File will be deleted in finalize()");
        }

        if (!deleteResult && deleteByFinalizer) {
            fin.invokeOnDeallocation(mb, new Runnable() {
                public void run() {
                    boolean deleteResult = file.delete();
                    System.out.println("-- File is " + (deleteResult ? "" : "NOT ") + "deleted");
                }
            });
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.