@@ -47,7 +47,7 @@ public final class DnsNameResolverBuilder {
47
47
static final SocketAddress DEFAULT_LOCAL_ADDRESS = new InetSocketAddress (0 );
48
48
49
49
volatile EventLoop eventLoop ;
50
- private ChannelFactory <? extends DatagramChannel > channelFactory ;
50
+ private ChannelFactory <? extends DatagramChannel > datagramChannelFactory ;
51
51
private ChannelFactory <? extends SocketChannel > socketChannelFactory ;
52
52
private boolean retryOnTimeout ;
53
53
@@ -105,40 +105,75 @@ public DnsNameResolverBuilder eventLoop(EventLoop eventLoop) {
105
105
return this ;
106
106
}
107
107
108
- protected ChannelFactory <? extends DatagramChannel > channelFactory () {
109
- return this .channelFactory ;
108
+ ChannelFactory <? extends DatagramChannel > datagramChannelFactory () {
109
+ return this .datagramChannelFactory ;
110
110
}
111
111
112
112
/**
113
113
* Sets the {@link ChannelFactory} that will create a {@link DatagramChannel}.
114
+ * <p>
114
115
* If <a href="https://tools.ietf.org/html/rfc7766">TCP fallback</a> should be supported as well it is required
115
116
* to call the {@link #socketChannelFactory(ChannelFactory) or {@link #socketChannelType(Class)}} method.
116
117
*
117
- * @param channelFactory the {@link ChannelFactory}
118
+ * @param datagramChannelFactory the {@link ChannelFactory}
118
119
* @return {@code this}
120
+ * @deprecated use {@link #datagramChannelFactory(ChannelFactory)}
119
121
*/
120
- public DnsNameResolverBuilder channelFactory (ChannelFactory <? extends DatagramChannel > channelFactory ) {
121
- this .channelFactory = channelFactory ;
122
+ @ Deprecated
123
+ public DnsNameResolverBuilder channelFactory (ChannelFactory <? extends DatagramChannel > datagramChannelFactory ) {
124
+ datagramChannelFactory (datagramChannelFactory );
125
+ return this ;
126
+ }
127
+
128
+ /**
129
+ * Sets the {@link ChannelFactory} that will create a {@link DatagramChannel}.
130
+ * <p>
131
+ * If <a href="https://tools.ietf.org/html/rfc7766">TCP fallback</a> should be supported as well it is required
132
+ * to call the {@link #socketChannelFactory(ChannelFactory) or {@link #socketChannelType(Class)}} method.
133
+ *
134
+ * @param datagramChannelFactory the {@link ChannelFactory}
135
+ * @return {@code this}
136
+ */
137
+ public DnsNameResolverBuilder datagramChannelFactory (
138
+ ChannelFactory <? extends DatagramChannel > datagramChannelFactory ) {
139
+ this .datagramChannelFactory = datagramChannelFactory ;
122
140
return this ;
123
141
}
124
142
125
143
/**
126
144
* Sets the {@link ChannelFactory} as a {@link ReflectiveChannelFactory} of this type.
127
145
* Use as an alternative to {@link #channelFactory(ChannelFactory)}.
146
+ * <p>
128
147
* If <a href="https://tools.ietf.org/html/rfc7766">TCP fallback</a> should be supported as well it is required
129
148
* to call the {@link #socketChannelFactory(ChannelFactory) or {@link #socketChannelType(Class)}} method.
130
149
*
131
150
* @param channelType the type
132
151
* @return {@code this}
152
+ * @deprecated use {@link #datagramChannelType(Class)}
133
153
*/
154
+ @ Deprecated
134
155
public DnsNameResolverBuilder channelType (Class <? extends DatagramChannel > channelType ) {
135
- return channelFactory (new ReflectiveChannelFactory <DatagramChannel >(channelType ));
156
+ return datagramChannelFactory (new ReflectiveChannelFactory <DatagramChannel >(channelType ));
157
+ }
158
+
159
+ /**
160
+ * Sets the {@link ChannelFactory} as a {@link ReflectiveChannelFactory} of this type.
161
+ * Use as an alternative to {@link #datagramChannelFactory(ChannelFactory)}.
162
+ * <p>
163
+ * If <a href="https://tools.ietf.org/html/rfc7766">TCP fallback</a> should be supported as well it is required
164
+ * to call the {@link #socketChannelFactory(ChannelFactory) or {@link #socketChannelType(Class)}} method.
165
+ *
166
+ * @param channelType the type
167
+ * @return {@code this}
168
+ */
169
+ public DnsNameResolverBuilder datagramChannelType (Class <? extends DatagramChannel > channelType ) {
170
+ return datagramChannelFactory (new ReflectiveChannelFactory <DatagramChannel >(channelType ));
136
171
}
137
172
138
173
/**
139
174
* Sets the {@link ChannelFactory} that will create a {@link SocketChannel} for
140
175
* <a href="https://tools.ietf.org/html/rfc7766">TCP fallback</a> if needed.
141
- *
176
+ * <p>
142
177
* TCP fallback is <strong>not</strong> enabled by default and must be enabled by providing a non-null
143
178
* {@link ChannelFactory} for this method.
144
179
*
@@ -155,7 +190,7 @@ public DnsNameResolverBuilder socketChannelFactory(ChannelFactory<? extends Sock
155
190
* Sets the {@link ChannelFactory} as a {@link ReflectiveChannelFactory} of this type for
156
191
* <a href="https://tools.ietf.org/html/rfc7766">TCP fallback</a> if needed.
157
192
* Use as an alternative to {@link #socketChannelFactory(ChannelFactory)}.
158
- *
193
+ * <p>
159
194
* TCP fallback is <strong>not</strong> enabled by default and must be enabled by providing a non-null
160
195
* {@code channelType} for this method.
161
196
*
@@ -170,7 +205,7 @@ public DnsNameResolverBuilder socketChannelType(Class<? extends SocketChannel> c
170
205
/**
171
206
* Sets the {@link ChannelFactory} that will create a {@link SocketChannel} for
172
207
* <a href="https://tools.ietf.org/html/rfc7766">TCP fallback</a> if needed.
173
- *
208
+ * <p>
174
209
* TCP fallback is <strong>not</strong> enabled by default and must be enabled by providing a non-null
175
210
* {@link ChannelFactory} for this method.
176
211
*
@@ -193,7 +228,7 @@ public DnsNameResolverBuilder socketChannelFactory(
193
228
* Sets the {@link ChannelFactory} as a {@link ReflectiveChannelFactory} of this type for
194
229
* <a href="https://tools.ietf.org/html/rfc7766">TCP fallback</a> if needed.
195
230
* Use as an alternative to {@link #socketChannelFactory(ChannelFactory)}.
196
- *
231
+ * <p>
197
232
* TCP fallback is <strong>not</strong> enabled by default and must be enabled by providing a non-null
198
233
* {@code channelType} for this method.
199
234
*
@@ -603,7 +638,7 @@ public DnsNameResolver build() {
603
638
604
639
return new DnsNameResolver (
605
640
eventLoop ,
606
- channelFactory ,
641
+ datagramChannelFactory ,
607
642
socketChannelFactory ,
608
643
retryOnTimeout ,
609
644
resolveCache ,
@@ -640,8 +675,8 @@ public DnsNameResolverBuilder copy() {
640
675
copiedBuilder .eventLoop (eventLoop );
641
676
}
642
677
643
- if (channelFactory != null ) {
644
- copiedBuilder .channelFactory ( channelFactory );
678
+ if (datagramChannelFactory != null ) {
679
+ copiedBuilder .datagramChannelFactory ( datagramChannelFactory );
645
680
}
646
681
647
682
copiedBuilder .socketChannelFactory (socketChannelFactory , retryOnTimeout );
0 commit comments