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) {
|
if (DetectionUtil.javaVersion() < 7 || family == null) {
|
||||||
channel = DatagramChannel.open();
|
channel = DatagramChannel.open();
|
||||||
} else {
|
} 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) {
|
switch (family) {
|
||||||
case INET:
|
case INET:
|
||||||
channel = DatagramChannel.open(ProtocolFamilyConverter.convert(family));
|
channel = DatagramChannel.open(ProtocolFamilyConverter.convert(family));
|
||||||
|
@ -17,12 +17,21 @@ package org.jboss.netty.channel.socket.nio;
|
|||||||
|
|
||||||
import java.net.ProtocolFamily;
|
import java.net.ProtocolFamily;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class which convert the {@link ProtocolFamily}.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
final class ProtocolFamilyConverter {
|
final class ProtocolFamilyConverter {
|
||||||
|
|
||||||
private 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) {
|
public static ProtocolFamily convert(NioDatagramChannel.ProtocolFamily family) {
|
||||||
switch (family) {
|
switch (family) {
|
||||||
case INET:
|
case INET:
|
||||||
|
Loading…
Reference in New Issue
Block a user