Add some comments and javadocs. Related to #368
This commit is contained in:
parent
1cd0aac738
commit
95e305f0e6
@ -89,7 +89,11 @@ public final class NioDatagramChannel extends AbstractNioChannel<DatagramChannel
|
||||
if (DetectionUtil.javaVersion() < 7 || family == null) {
|
||||
channel = DatagramChannel.open();
|
||||
} else {
|
||||
// This block only works on java7++, but we checked before if we have it
|
||||
// This block only works on java7++, but we checked before if we have it.
|
||||
//
|
||||
// Use the ProtocolFamilyConvert for conversion to prevent NoClassDefFoundError.
|
||||
//
|
||||
// See #368
|
||||
switch (family) {
|
||||
case INET:
|
||||
channel = DatagramChannel.open(ProtocolFamilyConverter.convert(family));
|
||||
|
@ -17,12 +17,21 @@ package org.jboss.netty.channel.socket.nio;
|
||||
|
||||
import java.net.ProtocolFamily;
|
||||
|
||||
|
||||
/**
|
||||
* Helper class which convert the {@link ProtocolFamily}.
|
||||
*
|
||||
*
|
||||
*/
|
||||
final class ProtocolFamilyConverter {
|
||||
|
||||
private ProtocolFamilyConverter() {
|
||||
|
||||
// Utility class
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the {@link NioDatagramChannel.ProtocolFamily}. This MUST only be called on jdk version >= 7.
|
||||
*/
|
||||
public static ProtocolFamily convert(NioDatagramChannel.ProtocolFamily family) {
|
||||
switch (family) {
|
||||
case INET:
|
||||
|
Loading…
Reference in New Issue
Block a user