On 1/5/11 8:53 AM, Matthew Swift wrote:
> Thanks Ryan.
>
> Thanks very much for doing this. I've integrated the changes into our
> LDAP SDK and all looks good.
>
> I have noticed a couple of problems:
>
> 1. Some of the setters in NIOTransportBuilder do not forward their
> settings to the underlying transport and, therefore, have no effect:
>
> setName
> setProcessor
> setProcessorSelector
> setReadBufferSize
> setWriteBufferSize
>
Oops. I got distracted there and didn't do the proper cleanup after
generating the methods. This has been fixed.
> 1.
>
>
> 2. It is not possible to configure the IOStrategy to anything other
> than SameThreadStrategy since, for example, the
> WorkerThreadStrategy requires an Executor during construction,
> and this is provided by the NIOTransport, i.e. only after the
> NIOTransportFactory.build() method has been called. Here's my
> thoughts on how to solve this:
>
> * Is an NIOTransportBuilder intended for creating multiple
> NIOTransports? If this is the case then the IOStrategy
> that it references will be shared amongst potentially
> multiple NIOTransports. If the IOStrategy contains an
> Executor then this Executor will be shared: it probably
> shouldn't.
>
> * If the Transport owns the WorkerThreadPool then it would
> seem reasonable for the IOStrategy to obtain the worker
> thread pool from the connection's transport using code
> like this:
>
> connection.getTransport().getThreadPool().execute(...);
>
> In this case it would not need to maintain a reference to
> the thread pool itself allowing strategies to be shared
> (see previous point).
>
> By the way, it might be good to rename methods like
> getThreadPool to getWorkerThreadPool for consistency with
> getWorkerThreadPoolConfig.
>
Looking into this now.
Thanks again!
>
> I hope this helps :-)
>
> Matt
>
>
>
>
> On 05/01/11 02:33, Ryan Lubke wrote:
>> Hi Matt,
>>
>> Changes based on your feedback have been applied to the repository (a
>> take on option 2 below).
>>
>> Please follow up here if you have additional feedback.
>>
>> Thanks for keeping an eye on this.
>>
>> -rl
>>
>> On 1/4/11 7:06 AM, Matthew Swift wrote:
>>> +1 from me FWIW. I'm not sure I see the value of the reflection
>>> based approach.
>>>
>>> Generic property based configuration results in a high degree of
>>> abstract and flexibility at the cost of usability and type safety.
>>> With properties, the app developer has to search high and low on the
>>> web in order to find the correct combination of properties to use
>>> for their implementation, and even then they are not sure if the
>>> options they have provided contain valid values or if they are even
>>> being ignored (e.g. typo in the property name). Anyone who has used
>>> JNDI or SASL in Java will have hit this hurdle already.
>>>
>>> At least with a reflection based approach the user will know if they
>>> have mispelled an option name, but I'm not sure that the error they
>>> get back will be very helpful. :-)
>>>
>>> One issue with method chaining you may come across is that the
>>> common setters (e.g. setIOStrategy) lose type information: they
>>> return an NIOTransportBuilder and not the sub-type (e.g.
>>> TCPNIOTransportBuilder). This means that an application will not be
>>> able to do this:
>>>
>>> TCPNIOTransportBuilder.newInstance().setIOStrategy(...).setTCPNoDelay(true).build();
>>>
>>> Since setTCPNoDelay() does not exist for generic NIOTransportBuilders.
>>>
>>> Nor will this work:
>>>
>>> TCPNIOTransport t =
>>> TCPNIOTransportBuilder.newInstance().setTCPNoDelay(true).setIOStrategy(...).build();
>>>
>>> Since the setIOStrategy() will lose the type information causing the
>>> build to return an NIOTransport.
>>>
>>> There are two possible solutions AFAIK:
>>>
>>> 1. Make all the chaining setters abstract in NIOTransportBuilder
>>> and define them all in their sub-classes. This results in lots
>>> of duplicated setter implementations (except for the return
>>> type) in the sub-classes.
>>>
>>> 2. Use generics to force the return type:
>>>
>>> public abstract class NIOTransportBuilder<T extends
>>> NIOTransportBuilder> {
>>>
>>> public final T setIOStrategy(IOStrategy strategy) {
>>> this.strategy = strategy;
>>> return getThis();
>>> }
>>>
>>> @SuppressWarnings("unchecked")
>>> protected T getThis() { return (T) this; }
>>> }
>>>
>>> public class TCPNIOTransportBuilder<T extends
>>> TCPNIOTransportBuilder>
>>> extends NIOTransportBuilder<T> {
>>>
>>> public final T setTCPNoDelay(boolean tcpNoDelay) {
>>> this.tcpNoDelay = tcpNoDelay;
>>> return getThis();
>>> }
>>>
>>> }
>>>
>>> // 3rd party derived sub-class.
>>> public class MyAppTCPNIOTransportBuilder extends
>>> TCPNIOTransportBuilder<MyAppTCPNIOTransportBuilder> {
>>>
>>> }
>>>
>>> Neither are ideal. The second works but looks a bit ugly with the
>>> generics and exposes the generics in the Javadoc. In the past I have
>>> used a combination of both approaches, but this may be a bit
>>> overkill here. There's probably a clever design pattern somewhere
>>> that covers this, but I have not come across it. :-)
>>>
>>> Matt
>>>
>>> On 04/01/11 15:12, Justin Lee wrote:
>>>> I'm not sure introducing a reflection based API is the best idea.
>>>> If we're already returning covariant subclasses, I don't see much
>>>> need for a generalized reflection based approach. Any subclass
>>>> returned will already expose the methods it needs to be
>>>> configured. Reflection makes refactoring so much more difficult.
>>>> I've been working so hard to get rid of what I can from the grizzly
>>>> config and glassfish classes. Please don't introduce more. :)
>>>>
>>>> On 1/4/11 8:19 AM, Oleksiy Stashok wrote:
>>>>> Hi Matt,
>>>>>
>>>>> it was an initial implementation from Ryan and it was commited
>>>>> exactly to get a feedback, so I'm glad you follow this! :))
>>>>>
>>>>>
>>>>>> While I can create a NIOTransportBuilder which can be used to
>>>>>> construct new TCP NIO transports, I am unable to fully configure
>>>>>> them as far as I can see. For example, I can configure things
>>>>>> like the strategy and the thread pool configuration, but I am not
>>>>>> able to configure features like keep alive, TCP no delay, etc.
>>>>>> It would be nice to be able to be able to do this.
>>>>>>
>>>>>> Obviously these are transport protocol specific (UDP, TCP), which
>>>>>> brings me onto the next point (albeit minor): the build method
>>>>>> loses type information forcing application to have to do stuff
>>>>>> like this:
>>>>>> final TCPNIOTransport transport =
>>>>>> (TCPNIOTransport)
>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>> Yesterday Ryan and me were discussing approach like:
>>>>>
>>>>> final TCPNIOTransport transport =
>>>>> NIOTransportBuilder.newInstance(TCPNIOTransport.class).setXXX()....build();
>>>>>
>>>>> which lets us avoid casting and make builder implementation
>>>>> pluggable for custom transports.
>>>>> To set custom transport attributes like "tcp no delay", we can use
>>>>> general setAttribute(name, value) method, which will work using
>>>>> reflections like:
>>>>>
>>>>> NIOTransportBuilder.newInstance(TCPNIOTransport.class).setAttribute("tcpNoDelay",
>>>>> true).build();
>>>>>
>>>>> And giving your idea...
>>>>>
>>>>>> Therefore, could you consider providing a class hierarchy
>>>>>> (NIOTransportBuilder, TCPNIOTransportBuilder,
>>>>>> UDPNIOTransportBuilder) using a covariant return type for the
>>>>>> build() method? The sub-classes could provide protocol specific
>>>>>> setters for things like TCP no delay, etc. For example:
>>>>>> public abstract class NIOTransportBuilder {
>>>>>>
>>>>>> // Override and use covariance.
>>>>>> public abstract NIOTransport build();
>>>>>>
>>>>>> // Getters/setters common to both TCP and UDP.
>>>>>> public NIOTransportBuilder setIOStrategy(IOStrategy strategy)
>>>>>> { ... }
>>>>>>
>>>>>> ...
>>>>>> }
>>>>>>
>>>>>> public class TCPNIOTransportBuilder extends NIOTransportBuilder {
>>>>>>
>>>>>> // Use covariance.
>>>>>> public TCPNIOTransport build() { ... }
>>>>>>
>>>>>> // Getters/setters specific to TCP.
>>>>>> public TCPNIOTransportBuilder setTcpNoDelay(final boolean
>>>>>> tcpNoDelay) { ... }
>>>>>>
>>>>>> ...
>>>>>> }
>>>>> We can support both options.
>>>>>
>>>>> General:
>>>>> NIOTransportBuilder.newInstance(TCPNIOTransport.class).setAttribute("tcpNoDelay",
>>>>> true).build();
>>>>>
>>>>> Specific:
>>>>> TCPNIOTransportBuilder.newInstance().setTcpNoDelay(true);
>>>>>
>>>>>
>>>>> we can also consider to refactor this to:
>>>>>
>>>>> General:
>>>>> NIOTransport.builder(TCPNIOTransport.class).setAttribute("tcpNoDelay",
>>>>> true).build();
>>>>>
>>>>> Specific:
>>>>> TCPNIOTransport.builder().setTcpNoDelay(true);
>>>>>
>>>>>> This will allow transport configuration to be fully decoupled
>>>>>> from instantiation which I think is important if instantiation is
>>>>>> performed within a library out of reach from the application code.
>>>>>>
>>>>>> Does this make sense?
>>>>> Sure :)
>>>>>
>>>>> WBR,
>>>>> Alexey.
>>>>>
>>>>>>
>>>>>> Matt
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 03/01/11 23:58, rlubke_at_java.net wrote:
>>>>>>>
>>>>>>> Project: grizzly
>>>>>>> Repository: svn
>>>>>>> Revision: 5606
>>>>>>> Author: rlubke
>>>>>>> Date: 2011-01-03 22:58:01 UTC
>>>>>>> Link:
>>>>>>>
>>>>>>> Log Message:
>>>>>>> ------------
>>>>>>> - remove TransportFactory in favor of leveraging the builder
>>>>>>> pattern (NIOTransportBuilder) instead.
>>>>>>> * removed the concept of a global thread pool that was
>>>>>>> maintained by the
>>>>>>> TransportFactory.
>>>>>>> * Each transport will now have it's own pool for
>>>>>>> SelectorRunners only and,
>>>>>>> depending on the IOStrategy being used, a separate pool for
>>>>>>> worker threads.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Revisions:
>>>>>>> ----------
>>>>>>> 5606
>>>>>>>
>>>>>>>
>>>>>>> Modified Paths:
>>>>>>> ---------------
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLEncoderTransformer.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/AbstractTransport.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/strategies/WorkerThreadIOStrategy.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/memory/Buffers.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/nio/SelectorRunner.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/StandaloneTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/IdleConnectionFilterTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/HttpResponseStreamsTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/nio/NIOTransport.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/memory/MemoryUtils.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/SSLTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/websockets/src/main/java/org/glassfish/grizzly/websockets/frame/FixedLengthFrame.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/UDPNIOTransportTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/threadpool/GrizzlyExecutorService.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpRequestParseTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/KeepAliveTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/SkipRemainderTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLDecoderTransformer.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/websockets/src/main/java/org/glassfish/grizzly/websockets/SecKey.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/nio/transport/UDPNIOTransport.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/Transport.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/config/src/main/java/org/glassfish/grizzly/config/GenericGrizzlyListener.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/CompositeBufferTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/rcm/src/test/java/org/glassfish/grizzly/rcm/RCMTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/websockets/src/test/java/org/glassfish/grizzly/websockets/WebSocketsHandshakeTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/ByteBufferStreamsTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/zip/GZipEncoder.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/AbstractTransformer.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpResponseParseTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/websockets/src/test/java/org/glassfish/grizzly/websockets/WSCommTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http/src/main/java/org/glassfish/grizzly/http/Cookie.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/ProtocolChainCodecTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/strategies/SameThreadIOStrategy.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/BuffersBufferTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/TCPNIOTransportTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/GZipTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/websockets/src/main/java/org/glassfish/grizzly/websockets/frame/StreamFrame.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/JmxBasicTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/URIDecoderTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/CompositeBufferInStreamTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/portunif/src/test/java/org/glassfish/grizzly/portunif/BasicPUTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http-server/src/main/java/org/glassfish/grizzly/http/server/HttpServer.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/NIOInputSourcesTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/nio/transport/TCPNIOTransport.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpCommTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/HttpInputStreamsTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http-server/src/main/java/org/glassfish/grizzly/http/server/NetworkListener.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/NIOOutputSinksTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/websockets/src/test/java/org/glassfish/grizzly/websockets/WSSCommTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/memory/BuffersBuffer.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/ContentTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/GZipEncodingTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/FilterChainTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpSemanticsTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/portunif/src/test/java/org/glassfish/grizzly/portunif/SSLAndPlainTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/config/src/main/java/org/glassfish/grizzly/config/GrizzlyConfig.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/AsyncWriteQueueTest.java
>>>>>>>
>>>>>>> branches/2dot0/code/modules/grizzly/src/test/java/org/glassfish/grizzly/FilterChainReadTest.java
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Added Paths:
>>>>>>> ------------
>>>>>>> branches/2dot0/code/modules/grizzly/src/main/java/org/glassfish/grizzly/NIOTransportBuilder.java
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Diffs:
>>>>>>> ------
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/GZipEncodingTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/GZipEncodingTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/GZipEncodingTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -43,7 +43,7 @@
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChain;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> @@ -120,14 +120,14 @@
>>>>>>> result.setStatusCode(200);
>>>>>>> result.addHeader("content-encoding", "gzip");
>>>>>>>
>>>>>>> - final MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + final MemoryManager mm =
>>>>>>> NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>> result.setContent(Buffers.wrap(mm, "Echo: <nothing>"));
>>>>>>> doTest(request, result, gzipServerContentEncoding, null);
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> public void testGZipRequest() throws Throwable {
>>>>>>> - final MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + final MemoryManager mm =
>>>>>>> NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>>
>>>>>>> String reqString = "GZipped hello. Works?";
>>>>>>> ByteArrayOutputStream baos = new ByteArrayOutputStream();
>>>>>>> @@ -176,7 +176,7 @@
>>>>>>> }
>>>>>>> });
>>>>>>>
>>>>>>> - final MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + final MemoryManager mm =
>>>>>>> NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>>
>>>>>>> String reqString = generateBigString(16384);
>>>>>>> ByteArrayOutputStream baos = new ByteArrayOutputStream();
>>>>>>> @@ -225,7 +225,7 @@
>>>>>>> }
>>>>>>> });
>>>>>>>
>>>>>>> - final MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + final MemoryManager mm =
>>>>>>> NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>>
>>>>>>> String reqString = generateBigString(16384);
>>>>>>> ByteArrayOutputStream baos = new ByteArrayOutputStream();
>>>>>>> @@ -288,10 +288,10 @@
>>>>>>> filterChainBuilder.add(new SimpleResponseFilter());
>>>>>>> FilterChain filterChain = filterChainBuilder.build();
>>>>>>>
>>>>>>> - TCPNIOTransport transport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport transport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> transport.setProcessor(filterChain);
>>>>>>>
>>>>>>> - TCPNIOTransport ctransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport ctransport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> try {
>>>>>>> transport.bind(PORT);
>>>>>>> transport.start();
>>>>>>> @@ -327,7 +327,6 @@
>>>>>>> } finally {
>>>>>>> transport.stop();
>>>>>>> ctransport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> reportThreadErrors();
>>>>>>> }
>>>>>>> }
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpRequestParseTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpRequestParseTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpRequestParseTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -40,6 +40,7 @@
>>>>>>>
>>>>>>> package org.glassfish.grizzly.http.core;
>>>>>>>
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.http.HttpPacket;
>>>>>>> import org.glassfish.grizzly.http.HttpContent;
>>>>>>> import org.glassfish.grizzly.http.HttpRequestPacket;
>>>>>>> @@ -47,7 +48,6 @@
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> import org.glassfish.grizzly.StandaloneProcessor;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainContext;
>>>>>>> @@ -165,7 +165,7 @@
>>>>>>> @SuppressWarnings({"unchecked"})
>>>>>>> private HttpPacket doTestDecoder(String request, int limit) {
>>>>>>>
>>>>>>> - MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + MemoryManager mm =
>>>>>>> NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>> Buffer input = Buffers.wrap(mm, request);
>>>>>>>
>>>>>>> HttpServerFilter filter = new HttpServerFilter(true,
>>>>>>> limit, null, null);
>>>>>>> @@ -196,7 +196,7 @@
>>>>>>> filterChainBuilder.add(new
>>>>>>> HTTPRequestCheckFilter(parseResult,
>>>>>>> method, requestURI, protocol,
>>>>>>> Collections.<String, Pair<String, String>>emptyMap()));
>>>>>>>
>>>>>>> - TCPNIOTransport transport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport transport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> transport.setProcessor(filterChainBuilder.build());
>>>>>>>
>>>>>>> try {
>>>>>>> @@ -235,7 +235,6 @@
>>>>>>> }
>>>>>>>
>>>>>>> transport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> @@ -287,7 +286,7 @@
>>>>>>> private final SocketAddress peerAddress;
>>>>>>>
>>>>>>> public StandaloneConnection() {
>>>>>>> -
>>>>>>> super(TransportFactory.getInstance().createTCPTransport());
>>>>>>> +
>>>>>>> super(NIOTransportBuilder.defaultTCPTransportBuilder().build());
>>>>>>> localAddress = new InetSocketAddress("127.0.0.1", 0);
>>>>>>> peerAddress = new InetSocketAddress("127.0.0.1", 0);
>>>>>>> }
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/URIDecoderTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/URIDecoderTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/URIDecoderTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -40,10 +40,10 @@
>>>>>>>
>>>>>>> package org.glassfish.grizzly.http.core;
>>>>>>>
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.http.util.URLDecoder;
>>>>>>> import org.glassfish.grizzly.http.util.DataChunk;
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.memory.MemoryManager;
>>>>>>> import java.net.URLEncoder;
>>>>>>> import java.nio.charset.Charset;
>>>>>>> @@ -75,7 +75,7 @@
>>>>>>> @SuppressWarnings({"unchecked"})
>>>>>>> private void testDecoder(String inputURI) throws Exception {
>>>>>>>
>>>>>>> - MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + MemoryManager mm =
>>>>>>> NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>> String encodedURI = URLEncoder.encode(inputURI,
>>>>>>> UTF8_CHARSET.name());
>>>>>>>
>>>>>>> Buffer b = Buffers.wrap(mm, encodedURI);
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpSemanticsTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpSemanticsTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpSemanticsTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -43,7 +43,7 @@
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.EmptyCompletionHandler;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.WriteResult;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.Filter;
>>>>>>> @@ -287,9 +287,9 @@
>>>>>>> filterChainBuilder.add(serverFilter);
>>>>>>> FilterChain filterChain = filterChainBuilder.build();
>>>>>>>
>>>>>>> - TCPNIOTransport transport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport transport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> transport.setProcessor(filterChain);
>>>>>>> - TCPNIOTransport ctransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport ctransport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> try {
>>>>>>> transport.bind(PORT);
>>>>>>> transport.start();
>>>>>>> @@ -319,7 +319,6 @@
>>>>>>> } finally {
>>>>>>> transport.stop();
>>>>>>> ctransport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> reportThreadErrors();
>>>>>>> }
>>>>>>> }
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpResponseParseTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpResponseParseTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpResponseParseTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -40,6 +40,7 @@
>>>>>>>
>>>>>>> package org.glassfish.grizzly.http.core;
>>>>>>>
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.http.HttpPacket;
>>>>>>> import org.glassfish.grizzly.http.HttpContent;
>>>>>>> import org.glassfish.grizzly.http.HttpResponsePacket;
>>>>>>> @@ -47,7 +48,6 @@
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> import org.glassfish.grizzly.StandaloneProcessor;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainContext;
>>>>>>> @@ -166,7 +166,7 @@
>>>>>>> @SuppressWarnings({"unchecked"})
>>>>>>> private HttpPacket doTestDecoder(String response, int limit) {
>>>>>>>
>>>>>>> - MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + MemoryManager mm =
>>>>>>> NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>> Buffer input = Buffers.wrap(mm, response);
>>>>>>>
>>>>>>> HttpClientFilter filter = new HttpClientFilter(limit);
>>>>>>> @@ -197,7 +197,7 @@
>>>>>>> filterChainBuilder.add(new
>>>>>>> HTTPResponseCheckFilter(parseResult,
>>>>>>> protocol, code, phrase, Collections.<String,
>>>>>>> Pair<String, String>>emptyMap()));
>>>>>>>
>>>>>>> - TCPNIOTransport transport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport transport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> transport.setProcessor(filterChainBuilder.build());
>>>>>>>
>>>>>>> try {
>>>>>>> @@ -237,7 +237,6 @@
>>>>>>> }
>>>>>>>
>>>>>>> transport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> @@ -285,7 +284,7 @@
>>>>>>>
>>>>>>> protected static final class StandaloneConnection extends
>>>>>>> NIOConnection {
>>>>>>> public StandaloneConnection() {
>>>>>>> -
>>>>>>> super(TransportFactory.getInstance().createTCPTransport());
>>>>>>> +
>>>>>>> super(NIOTransportBuilder.defaultTCPTransportBuilder().build());
>>>>>>> }
>>>>>>>
>>>>>>> @Override
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/ContentTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/ContentTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/ContentTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -40,9 +40,9 @@
>>>>>>>
>>>>>>> package org.glassfish.grizzly.http.core;
>>>>>>>
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.http.HttpRequestPacket;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.WriteResult;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChain;
>>>>>>> @@ -82,7 +82,7 @@
>>>>>>> public void testExplicitContentLength() throws Exception {
>>>>>>> HttpRequestPacket httpRequest =
>>>>>>> HttpRequestPacket.builder().method("POST").protocol(Protocol.HTTP_1_1).uri("/default").contentLength(10).build();
>>>>>>> httpRequest.addHeader("Host", "localhost:" + PORT);
>>>>>>> - HttpContent content =
>>>>>>> httpRequest.httpContentBuilder().content(Buffers.wrap(TransportFactory.getInstance().getDefaultMemoryManager(),
>>>>>>> "1234567890")).build();
>>>>>>> + HttpContent content =
>>>>>>> httpRequest.httpContentBuilder().content(Buffers.wrap(NIOTransportBuilder.DEFAULT_MEMORY_MANAGER,
>>>>>>> "1234567890")).build();
>>>>>>>
>>>>>>> doHttpRequestTest(content);
>>>>>>> }
>>>>>>> @@ -91,7 +91,7 @@
>>>>>>> public void testHeaderContentLength() throws Exception {
>>>>>>> HttpRequestPacket httpRequest =
>>>>>>> HttpRequestPacket.builder().method("POST").protocol(Protocol.HTTP_1_1).uri("/default").header("Content-Length",
>>>>>>> "10").build();
>>>>>>> httpRequest.addHeader("Host", "localhost:" + PORT);
>>>>>>> - HttpContent content =
>>>>>>> httpRequest.httpContentBuilder().content(Buffers.wrap(TransportFactory.getInstance().getDefaultMemoryManager(),
>>>>>>> "1234567890")).build();
>>>>>>> + HttpContent content =
>>>>>>> httpRequest.httpContentBuilder().content(Buffers.wrap(NIOTransportBuilder.DEFAULT_MEMORY_MANAGER,
>>>>>>> "1234567890")).build();
>>>>>>>
>>>>>>> doHttpRequestTest(content);
>>>>>>> }
>>>>>>> @@ -100,7 +100,7 @@
>>>>>>> public void testSimpleChunked() throws Exception {
>>>>>>> HttpRequestPacket httpRequest =
>>>>>>> HttpRequestPacket.builder().method("POST").protocol(Protocol.HTTP_1_1).uri("/default").chunked(true).build();
>>>>>>> httpRequest.addHeader("Host", "localhost:" + PORT);
>>>>>>> - HttpContent content =
>>>>>>> httpRequest.httpTrailerBuilder().content(Buffers.wrap(TransportFactory.getInstance().getDefaultMemoryManager(),
>>>>>>> "1234567890")).build();
>>>>>>> + HttpContent content =
>>>>>>> httpRequest.httpTrailerBuilder().content(Buffers.wrap(NIOTransportBuilder.DEFAULT_MEMORY_MANAGER,
>>>>>>> "1234567890")).build();
>>>>>>>
>>>>>>> doHttpRequestTest(content);
>>>>>>> }
>>>>>>> @@ -109,9 +109,9 @@
>>>>>>> public void testSeveralChunked() throws Exception {
>>>>>>> HttpRequestPacket httpRequest =
>>>>>>> HttpRequestPacket.builder().method("POST").protocol(Protocol.HTTP_1_1).uri("/default").chunked(true).build();
>>>>>>> httpRequest.addHeader("Host", "localhost:" + PORT);
>>>>>>> - HttpContent content1 =
>>>>>>> httpRequest.httpContentBuilder().content(Buffers.wrap(TransportFactory.getInstance().getDefaultMemoryManager(),
>>>>>>> "1234567890")).build();
>>>>>>> - HttpContent content2 =
>>>>>>> httpRequest.httpContentBuilder().content(Buffers.wrap(TransportFactory.getInstance().getDefaultMemoryManager(),
>>>>>>> "0987654321")).build();
>>>>>>> - HttpContent content3 =
>>>>>>> httpRequest.httpTrailerBuilder().content(Buffers.wrap(TransportFactory.getInstance().getDefaultMemoryManager(),
>>>>>>> "final")).build();
>>>>>>> + HttpContent content1 =
>>>>>>> httpRequest.httpContentBuilder().content(Buffers.wrap(NIOTransportBuilder.DEFAULT_MEMORY_MANAGER,
>>>>>>> "1234567890")).build();
>>>>>>> + HttpContent content2 =
>>>>>>> httpRequest.httpContentBuilder().content(Buffers.wrap(NIOTransportBuilder.DEFAULT_MEMORY_MANAGER,
>>>>>>> "0987654321")).build();
>>>>>>> + HttpContent content3 =
>>>>>>> httpRequest.httpTrailerBuilder().content(Buffers.wrap(NIOTransportBuilder.DEFAULT_MEMORY_MANAGER,
>>>>>>> "final")).build();
>>>>>>>
>>>>>>> doHttpRequestTest(content1, content2, content3);
>>>>>>> }
>>>>>>> @@ -130,7 +130,7 @@
>>>>>>> filterChainBuilder.add(new
>>>>>>> HTTPRequestMergerFilter(parseResult));
>>>>>>> FilterChain filterChain = filterChainBuilder.build();
>>>>>>>
>>>>>>> - TCPNIOTransport transport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport transport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> transport.setProcessor(filterChain);
>>>>>>>
>>>>>>> try {
>>>>>>> @@ -179,7 +179,6 @@
>>>>>>> }
>>>>>>>
>>>>>>> transport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpCommTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpCommTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http/src/test/java/org/glassfish/grizzly/http/core/HttpCommTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -40,13 +40,13 @@
>>>>>>>
>>>>>>> package org.glassfish.grizzly.http.core;
>>>>>>>
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.http.HttpClientFilter;
>>>>>>> import org.glassfish.grizzly.http.HttpContent;
>>>>>>> import org.glassfish.grizzly.http.HttpPacket;
>>>>>>> import org.glassfish.grizzly.http.HttpRequestPacket;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.WriteResult;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChain;
>>>>>>> @@ -91,7 +91,7 @@
>>>>>>> serverFilterChainBuilder.add(new HttpServerFilter());
>>>>>>> serverFilterChainBuilder.add(new DummyServerFilter());
>>>>>>>
>>>>>>> - TCPNIOTransport transport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport transport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> transport.setProcessor(serverFilterChainBuilder.build());
>>>>>>>
>>>>>>> Connection connection = null;
>>>>>>> @@ -142,7 +142,6 @@
>>>>>>> }
>>>>>>>
>>>>>>> transport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http/src/main/java/org/glassfish/grizzly/http/Cookie.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http/src/main/java/org/glassfish/grizzly/http/Cookie.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http/src/main/java/org/glassfish/grizzly/http/Cookie.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -59,7 +59,7 @@
>>>>>>> package org.glassfish.grizzly.http;
>>>>>>>
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.http.util.CookieSerializerUtils;
>>>>>>> import org.glassfish.grizzly.memory.MemoryManager;
>>>>>>>
>>>>>>> @@ -547,7 +547,7 @@
>>>>>>>
>>>>>>> public Buffer asServerCookieBuffer(MemoryManager
>>>>>>> memoryManager) {
>>>>>>> if (memoryManager == null) memoryManager =
>>>>>>> -
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>>
>>>>>>> final Buffer buffer = memoryManager.allocate(4096);
>>>>>>> CookieSerializerUtils.serializeServerCookie(buffer, this);
>>>>>>> @@ -568,7 +568,7 @@
>>>>>>>
>>>>>>> public Buffer asClientCookieBuffer(MemoryManager
>>>>>>> memoryManager) {
>>>>>>> if (memoryManager == null) memoryManager =
>>>>>>> -
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>>
>>>>>>> final Buffer buffer = memoryManager.allocate(4096);
>>>>>>> CookieSerializerUtils.serializeClientCookies(buffer,
>>>>>>> this);
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/rcm/src/test/java/org/glassfish/grizzly/rcm/RCMTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/rcm/src/test/java/org/glassfish/grizzly/rcm/RCMTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/rcm/src/test/java/org/glassfish/grizzly/rcm/RCMTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2007-2010 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> + * Copyright (c) 2007-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -42,6 +42,8 @@
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import java.io.IOException;
>>>>>>> +
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainContext;
>>>>>>> import org.glassfish.grizzly.filterchain.NextAction;
>>>>>>> import java.io.BufferedReader;
>>>>>>> @@ -55,7 +57,6 @@
>>>>>>> import java.nio.charset.CharsetEncoder;
>>>>>>> import java.util.Date;
>>>>>>> import junit.framework.TestCase;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.TransportFilter;
>>>>>>> @@ -144,7 +145,7 @@
>>>>>>> }
>>>>>>> });
>>>>>>>
>>>>>>> - transport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + transport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> transport.setProcessor(filterChainBuilder.build());
>>>>>>>
>>>>>>> transport.bind(port);
>>>>>>> @@ -157,7 +158,6 @@
>>>>>>> @Override
>>>>>>> protected void tearDown() throws Exception {
>>>>>>> transport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>>
>>>>>>> public void testRCM() {
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/KeepAliveTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/KeepAliveTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/KeepAliveTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -43,8 +43,8 @@
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.EmptyCompletionHandler;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.SocketConnectorHandler;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainContext;
>>>>>>> @@ -90,7 +90,7 @@
>>>>>>>
>>>>>>> }, "/path");
>>>>>>>
>>>>>>> - final TCPNIOTransport clientTransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + final TCPNIOTransport clientTransport =
>>>>>>> (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> final HttpClient client = new HttpClient(clientTransport);
>>>>>>>
>>>>>>> try {
>>>>>>> @@ -123,7 +123,6 @@
>>>>>>> client.close();
>>>>>>> clientTransport.stop();
>>>>>>> server.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> @@ -142,7 +141,7 @@
>>>>>>>
>>>>>>> }, "/path");
>>>>>>>
>>>>>>> - final TCPNIOTransport clientTransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + final TCPNIOTransport clientTransport =
>>>>>>> (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> final HttpClient client = new HttpClient(clientTransport);
>>>>>>>
>>>>>>> try {
>>>>>>> @@ -186,7 +185,6 @@
>>>>>>> client.close();
>>>>>>> clientTransport.stop();
>>>>>>> server.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> @@ -208,7 +206,7 @@
>>>>>>> }, "/path");
>>>>>>>
>>>>>>> server.getListener("grizzly").getKeepAlive().setMaxRequestsCount(maxKeepAliveRequests);
>>>>>>>
>>>>>>> - final TCPNIOTransport clientTransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + final TCPNIOTransport clientTransport =
>>>>>>> (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> final HttpClient client = new HttpClient(clientTransport);
>>>>>>>
>>>>>>> try {
>>>>>>> @@ -253,7 +251,6 @@
>>>>>>> client.close();
>>>>>>> clientTransport.stop();
>>>>>>> server.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/NIOInputSourcesTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/NIOInputSourcesTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/NIOInputSourcesTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -43,7 +43,7 @@
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainContext;
>>>>>>> @@ -398,7 +398,7 @@
>>>>>>> throws Exception {
>>>>>>>
>>>>>>> final TCPNIOTransport clientTransport =
>>>>>>> -
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> final HttpServer server = createWebServer(httpHandler);
>>>>>>> try {
>>>>>>> server.start();
>>>>>>> @@ -463,7 +463,7 @@
>>>>>>>
>>>>>>> if (content != null) {
>>>>>>> HttpContent.Builder cb = request.httpContentBuilder();
>>>>>>> - MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + MemoryManager mm =
>>>>>>> NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>> Buffer contentBuffer;
>>>>>>> if (encoding != null) {
>>>>>>> try {
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/HttpResponseStreamsTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/HttpResponseStreamsTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/HttpResponseStreamsTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -43,7 +43,7 @@
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainContext;
>>>>>>> @@ -571,7 +571,7 @@
>>>>>>> sconfig.addHttpHandler(new TestHttpHandler(strategy),
>>>>>>> new String[] { "/*" });
>>>>>>>
>>>>>>> final FutureImpl<String> parseResult =
>>>>>>> SafeFutureImpl.create();
>>>>>>> - TCPNIOTransport ctransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport ctransport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> try {
>>>>>>> server.start();
>>>>>>>
>>>>>>> @@ -601,7 +601,6 @@
>>>>>>> } finally {
>>>>>>> server.stop();
>>>>>>> ctransport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/SkipRemainderTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/SkipRemainderTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/SkipRemainderTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -40,11 +40,11 @@
>>>>>>>
>>>>>>> package org.glassfish.grizzly.http.server;
>>>>>>>
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.memory.Buffers;
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.SocketConnectorHandler;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainContext;
>>>>>>> @@ -155,7 +155,7 @@
>>>>>>> final LinkedTransferQueue<Integer> transferQueue)
>>>>>>> throws Exception, InterruptedException {
>>>>>>>
>>>>>>> - final MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> + final MemoryManager mm =
>>>>>>> NIOTransportBuilder.DEFAULT_MEMORY_MANAGER;
>>>>>>>
>>>>>>> final int contentSizeHalf = content.length / 2;
>>>>>>>
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/HttpInputStreamsTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/HttpInputStreamsTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/HttpInputStreamsTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -43,7 +43,7 @@
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.Filter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> @@ -934,7 +934,7 @@
>>>>>>> @SuppressWarnings({"unchecked"})
>>>>>>> private HttpPacket createRequest(final String method, final
>>>>>>> String content) {
>>>>>>> final Buffer contentBuffer = content != null ?
>>>>>>> -
>>>>>>> Buffers.wrap(TransportFactory.getInstance().getDefaultMemoryManager(),
>>>>>>> content) :
>>>>>>> +
>>>>>>> Buffers.wrap(NIOTransportBuilder.DEFAULT_MEMORY_MANAGER, content) :
>>>>>>> null;
>>>>>>>
>>>>>>> HttpRequestPacket.Builder b = HttpRequestPacket.builder();
>>>>>>> @@ -974,7 +974,7 @@
>>>>>>> ServerConfiguration sconfig =
>>>>>>> server.getServerConfiguration();
>>>>>>> sconfig.addHttpHandler(new
>>>>>>> SimpleResponseHttpHandler(strategy, testResult), "/*");
>>>>>>>
>>>>>>> - TCPNIOTransport ctransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport ctransport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> try {
>>>>>>> server.start();
>>>>>>> FilterChainBuilder clientFilterChainBuilder =
>>>>>>> FilterChainBuilder.stateless();
>>>>>>> @@ -1001,7 +1001,6 @@
>>>>>>> } finally {
>>>>>>> server.stop();
>>>>>>> ctransport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/NIOOutputSinksTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/NIOOutputSinksTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http-server/src/test/java/org/glassfish/grizzly/http/server/NIOOutputSinksTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -42,7 +42,7 @@
>>>>>>>
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.asyncqueue.AsyncQueueWriter;
>>>>>>> import org.glassfish.grizzly.asyncqueue.TaskQueue;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> @@ -135,7 +135,7 @@
>>>>>>> });
>>>>>>>
>>>>>>>
>>>>>>> - final TCPNIOTransport clientTransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + final TCPNIOTransport clientTransport =
>>>>>>> (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> clientTransport.setProcessor(filterChainBuilder.build());
>>>>>>> final AtomicInteger writeCounter = new AtomicInteger();
>>>>>>> final AtomicBoolean callbackInvoked = new
>>>>>>> AtomicBoolean(false);
>>>>>>> @@ -230,7 +230,6 @@
>>>>>>> } finally {
>>>>>>> clientTransport.stop();
>>>>>>> server.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>>
>>>>>>> }
>>>>>>> @@ -296,7 +295,7 @@
>>>>>>> });
>>>>>>>
>>>>>>>
>>>>>>> - final TCPNIOTransport clientTransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + final TCPNIOTransport clientTransport =
>>>>>>> (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> clientTransport.setProcessor(filterChainBuilder.build());
>>>>>>> final AtomicInteger writeCounter = new AtomicInteger();
>>>>>>> final AtomicBoolean callbackInvoked = new
>>>>>>> AtomicBoolean(false);
>>>>>>> @@ -394,7 +393,6 @@
>>>>>>> } finally {
>>>>>>> clientTransport.stop();
>>>>>>> server.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>>
>>>>>>> }
>>>>>>> @@ -442,7 +440,7 @@
>>>>>>> }
>>>>>>> });
>>>>>>>
>>>>>>> - final TCPNIOTransport clientTransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + final TCPNIOTransport clientTransport =
>>>>>>> (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> clientTransport.setProcessor(filterChainBuilder.build());
>>>>>>> final HttpHandler ga = new HttpHandler() {
>>>>>>>
>>>>>>> @@ -499,7 +497,6 @@
>>>>>>> } finally {
>>>>>>> clientTransport.stop();
>>>>>>> server.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http-server/src/main/java/org/glassfish/grizzly/http/server/NetworkListener.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http-server/src/main/java/org/glassfish/grizzly/http/server/NetworkListener.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http-server/src/main/java/org/glassfish/grizzly/http/server/NetworkListener.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2010 Oracle and/or its affiliates. All rights
>>>>>>> reserved.
>>>>>>> + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -42,7 +42,7 @@
>>>>>>>
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.Filter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChain;
>>>>>>> import org.glassfish.grizzly.http.ContentEncoding;
>>>>>>> @@ -117,7 +117,7 @@
>>>>>>> * The {_at_link TCPNIOTransport} used by this
>>>>>>> <code>NetworkListener</code>
>>>>>>> */
>>>>>>> private TCPNIOTransport transport =
>>>>>>> - TransportFactory.getInstance().createTCPTransport();
>>>>>>> + (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>>
>>>>>>>
>>>>>>> /**
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/http-server/src/main/java/org/glassfish/grizzly/http/server/HttpServer.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/http-server/src/main/java/org/glassfish/grizzly/http/server/HttpServer.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/http-server/src/main/java/org/glassfish/grizzly/http/server/HttpServer.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2008-2010 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> + * Copyright (c) 2008-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -42,6 +42,7 @@
>>>>>>>
>>>>>>> import org.glassfish.grizzly.ConnectionProbe;
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.Processor;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChain;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> @@ -58,7 +59,6 @@
>>>>>>> import java.util.logging.Level;
>>>>>>> import java.util.logging.Logger;
>>>>>>>
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.TransportProbe;
>>>>>>> import org.glassfish.grizzly.filterchain.TransportFilter;
>>>>>>> import org.glassfish.grizzly.http.ContentEncoding;
>>>>>>> @@ -391,7 +391,6 @@
>>>>>>> disableJMX();
>>>>>>> }
>>>>>>>
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> } catch (Exception e) {
>>>>>>> LOGGER.log(Level.WARNING, null, e);
>>>>>>> } finally {
>>>>>>> @@ -593,7 +592,7 @@
>>>>>>> @Override
>>>>>>> public Thread newThread(Runnable r) {
>>>>>>> final Thread newThread = new DefaultWorkerThread(
>>>>>>> -
>>>>>>> TransportFactory.getInstance().getDefaultAttributeBuilder(),
>>>>>>> +
>>>>>>> NIOTransportBuilder.DEFAULT_ATTRIBUTE_BUILDER,
>>>>>>> "HttpServer-" +
>>>>>>> threadCounter.getAndIncrement(),
>>>>>>> null,
>>>>>>> r);
>>>>>>> @@ -622,7 +621,7 @@
>>>>>>> @Override
>>>>>>> public Thread newThread(Runnable r) {
>>>>>>> final Thread newThread = new DefaultWorkerThread(
>>>>>>> -
>>>>>>> TransportFactory.getInstance().getDefaultAttributeBuilder(),
>>>>>>> +
>>>>>>> NIOTransportBuilder.DEFAULT_ATTRIBUTE_BUILDER,
>>>>>>> serverConfig.getName() + "-" +
>>>>>>> threadCounter.getAndIncrement(),
>>>>>>> null,
>>>>>>> r);
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/config/src/main/java/org/glassfish/grizzly/config/GrizzlyConfig.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/config/src/main/java/org/glassfish/grizzly/config/GrizzlyConfig.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/config/src/main/java/org/glassfish/grizzly/config/GrizzlyConfig.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2007-2010 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> + * Copyright (c) 2007-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -47,7 +47,6 @@
>>>>>>> import java.util.logging.Logger;
>>>>>>>
>>>>>>> import org.glassfish.grizzly.Grizzly;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.config.dom.NetworkConfig;
>>>>>>> import org.glassfish.grizzly.config.dom.NetworkListener;
>>>>>>> import org.glassfish.grizzly.memory.AbstractMemoryManager;
>>>>>>> @@ -83,13 +82,14 @@
>>>>>>> validateConfig(config);
>>>>>>> synchronized (listeners) {
>>>>>>> AbstractMemoryManager amm = null;
>>>>>>> - final MemoryManager mm =
>>>>>>> TransportFactory.getInstance().getDefaultMemoryManager();
>>>>>>> - if (mm instanceof AbstractMemoryManager) {
>>>>>>> - amm = (AbstractMemoryManager) mm;
>>>>>>> - }
>>>>>>> +
>>>>>>> for (final NetworkListener listener :
>>>>>>> config.getNetworkListeners().getNetworkListener()) {
>>>>>>> - final GrizzlyListener grizzlyListener = new
>>>>>>> GenericGrizzlyListener();
>>>>>>> + final GenericGrizzlyListener grizzlyListener =
>>>>>>> new GenericGrizzlyListener();
>>>>>>> grizzlyListener.configure(habitat, listener);
>>>>>>> + final MemoryManager mm =
>>>>>>> grizzlyListener.transport.getMemoryManager();
>>>>>>> + if (mm instanceof AbstractMemoryManager) {
>>>>>>> + amm = (AbstractMemoryManager) mm;
>>>>>>> + }
>>>>>>> listeners.add(grizzlyListener);
>>>>>>> final Thread thread = new
>>>>>>> DefaultWorkerThread(Grizzly.DEFAULT_ATTRIBUTE_BUILDER,
>>>>>>>
>>>>>>> grizzlyListener.getName(),
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/config/src/main/java/org/glassfish/grizzly/config/GenericGrizzlyListener.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/config/src/main/java/org/glassfish/grizzly/config/GenericGrizzlyListener.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/config/src/main/java/org/glassfish/grizzly/config/GenericGrizzlyListener.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2007-2010 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> + * Copyright (c) 2007-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -56,8 +56,9 @@
>>>>>>> import java.util.concurrent.atomic.AtomicInteger;
>>>>>>> import java.util.logging.Level;
>>>>>>> import java.util.logging.Logger;
>>>>>>> +
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.SocketBinder;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.config.dom.Http;
>>>>>>> import org.glassfish.grizzly.config.dom.NetworkListener;
>>>>>>> import org.glassfish.grizzly.config.dom.PortUnification;
>>>>>>> @@ -118,7 +119,7 @@
>>>>>>> protected volatile String name;
>>>>>>> protected volatile InetAddress address;
>>>>>>> protected volatile int port;
>>>>>>> - protected NIOTransport transport;
>>>>>>> + NIOTransport transport;
>>>>>>> protected FilterChain rootFilterChain;
>>>>>>>
>>>>>>> private volatile ExecutorService auxExecutorService;
>>>>>>> @@ -248,7 +249,7 @@
>>>>>>> protected NIOTransport configureTCPTransport(final Habitat
>>>>>>> habitat,
>>>>>>> final Transport transportConfig) {
>>>>>>>
>>>>>>> - final TCPNIOTransport tcpTransport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + final TCPNIOTransport tcpTransport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>>
>>>>>>> tcpTransport.setTcpNoDelay(Boolean.parseBoolean(transportConfig.getTcpNoDelay()));
>>>>>>>
>>>>>>> tcpTransport.setLinger(Integer.parseInt(transportConfig.getLinger()));
>>>>>>>
>>>>>>>
>>>>>>> tcpTransport.setServerConnectionBackLog(Integer.parseInt(transportConfig.getMaxConnectionsCount()));
>>>>>>> @@ -259,7 +260,7 @@
>>>>>>> protected NIOTransport configureUDPTransport(final Habitat
>>>>>>> habitat,
>>>>>>> final Transport transportConfig) {
>>>>>>>
>>>>>>> - return
>>>>>>> TransportFactory.getInstance().createUDPTransport();
>>>>>>> + return
>>>>>>> NIOTransportBuilder.defaultUDPTransportBuilder().build();
>>>>>>> }
>>>>>>>
>>>>>>> protected void configureProtocol(final Habitat habitat,
>>>>>>> @@ -476,7 +477,7 @@
>>>>>>> @Override
>>>>>>> public Thread newThread(Runnable r) {
>>>>>>> final Thread newThread = new DefaultWorkerThread(
>>>>>>> -
>>>>>>> TransportFactory.getInstance().getDefaultAttributeBuilder(),
>>>>>>> + transport.getAttributeBuilder(),
>>>>>>> getName() + "-" +
>>>>>>> threadCounter.getAndIncrement(),
>>>>>>> null,
>>>>>>> r);
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/portunif/src/test/java/org/glassfish/grizzly/portunif/BasicPUTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/portunif/src/test/java/org/glassfish/grizzly/portunif/BasicPUTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/portunif/src/test/java/org/glassfish/grizzly/portunif/BasicPUTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2007-2010 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> + * Copyright (c) 2007-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -41,6 +41,8 @@
>>>>>>> package org.glassfish.grizzly.portunif;
>>>>>>>
>>>>>>> import java.nio.charset.Charset;
>>>>>>> +
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChain;
>>>>>>> import java.io.IOException;
>>>>>>> import org.glassfish.grizzly.filterchain.BaseFilter;
>>>>>>> @@ -49,7 +51,6 @@
>>>>>>> import org.glassfish.grizzly.nio.transport.TCPNIOConnection;
>>>>>>> import java.util.concurrent.Future;
>>>>>>> import org.glassfish.grizzly.nio.transport.TCPNIOTransport;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.filterchain.TransportFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> @@ -86,7 +87,7 @@
>>>>>>> .add(new StringFilter(CHARSET))
>>>>>>> .add(puFilter);
>>>>>>>
>>>>>>> - TCPNIOTransport transport =
>>>>>>> TransportFactory.getInstance().createTCPTransport();
>>>>>>> + TCPNIOTransport transport = (TCPNIOTransport)
>>>>>>> NIOTransportBuilder.defaultTCPTransportBuilder().build();
>>>>>>> transport.setProcessor(puFilterChainBuilder.build());
>>>>>>>
>>>>>>> try {
>>>>>>> @@ -123,7 +124,6 @@
>>>>>>> }
>>>>>>>
>>>>>>> transport.stop();
>>>>>>> - TransportFactory.getInstance().close();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> Index:
>>>>>>> branches/2dot0/code/modules/portunif/src/test/java/org/glassfish/grizzly/portunif/SSLAndPlainTest.java
>>>>>>> ===================================================================
>>>>>>> ---
>>>>>>> branches/2dot0/code/modules/portunif/src/test/java/org/glassfish/grizzly/portunif/SSLAndPlainTest.java
>>>>>>> (revision 5605)
>>>>>>> +++
>>>>>>> branches/2dot0/code/modules/portunif/src/test/java/org/glassfish/grizzly/portunif/SSLAndPlainTest.java
>>>>>>> (revision 5606)
>>>>>>> @@ -1,7 +1,7 @@
>>>>>>> /*
>>>>>>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>>>>>>> *
>>>>>>> - * Copyright (c) 2007-2010 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> + * Copyright (c) 2007-2011 Oracle and/or its affiliates. All
>>>>>>> rights reserved.
>>>>>>> *
>>>>>>> * The contents of this file are subject to the terms of either
>>>>>>> the GNU
>>>>>>> * General Public License Version 2 only ("GPL") or the Common
>>>>>>> Development
>>>>>>> @@ -40,6 +40,7 @@
>>>>>>>
>>>>>>> package org.glassfish.grizzly.portunif;
>>>>>>>
>>>>>>> +import org.glassfish.grizzly.NIOTransportBuilder;
>>>>>>> import org.glassfish.grizzly.portunif.finders.SSLProtocolFinder;
>>>>>>> import org.glassfish.grizzly.utils.StringDecoder;
>>>>>>> import org.glassfish.grizzly.Buffer;
>>>>>>> @@ -54,7 +55,6 @@
>>>>>>> import java.util.concurrent.Future;
>>>>>>> import java.util.concurrent.TimeUnit;
>>>>>>> import org.glassfish.grizzly.nio.transport.TCPNIOTransport;
>>>>>>> -import org.glassfish.grizzly.TransportFactory;
>>>>>>> import org.glassfish.grizzly.filterchain.TransportFilter;
>>>>>>> import org.glassfish.grizzly.filterchain.FilterChainBuilder;
>>>>>>> import org.glassfish.grizzly.Connection;
>>>>>>> @@ -146,7 +146,7 @@
>>>>>>> .add(new TransportFilter())
>>>>>>> .add(rootPuFilter);
>>>>>>>
>>>>>>> - TCPNIOTransport transport = Tra
>>>>>>> [truncated due to length]
>>>>>>>
>>>>>
>>>>>
>>