779 if (i.next() == null) i.remove(); |
779 if (i.next() == null) i.remove(); |
780 return new Hashtable<K, V>(m); |
780 return new Hashtable<K, V>(m); |
781 } |
781 } |
782 |
782 |
783 /** |
783 /** |
784 * Returns true if the parameter JMXConnector.USE_EVENT_SERVICE is set to a |
|
785 * String equals "true" by ignoring case in the map or in the System. |
|
786 */ |
|
787 public static boolean eventServiceEnabled(Map<String, ?> env) { |
|
788 return computeBooleanFromString(env, JMXConnector.USE_EVENT_SERVICE, true); |
|
789 } |
|
790 |
|
791 /** |
|
792 * Returns true if the parameter JMXConnectorServer.DELEGATE_TO_EVENT_SERVICE |
|
793 * is set to a String equals "true" (ignores case). |
|
794 * If the property DELEGATE_TO_EVENT_SERVICE is not set, returns |
|
795 * a default value of "true". |
|
796 */ |
|
797 public static boolean delegateToEventService(Map<String, ?> env) { |
|
798 return computeBooleanFromString(env, |
|
799 JMXConnectorServer.DELEGATE_TO_EVENT_SERVICE, true, true); |
|
800 } |
|
801 |
|
802 /** |
|
803 * <p>Name of the attribute that specifies whether a connector server |
784 * <p>Name of the attribute that specifies whether a connector server |
804 * should not prevent the VM from exiting |
785 * should not prevent the VM from exiting |
805 */ |
786 */ |
806 public static final String JMX_SERVER_DAEMON = "jmx.remote.x.daemon"; |
787 public static final String JMX_SERVER_DAEMON = "jmx.remote.x.daemon"; |
807 |
788 |
815 public static boolean isServerDaemon(Map<String, ?> env) { |
796 public static boolean isServerDaemon(Map<String, ?> env) { |
816 return (env != null) && |
797 return (env != null) && |
817 ("true".equalsIgnoreCase((String)env.get(JMX_SERVER_DAEMON))); |
798 ("true".equalsIgnoreCase((String)env.get(JMX_SERVER_DAEMON))); |
818 } |
799 } |
819 |
800 |
820 // /** |
|
821 // * <p>Name of the attribute that specifies an EventRelay object to use. |
|
822 // */ |
|
823 // public static final String EVENT_RELAY = |
|
824 // "jmx.remote.x.event.relay"; |
|
825 // |
|
826 // |
|
827 // /** |
|
828 // * Returns an EventRelay object. The default one is FetchingEventRelay. |
|
829 // * If {@code EVENT_RELAY} is specified in {@code env} as a key, |
|
830 // * its value will be returned as an EventRelay object, if the value is |
|
831 // * not of type {@code EventRelay}, the default {@code FetchingEventRelay} |
|
832 // * will be returned. |
|
833 // * If {@code EVENT_RELAY} is not specified but {@code ENABLE_EVENT_RELAY} |
|
834 // * is specified as a key and its value is <code true>, the default {@code FetchingEventRelay} |
|
835 // * will be returned. |
|
836 // */ |
|
837 // public static EventRelay getEventRelay(Map env) { |
|
838 // Map info = env == null ? |
|
839 // Collections.EMPTY_MAP : env; |
|
840 // |
|
841 // Object o = env.get(EVENT_RELAY); |
|
842 // if (o instanceof EventRelay) { |
|
843 // return (EventRelay)o; |
|
844 // } else if (o != null) { |
|
845 // logger.warning("getEventRelay", |
|
846 // "The user specified object is not an EventRelay object, " + |
|
847 // "using the default class FetchingEventRelay."); |
|
848 // |
|
849 // return new FetchingEventRelay(); |
|
850 // } |
|
851 // |
|
852 // if (enableEventRelay(env)) { |
|
853 // return new FetchingEventRelay(); |
|
854 // } |
|
855 // |
|
856 // return null; |
|
857 // } |
|
858 |
|
859 |
|
860 private static final class SinkOutputStream extends OutputStream { |
801 private static final class SinkOutputStream extends OutputStream { |
861 public void write(byte[] b, int off, int len) {} |
802 public void write(byte[] b, int off, int len) {} |
862 public void write(int b) {} |
803 public void write(int b) {} |
863 } |
804 } |
864 |
805 |