java.rmi.server.Unreferenced Java Examples

The following examples show how to use java.rmi.server.Unreferenced. 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: Target.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            AccessController.doPrivileged(
                new NewThreadAction(() -> {
                    Thread.currentThread().setContextClassLoader(ccl);
                    AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
                        unrefObj.unreferenced();
                        return null;
                    }, acc);
                }, "Unreferenced-" + nextThreadNum++, false, true)).start();
                // REMIND: access to nextThreadNum not synchronized; you care?
        }

        unpinImpl();
    }
}
 
Example #2
Source File: Target.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            AccessController.doPrivileged(
                new NewThreadAction(() -> {
                    Thread.currentThread().setContextClassLoader(ccl);
                    AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
                        unrefObj.unreferenced();
                        return null;
                    }, acc);
                }, "Unreferenced-" + nextThreadNum++, false, true)).start();
                // REMIND: access to nextThreadNum not synchronized; you care?
        }

        unpinImpl();
    }
}
 
Example #3
Source File: Target.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            AccessController.doPrivileged(
                new NewThreadAction(() -> {
                    Thread.currentThread().setContextClassLoader(ccl);
                    AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
                        unrefObj.unreferenced();
                        return null;
                    }, acc);
                }, "Unreferenced-" + nextThreadNum++, false, true)).start();
                // REMIND: access to nextThreadNum not synchronized; you care?
        }

        unpinImpl();
    }
}
 
Example #4
Source File: Target.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            AccessController.doPrivileged(
                new NewThreadAction(() -> {
                    Thread.currentThread().setContextClassLoader(ccl);
                    AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
                        unrefObj.unreferenced();
                        return null;
                    }, acc);
                }, "Unreferenced-" + nextThreadNum++, false, true)).start();
                // REMIND: access to nextThreadNum not synchronized; you care?
        }

        unpinImpl();
    }
}
 
Example #5
Source File: Target.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            AccessController.doPrivileged(
                new NewThreadAction(() -> {
                    Thread.currentThread().setContextClassLoader(ccl);
                    AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
                        unrefObj.unreferenced();
                        return null;
                    }, acc);
                }, "Unreferenced-" + nextThreadNum++, false, true)).start();
                // REMIND: access to nextThreadNum not synchronized; you care?
        }

        unpinImpl();
    }
}
 
Example #6
Source File: Target.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            final Thread t =
                java.security.AccessController.doPrivileged(
                    new NewThreadAction(new Runnable() {
                        public void run() {
                            unrefObj.unreferenced();
                        }
                    }, "Unreferenced-" + nextThreadNum++, false, true));
            // REMIND: access to nextThreadNum not synchronized; you care?
            /*
             * We must manually set the context class loader appropriately
             * for threads that may invoke user code (see bugid 4171278).
             */
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction<Void>() {
                    public Void run() {
                    t.setContextClassLoader(ccl);
                    return null;
                }
            });

            t.start();
        }

        unpinImpl();
    }
}
 
Example #7
Source File: Target.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            final Thread t =
                java.security.AccessController.doPrivileged(
                    new NewThreadAction(new Runnable() {
                        public void run() {
                            unrefObj.unreferenced();
                        }
                    }, "Unreferenced-" + nextThreadNum++, false, true));
            // REMIND: access to nextThreadNum not synchronized; you care?
            /*
             * We must manually set the context class loader appropriately
             * for threads that may invoke user code (see bugid 4171278).
             */
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction<Void>() {
                    public Void run() {
                    t.setContextClassLoader(ccl);
                    return null;
                }
            });

            t.start();
        }

        unpinImpl();
    }
}
 
Example #8
Source File: Target.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            final Thread t =
                java.security.AccessController.doPrivileged(
                    new NewThreadAction(new Runnable() {
                        public void run() {
                            unrefObj.unreferenced();
                        }
                    }, "Unreferenced-" + nextThreadNum++, false, true));
            // REMIND: access to nextThreadNum not synchronized; you care?
            /*
             * We must manually set the context class loader appropriately
             * for threads that may invoke user code (see bugid 4171278).
             */
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction<Void>() {
                    public Void run() {
                    t.setContextClassLoader(ccl);
                    return null;
                }
            });

            t.start();
        }

        unpinImpl();
    }
}
 
