Package org.glassfish.tyrus.core
Class MessageHandlerManager
- java.lang.Object
-
- org.glassfish.tyrus.core.MessageHandlerManager
-
public class MessageHandlerManager extends java.lang.Object
Manages registeredMessageHandler
s and checks whether the new ones may be registered.- Author:
- Stepan Kopriva (stepan.kopriva at oracle.com), Pavel Bucek (pavel.bucek at oracle.com)
- See Also:
MessageHandler
,OnMessage
-
-
Constructor Summary
Constructors Constructor Description MessageHandlerManager()
Construct manager with no decoders.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> void
addMessageHandler(java.lang.Class<T> clazz, MessageHandler.Partial<T> handler)
AddMessageHandler.Partial
to the manager.<T> void
addMessageHandler(java.lang.Class<T> clazz, MessageHandler.Whole<T> handler)
AddMessageHandler.Whole
to the manager.void
addMessageHandler(MessageHandler handler)
AddMessageHandler
to the manager.static MessageHandlerManager
fromDecoderClasses(java.util.List<java.lang.Class<? extends Decoder>> decoderClasses)
Construct manager.java.util.Set<MessageHandler>
getMessageHandlers()
Get all successfully registeredMessageHandler
s.java.util.List<java.util.Map.Entry<java.lang.Class<?>,MessageHandler>>
getOrderedWholeMessageHandlers()
boolean
isInputStreamHandlerPresent()
boolean
isReaderHandlerPresent()
void
removeMessageHandler(MessageHandler handler)
RemoveMessageHandler
from the manager.
-
-
-
Method Detail
-
fromDecoderClasses
public static MessageHandlerManager fromDecoderClasses(java.util.List<java.lang.Class<? extends Decoder>> decoderClasses)
Construct manager.- Parameters:
decoderClasses
- registeredDecoder
s.- Returns:
- constructed message handler manager.
-
addMessageHandler
public void addMessageHandler(MessageHandler handler) throws java.lang.IllegalStateException
AddMessageHandler
to the manager.- Parameters:
handler
-MessageHandler
to be added to the manager.- Throws:
java.lang.IllegalStateException
-
addMessageHandler
public <T> void addMessageHandler(java.lang.Class<T> clazz, MessageHandler.Whole<T> handler) throws java.lang.IllegalStateException
AddMessageHandler.Whole
to the manager.- Type Parameters:
T
- type of message to be handled.- Parameters:
clazz
- type handled byMessageHandler
.handler
-MessageHandler
to be added.- Throws:
java.lang.IllegalStateException
- when the message handler cannot be added.
-
addMessageHandler
public <T> void addMessageHandler(java.lang.Class<T> clazz, MessageHandler.Partial<T> handler) throws java.lang.IllegalStateException
AddMessageHandler.Partial
to the manager.- Type Parameters:
T
- type of message to be handled.- Parameters:
clazz
- type handled byMessageHandler
.handler
-MessageHandler
to be added.- Throws:
java.lang.IllegalStateException
- when the message handler cannot be added.
-
removeMessageHandler
public void removeMessageHandler(MessageHandler handler)
RemoveMessageHandler
from the manager.- Parameters:
handler
- handler which will be removed.
-
getMessageHandlers
public java.util.Set<MessageHandler> getMessageHandlers()
Get all successfully registeredMessageHandler
s.- Returns:
- unmodifiable
Set
of registeredMessageHandler
s.
-
getOrderedWholeMessageHandlers
public java.util.List<java.util.Map.Entry<java.lang.Class<?>,MessageHandler>> getOrderedWholeMessageHandlers()
-
isReaderHandlerPresent
public boolean isReaderHandlerPresent()
-
isInputStreamHandlerPresent
public boolean isInputStreamHandlerPresent()
-
-