Class TooManyListenersException in java

digitization, transformation, binary

Class TooManyListenersException in java

An exception of this type signals that an AWT component or Java bean may only have one EventListener object registered for some specific type of event. That is, it signals that a particular event is a “unicast” event rather than a “multicast” event.

This exception type serves a formal purpose in the AWT and JavaBeans event model. Its presence in the throws clause of an EventListener registration method (even if the method never actually throws the exception) signals that an event is a unicast event.

Ads code goes here

A TooManyListenersException is thrown to indicate that more than one listener is registered with a unicast event source. Normally, an event source multicasts to all registered listeners. In some special cases, however, an event source is unicast, meaning it only sends events to a single listener. This exception is thrown if more than one listener tries to register.

The structure of the TooManyListenerException is given as

public class java.util.TooManylistenersException extends java.lang.Exception{
// Public Constructors
public TooManyListenersException(); //This constructor creates aTooManyListenersException with no associated detail message
public TooManyListenersException(String s);//This constructor creates a TooManyListenersException with the specified detail message
}

The class TooManyListenersException also inherits methods from class Object and Throwable.

From Object classFrom Throwable class
clone()fillInStackTrace()
getClass()getMessage()
notify()printStackTrace()
wait()printStackTrace(PrintWriter)
wait(long, int)getLocalizedMessage()
wait(long)printStackTrace(PrintStream)
equals(Object)
toString()
finalize()
hashCode()
notifyAll()

Share and Enjoy !

READ  Class ZipException in Java

Leave a Comment

Your email address will not be published. Required fields are marked *