Example #9
Source File: Target.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            final Thread t =
                java.security.AccessController.doPrivileged(
                    new NewThreadAction(new Runnable() {
                        public void run() {
                            unrefObj.unreferenced();
                        }
                    }, "Unreferenced-" + nextThreadNum++, false, true));
            // REMIND: access to nextThreadNum not synchronized; you care?
            /*
             * We must manually set the context class loader appropriately
             * for threads that may invoke user code (see bugid 4171278).
             */
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction<Void>() {
                    public Void run() {
                    t.setContextClassLoader(ccl);
                    return null;
                }
            });

            t.start();
        }

        unpinImpl();
    }
}
 
Example #10
Source File: Target.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            final Thread t =
                java.security.AccessController.doPrivileged(
                    new NewThreadAction(new Runnable() {
                        public void run() {
                            unrefObj.unreferenced();
                        }
                    }, "Unreferenced-" + nextThreadNum++, false, true));
            // REMIND: access to nextThreadNum not synchronized; you care?
            /*
             * We must manually set the context class loader appropriately
             * for threads that may invoke user code (see bugid 4171278).
             */
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction<Void>() {
                    public Void run() {
                    t.setContextClassLoader(ccl);
                    return null;
                }
            });

            t.start();
        }

        unpinImpl();
    }
}
 
Example #11
Source File: Target.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            final Thread t =
                java.security.AccessController.doPrivileged(
                    new NewThreadAction(new Runnable() {
                        public void run() {
                            unrefObj.unreferenced();
                        }
                    }, "Unreferenced-" + nextThreadNum++, false, true));
            // REMIND: access to nextThreadNum not synchronized; you care?
            /*
             * We must manually set the context class loader appropriately
             * for threads that may invoke user code (see bugid 4171278).
             */
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction<Void>() {
                    public Void run() {
                    t.setContextClassLoader(ccl);
                    return null;
                }
            });

            t.start();
        }

        unpinImpl();
    }
}
 
Example #12
Source File: Target.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            final Thread t =
                java.security.AccessController.doPrivileged(
                    new NewThreadAction(new Runnable() {
                        public void run() {
                            unrefObj.unreferenced();
                        }
                    }, "Unreferenced-" + nextThreadNum++, false, true));
            // REMIND: access to nextThreadNum not synchronized; you care?
            /*
             * We must manually set the context class loader appropriately
             * for threads that may invoke user code (see bugid 4171278).
             */
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction<Void>() {
                    public Void run() {
                    t.setContextClassLoader(ccl);
                    return null;
                }
            });

            t.start();
        }

        unpinImpl();
    }
}
 
Example #13
Source File: Target.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Remove endpoint from the reference set.
 */
synchronized private void refSetRemove(VMID vmid) {
    // remove notification request
    DGCImpl.getDGCImpl().unregisterTarget(vmid, this);

    if (refSet.removeElement(vmid) && refSet.isEmpty()) {
        // reference set is empty, so server can be garbage collected.
        // remove object from table.
        if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
            DGCImpl.dgcLog.log(Log.VERBOSE,
                "reference set is empty: target = " + this);
        }

        /*
         * If the remote object implements the Unreferenced interface,
         * invoke its unreferenced callback in a separate thread.
         */
        Remote obj = getImpl();
        if (obj instanceof Unreferenced) {
            final Unreferenced unrefObj = (Unreferenced) obj;
            final Thread t =
                java.security.AccessController.doPrivileged(
                    new NewThreadAction(new Runnable() {
                        public void run() {
                            unrefObj.unreferenced();
                        }
                    }, "Unreferenced-" + nextThreadNum++, false, true));
            // REMIND: access to nextThreadNum not synchronized; you care?
            /*
             * We must manually set the context class loader appropriately
             * for threads that may invoke user code (see bugid 4171278).
             */
            java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction<Void>() {
                    public Void run() {
                    t.setContextClassLoader(ccl);
                    return null;
                }
            });

            t.start();
        }

        unpinImpl();
    }
}