Add some comments and javadocs. Related to #368

This commit is contained in:
norman 2012-05-30 13:02:17 +02:00
parent 1cd0aac738
commit 95e305f0e6
2 changed files with 15 additions and 2 deletions

View File

@ -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));

View File

@ -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: