public class RegistryUtility extends Object
For example, it provides methods to add Codec(s) required by Netty to Registry.
比如说,它提供向Registry中添加Netty所需的Codec的方法。
But you should be aware that it does not ensure multi-threads safe on the manipulation of Registry.
但是注意,它不保证对Registry的操作是多线程安全的。
Modifier and Type | Field and Description |
---|---|
static String |
NAME_DECODERS |
static String |
NAME_ENCODERS |
Constructor and Description |
---|
RegistryUtility() |
Modifier and Type | Method and Description |
---|---|
protected static void |
addCodecOnly(CombinedRegistry registry,
String name,
org.jboss.netty.channel.ChannelHandler codec)
Adds codec to Registry only, it will not handle the manipulating of encoders or decoders list in Registry.
仅仅把codec直接加入到Registry中,而不处理加入到Registry里的encoders或decoders列表中。 |
static void |
addDecoder(org.apache.camel.CamelContext context,
String name,
org.jboss.netty.channel.ChannelUpstreamHandler decoder)
Adds an Netty decoder to Registry.
向Registry中增加一个给Netty用的decoder。 |
static void |
addEncoder(org.apache.camel.CamelContext context,
String name,
org.jboss.netty.channel.ChannelDownstreamHandler encoder)
Adds an Netty encoder to Registry.
向Registry中增加一个给Netty用的encoder。 |
static CombinedRegistry |
getCombinedRegistry(org.apache.camel.CamelContext camelContext)
Gets CombinedRegistry from CamelContext.
从CamelContext中得到CombinedRegistry类型的Registry。 |
public static final String NAME_ENCODERS
public static final String NAME_DECODERS
public static CombinedRegistry getCombinedRegistry(org.apache.camel.CamelContext camelContext)
camelContext
- The CamelContext must be based on CombinedRegistry, otherwise ClassCastException will be thrown.public static void addEncoder(org.apache.camel.CamelContext context, String name, org.jboss.netty.channel.ChannelDownstreamHandler encoder)
context
- The CamelContext must be based on CombinedRegistry, otherwise ClassCastException will be thrown.name
- Name of the encoder in Registry.encoder
- The encoder that will be used by Netty.public static void addDecoder(org.apache.camel.CamelContext context, String name, org.jboss.netty.channel.ChannelUpstreamHandler decoder)
context
- The CamelContext must be based on CombinedRegistry, otherwise ClassCastException will be thrown.name
- Name of the decoder in Registry.decoder
- The decoder that will be used by Netty.protected static void addCodecOnly(CombinedRegistry registry, String name, org.jboss.netty.channel.ChannelHandler codec)
If a codec with the same name already exists in the Registry, IllegalArgumentException will be thrown.
如果Registry中原先已经有同名的别的codec,则抛出IllegalArgumentException。
registry
- The CombinedRegistry that the codec will be added into.name
- Name of the codec in Registry.codec
- The codec that will be used by Netty.Copyright © 2014. All Rights Reserved.