void start() throws IOException { sendVersionHeader(); IoFuture<String> futureConnectionId = ConnectionIdReceiver.getConnectionId(channel); IoFuture.Status result = futureConnectionId.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: connectionId = futureConnectionId.get(); mbeanServerConnection = new TheConnection(); localNotificationManager = new LocalNotificationManager(); channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureConnectionId.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } }
private synchronized int associate(ObjectName target, NotificationListener listener, NotificationFilter filter, Object handBack) { Integer next = getNextNotificationId(); // Not likely but possible to use all IDs and start back at beginning while // old request still in progress. while (listeners.containsKey(next)) { next = getNextNotificationId(); } Association association = new Association(); association.target = target; association.listener = listener; association.filter = filter; association.handBack = handBack; listeners.put(next, association); return next; }
private synchronized int associate(ObjectName target, NotificationListener listener, NotificationFilter filter, Object handBack) { Integer next = getNextNotificationId(); // Not likely but possible to use all IDs and start back at beginning while // old request still in progress. while (listeners.containsKey(next)) { next = getNextNotificationId(); } Association association = new Association(); association.target = target; association.listener = listener; association.filter = filter; association.handBack = handBack; listeners.put(next, association); return next; }
private synchronized int associate(ObjectName target, NotificationListener listener, NotificationFilter filter, Object handBack) { Integer next = getNextNotificationId(); // Not likely but possible to use all IDs and start back at beginning while // old request still in progress. while (listeners.containsKey(next)) { next = getNextNotificationId(); } Association association = new Association(); association.target = target; association.listener = listener; association.filter = filter; association.handBack = handBack; listeners.put(next, association); return next; }
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) { } } }
void start() throws IOException { sendVersionHeader(); IoFuture<String> futureConnectionId = ConnectionIdReceiver.getConnectionId(channel); IoFuture.Status result = futureConnectionId.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: connectionId = futureConnectionId.get(); mbeanServerConnection = new TheConnection(); localNotificationManager = new LocalNotificationManager(); channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureConnectionId.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } }
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) { } } }
void start() throws IOException { sendVersionHeader(); IoFuture<String> futureConnectionId = ConnectionIdReceiver.getConnectionId(channel); IoFuture.Status result = futureConnectionId.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: connectionId = futureConnectionId.get(); mbeanServerConnection = new TheConnection(); localNotificationManager = new LocalNotificationManager(); channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureConnectionId.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } }
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) { } } }