javax.management.NotificationBroadcasterSupport Java Examples

The following examples show how to use javax.management.NotificationBroadcasterSupport. 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: CommunicatorServer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #2
Source File: StandardMBeanIntrospector.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #3
Source File: CommunicatorServer.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #4
Source File: CommunicatorServer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #5
Source File: StandardMBeanIntrospector.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #6
Source File: StandardMBeanIntrospector.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #7
Source File: StandardMBeanIntrospector.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #8
Source File: CommunicatorServer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #9
Source File: CommunicatorServer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #10
Source File: CommunicatorServer.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #11
Source File: StandardMBeanIntrospector.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #12
Source File: CommunicatorServer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #13
Source File: StandardMBeanIntrospector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #14
Source File: CommunicatorServer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #15
Source File: StandardMBeanIntrospector.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #16
Source File: StandardMBeanIntrospector.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #17
Source File: CommunicatorServer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #18
Source File: StandardMBeanIntrospector.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #19
Source File: CommunicatorServer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #20
Source File: StandardMBeanIntrospector.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #21
Source File: CommunicatorServer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #22
Source File: StandardMBeanIntrospector.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #23
Source File: CommunicatorServer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #24
Source File: StandardMBeanIntrospector.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #25
Source File: CommunicatorServer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #26
Source File: StandardMBeanIntrospector.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #27
Source File: CommunicatorServer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Controls the way the CommunicatorServer service is deserialized.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    // Call the default deserialization of the object.
    //
    stream.defaultReadObject();

    // Call the specific initialization for the CommunicatorServer service.
    // This is for transient structures to be initialized to specific
    // default values.
    //
    stateLock = new Object();
    state = OFFLINE;
    stopRequested = false;
    servedClientCount = 0;
    clientHandlerVector = new Vector<>();
    mainThread = null;
    notifCount = 0;
    notifInfos = null;
    notifBroadcaster = new NotificationBroadcasterSupport();
    dbgTag = makeDebugTag();
}
 
Example #28
Source File: StandardMBeanIntrospector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #29
Source File: StandardMBeanIntrospector.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
static boolean isDefinitelyImmutableInfo(Class<?> implClass) {
    if (!NotificationBroadcaster.class.isAssignableFrom(implClass))
        return true;
    synchronized (definitelyImmutable) {
        Boolean immutable = definitelyImmutable.get(implClass);
        if (immutable == null) {
            final Class<NotificationBroadcasterSupport> nbs =
                    NotificationBroadcasterSupport.class;
            if (nbs.isAssignableFrom(implClass)) {
                try {
                    Method m = implClass.getMethod("getNotificationInfo");
                    immutable = (m.getDeclaringClass() == nbs);
                } catch (Exception e) {
                    // Too bad, we'll say no for now.
                    return false;
                }
            } else
                immutable = false;
            definitelyImmutable.put(implClass, immutable);
        }
        return immutable;
    }
}
 
Example #30
Source File: DirectoryScanner.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new {@code DirectoryScanner}.
 * <p>This constructor is
 * package protected, and this MBean cannot be created by a remote
 * client, because it needs a reference to the {@link ResultLogManager},
 * which cannot be provided from remote.
 * </p>
 * <p>This is a conscious design choice: {@code DirectoryScanner} MBeans
 * are expected to be completely managed (created, registered, unregistered)
 * by the {@link ScanManager} which does provide this reference.
 * </p>
 *
 * @param config This {@code DirectoryScanner} configuration.
 * @param logManager The info log manager with which to log the info
 *        records.
 * @throws IllegalArgumentException if one of the parameter is null, or if
 *         the provided {@code config} doesn't have its {@code name} set,
 *         or if the {@link DirectoryScannerConfig#getRootDirectory
 *         root directory} provided in the {@code config} is not acceptable
 *         (not provided or not found or not readable, etc...).
 **/
public DirectoryScanner(DirectoryScannerConfig config,
                        ResultLogManager logManager)
    throws IllegalArgumentException {
    if (logManager == null)
        throw new IllegalArgumentException("log=null");
    if (config == null)
        throw new IllegalArgumentException("config=null");
    if (config.getName() == null)
        throw new IllegalArgumentException("config.name=null");

     broadcaster = new NotificationBroadcasterSupport();

     // Clone the config: ensure data encapsulation.
     //
     this.config = XmlConfigUtils.xmlClone(config);

     // Checks that the provided root directory is valid.
     // Throws IllegalArgumentException if it isn't.
     //
     rootFile = validateRoot(config.getRootDirectory());

     // Initialize the Set<Action> for which this DirectoryScanner
     // is configured.
     //
     if (config.getActions() == null)
         actions = Collections.emptySet();
     else
         actions = EnumSet.copyOf(Arrays.asList(config.getActions()));
     this.logManager = logManager;
}