@Override public void run() { try { writeNotification(listenerId, notification, handback); } catch (IOException e) { log.warnf("Unable to send notification to listener %d", listenerId); } } });
@Override public void run() { try { writeNotification(listenerId, notification, handback); } catch (IOException e) { log.warnf("Unable to send notification to listener %d", listenerId); } } });
@Override public void warn(String msg, Object... args) { this.logger.warnf(msg, args); }
private static void warnDeprecated(String usedProtocol, String recommendedProtocol) { log.warnf("The protocol '%s' is deprecated, instead you should use '%s'.", usedProtocol, recommendedProtocol); }
private void split(final String from, final Set<Byte> to) { String[] values = from.split(","); for (String current : values) { try { String temp = current.trim(); if (temp.length() > 0) { to.add(Byte.valueOf(current.trim())); } } catch (NumberFormatException e) { log.warnf("Unrecognised version '%s' in list.", current); } } }
@Override public void handleException(CommandAcceptanceException exception) { log.warnf( exception, "GenerationTarget encountered exception accepting command : %s", exception.getMessage() ); } }
ClientCommon(Channel channel, final Map<String, ?> environment) { super(channel); Integer seconds = null; if (environment != null && environment.containsKey(TIMEOUT_KEY)) { final Object timeout = environment.get(TIMEOUT_KEY); if (timeout instanceof Number) { seconds = ((Number) timeout).intValue(); } else if (timeout instanceof String) { try { seconds = Integer.parseInt((String) timeout); } catch (NumberFormatException e) { log.warnf(e, "Could not parse configured timeout %s", timeout); } } else { log.warnf("Timeout %s configured via environment is not valid ", timeout); } } else { seconds = Integer.getInteger(TIMEOUT_KEY, DEFAULT_TIMEOUT); } timeoutSeconds = seconds == null ? DEFAULT_TIMEOUT : seconds; }
public void performBeforeClassCallbacks(Object target) { if ( SessionFactoryRegistry.INSTANCE.hasRegistrations() ) { log.warnf( "Open SessionFactory instances found prior to start of test class [%s]", testClass.getName() ); } performCallbacks( beforeClassOnceMethods, target ); }
private Set<Byte> getExcludedVersions() { Set<Byte> excluded = new HashSet<Byte>(); Object list; if (environment != null && environment.containsKey(EXCLUDED_VERSIONS) && (list = environment.get(EXCLUDED_VERSIONS)) != null) { if (list instanceof String) { split((String) list, excluded); } else { log.warnf("Ignoring excluded versions list of type '%s'", list.getClass().getName()); } } split(System.getProperty(EXCLUDED_VERSIONS, ""), excluded); return excluded; }
@SuppressWarnings("ResultOfMethodCallIgnored") private static Reader toReader(File file, String charsetName) { if ( ! file.exists() ) { log.warnf( "Specified schema generation script file [%s] did not exist for reading", file ); return new Reader() { @Override public int read(char[] cbuf, int off, int len) throws IOException { return -1; } @Override public void close() throws IOException { } }; } try { return charsetName != null ? new InputStreamReader( new FileInputStream(file), charsetName ) : new InputStreamReader( new FileInputStream(file) ); } catch (IOException e) { throw new SchemaManagementException( "Unable to open specified script target file [" + file + "] for reading", e ); } }
private synchronized void removeNotificationListener(int listenerId) throws ListenerNotFoundException, InstanceNotFoundException, IOException { Association association = listeners.remove(listenerId); if (association != null) { server.getMBeanServerConnection().removeNotificationListener(association.name, association.listener, association.filter, association.handback); } else { log.warnf("Request to removeNotificationListener, listener with ID %d not found.", listenerId); } }
private synchronized void removeNotificationListener(int listenerId) throws ListenerNotFoundException, InstanceNotFoundException, IOException { Association association = listeners.remove(listenerId); if (association != null) { server.getMBeanServerConnection().removeNotificationListener(association.name, association.listener, association.filter, association.handback); } else { log.warnf("Request to removeNotificationListener, listener with ID %d not found.", listenerId); } }
public void performAfterClassCallbacks(Object target) { performCallbacks( afterClassOnceMethods, target ); if ( SessionFactoryRegistry.INSTANCE.hasRegistrations() ) { log.warnf( "Open SessionFactory instances found after completion of test class [%s]; closing them", testClass.getName() ); SessionFactoryRegistry.INSTANCE.clearRegistrations(); } }
private void notify(int id, Notification n, Object handback) { Association association = get(id); if (association != null) { association.listener.handleNotification(n, association.handBack); } else { // If an invalid ID is received don't throw an error, instead just send // a message to the server canceling the notification by id. try { log.warnf("Notification recieved for non existant NotificationListener %d", id); mbeanServerConnection.removeNotificationListener(new int[] { id }); } catch (InstanceNotFoundException e) { } catch (ListenerNotFoundException e) { } catch (IOException e) { } } }
/** * Finalize this closeable instance. If the instance hasn't been closed, it is closed and a warning is logged. */ protected void finalize() throws Throwable { try { super.finalize(); } finally { if (autoClose && isOpen()) { if (LEAK_DEBUGGING) { final Throwable t = new LeakThrowable(); t.setStackTrace(backtrace); log.warnf(t, "Leaked a %s instance: %s", getClass().getName(), this); } else { log.tracef("Leaked a %s instance: %s", getClass().getName(), this); } closeAsync(); } } }
private void notify(int id, Notification n, Object handback) { Association association = get(id); if (association != null) { association.listener.handleNotification(n, handback); } else { // If an invalid ID is received don't throw an error, instead just send // a message to the server canceling the notification by id. try { log.warnf("Notification recieved for non existant NotificationListener %d", id); mbeanServerConnection.removeNotificationListener(new int[] { id }); } catch (InstanceNotFoundException e) { } catch (ListenerNotFoundException e) { } catch (IOException e) { } } }
public VersionedConnection getVersionedConnection(final byte version, final Channel channel, final JMXServiceURL serviceURL) throws IOException { if (supportedVersions.containsKey(version)) { if (version == VersionOne.getVersionIdentifier()) { return VersionOne.getConnection(channel, environment); } else if (version == VersionTwo.getVersionIdentifier()) { return VersionTwo.getConnection(channel, environment, serviceURL); } } else { log.warnf("An attempt has been made to select an unsupported version 0x0%d", version); } throw new IllegalArgumentException("Unsupported protocol version."); }
public void startServer(final byte version, final Channel channel, final MBeanServerManager serverManager, final Executor executor, final ServerMessageInterceptor serverMessageInterceptor) throws IOException { if (supportedVersions.containsKey(version)) { if (version == VersionOne.getVersionIdentifier()) { VersionOne.startServer(channel, serverManager.getDefaultMBeanServer(), executor, serverMessageInterceptor); } else if (version == VersionTwo.getVersionIdentifier()) { VersionTwo.startServer(channel, serverManager, executor, serverMessageInterceptor); } return; } else { log.warnf("An attempt has been made to select an unsupported version 0x0%d", version); } throw new IllegalArgumentException("Unsupported protocol version."); } }
private synchronized void removeNotificationListener(int listenerId) throws ListenerNotFoundException, InstanceNotFoundException, IOException { Association association = listeners.remove(listenerId); if (association != null) { server.getMBeanServerConnection().removeNotificationListener(association.name, association.listener, association.filter, association.handback); } else { log.warnf("Request to removeNotificationListener, listener with ID %d not found.", listenerId); } }