FileDocCategorySizeDatePackage
RemoteListenerConnector.javaAPI DocGlassfish v2 API4602Fri May 04 22:25:44 BST 2007com.sun.enterprise.management.agent

RemoteListenerConnector

public class RemoteListenerConnector extends Object implements NotificationListener, Serializable
RemoteListenerConnectors are instantiated by the ListenerRegistry with the address of the callback port of the RemoteEventListener and then registered with the MBeanServer by the MEJB.
author
Hans Hrasna

Fields Summary
private String
proxyAddress
private RemoteEventListener
listener
private MBeanServer
server
private String
id
private boolean
debug
Constructors Summary
public RemoteListenerConnector(String address)


       
        proxyAddress = address;
    
Methods Summary
public java.lang.StringgetId()

        return id;
    
public voidhandleNotification(javax.management.Notification evt, java.lang.Object h)

        try {
            if (debug) System.out.println("RemoteListenerConnector.handleNotification()");
            if (listener == null) {
            	listener = (RemoteEventListener)Naming.lookup(proxyAddress);
            }
            listener.handleNotification(evt, h);
        } catch (java.rmi.RemoteException ce) {
            if (server != null) {
                if (debug) System.out.println("RemoteListenerConnector.server.removeNotificationListener("+ (ObjectName)evt.getSource() + ", " + this + ")");
                try {
                    server.removeNotificationListener((ObjectName)evt.getSource(), this);
                } catch (javax.management.ListenerNotFoundException e) {
                    if(debug) System.out.println(toString() + ": " + e); //occurs normally if event was fowarded from J2EEDomain
                } catch (Exception e1) {
                    System.out.println(toString() + ": " + e1);
                }
            }
        } catch (Exception e) {
            System.out.println(toString() + ": " + e);
            if (debug) {
            	try {
                	System.out.println("Naming.list(\"//localhost:1100\")");
                	String [] names = Naming.list("//localhost:1100");
            		for(int x=0;x<names.length;x++) {
                		System.out.println("names["+x+"] = " + names[x]);
            		}
            	} catch(Exception e1) {
                	e1.printStackTrace();
            	}
            }
        }
    
public voidsetMBeanServer(javax.management.MBeanServer s)

        server = s;