diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java b/activemq-client/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java index a10fb33e94..a79fc3e903 100755 --- a/activemq-client/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java @@ -32,10 +32,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * A {@link ReliableTransportChannel} which uses a {@link DiscoveryAgent} to + * A {@link TransportFilter} which uses a {@link DiscoveryAgent} to * discover remote broker instances and dynamically connect to them. - * - * */ public class DiscoveryTransport extends TransportFilter implements DiscoveryListener { diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/mock/MockTransportFactory.java b/activemq-client/src/main/java/org/apache/activemq/transport/mock/MockTransportFactory.java index 7d8eb4f56d..3e147d0e35 100755 --- a/activemq-client/src/main/java/org/apache/activemq/transport/mock/MockTransportFactory.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/mock/MockTransportFactory.java @@ -31,6 +31,7 @@ import org.apache.activemq.util.URISupport.CompositeData; public class MockTransportFactory extends TransportFactory { + @Override public Transport doConnect(URI location) throws URISyntaxException, Exception { Transport transport = createTransport(URISupport.parseComposite(location)); transport = new MutexTransport(transport); @@ -38,13 +39,14 @@ public class MockTransportFactory extends TransportFactory { return transport; } + @Override public Transport doCompositeConnect(URI location) throws URISyntaxException, Exception { return createTransport(URISupport.parseComposite(location)); } /** * @param location - * @return + * @return a new Transport instance. * @throws Exception */ public Transport createTransport(CompositeData compositData) throws Exception { @@ -53,8 +55,8 @@ public class MockTransportFactory extends TransportFactory { return transport; } + @Override public TransportServer doBind(URI location) throws IOException { throw new IOException("This protocol does not support being bound."); } - } diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/ResponseHolder.java b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/ResponseHolder.java index 6418a68108..77458264d5 100755 --- a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/ResponseHolder.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/ResponseHolder.java @@ -20,8 +20,6 @@ import org.apache.activemq.command.Response; /** * ResponseHolder utility - * - * */ public class ResponseHolder { protected Response response; @@ -36,8 +34,9 @@ public class ResponseHolder { /** * Set the Response for this holder - * - * @param r + * + * @param response + * the response returned from the remote peer. */ public void setResponse(Response r) { synchronized (lock) { @@ -49,7 +48,7 @@ public class ResponseHolder { /** * Get the Response - * + * * @return the Response or null if it is closed */ public Response getResponse() { @@ -57,10 +56,10 @@ public class ResponseHolder { } /** - * wait upto timeout timeout ms to get a receipt - * + * wait up to timeout timeout milliseconds to get a receipt + * * @param timeout - * @return + * @return the Response that was set or null if none set yet. */ public Response getResponse(int timeout) { synchronized (lock) { diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java index ec27b7b6b1..e695fa8601 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java @@ -45,11 +45,13 @@ import org.slf4j.LoggerFactory; * factory will have their needClientAuth option set to false. */ public class SslTransportFactory extends TcpTransportFactory { + private static final Logger LOG = LoggerFactory.getLogger(SslTransportFactory.class); /** * Overriding to use SslTransportServer and allow for proper reflection. */ + @Override public TransportServer doBind(final URI location) throws IOException { try { Map options = new HashMap(URISupport.parseParameters(location)); @@ -74,7 +76,7 @@ public class SslTransportFactory extends TcpTransportFactory { * * @param location * @param serverSocketFactory - * @return + * @return a new SslTransportServer initialized from the given location and socket factory. * @throws IOException * @throws URISyntaxException */ @@ -86,9 +88,10 @@ public class SslTransportFactory extends TcpTransportFactory { * Overriding to allow for proper configuration through reflection but delegate to get common * configuration */ + @Override @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { - SslTransport sslTransport = (SslTransport)transport.narrow(SslTransport.class); + SslTransport sslTransport = transport.narrow(SslTransport.class); IntrospectionSupport.setProperties(sslTransport, options); return super.compositeConfigure(transport, format, options); @@ -97,6 +100,7 @@ public class SslTransportFactory extends TcpTransportFactory { /** * Overriding to use SslTransports. */ + @Override protected Transport createTransport(URI location, WireFormat wf) throws UnknownHostException, IOException { URI localLocation = null; String path = location.getPath(); @@ -122,6 +126,7 @@ public class SslTransportFactory extends TcpTransportFactory { * @return Newly created (Ssl)ServerSocketFactory. * @throws IOException */ + @Override protected ServerSocketFactory createServerSocketFactory() throws IOException { if( SslContext.getCurrentSslContext()!=null ) { SslContext ctx = SslContext.getCurrentSslContext(); @@ -142,6 +147,7 @@ public class SslTransportFactory extends TcpTransportFactory { * @return Newly created (Ssl)SocketFactory. * @throws IOException */ + @Override protected SocketFactory createSocketFactory() throws IOException { if( SslContext.getCurrentSslContext()!=null ) { SslContext ctx = SslContext.getCurrentSslContext(); diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java index 9dc50f934f..3d2fa44e99 100755 --- a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java @@ -28,7 +28,11 @@ import javax.net.SocketFactory; import org.apache.activemq.TransportLoggerSupport; import org.apache.activemq.openwire.OpenWireFormat; -import org.apache.activemq.transport.*; +import org.apache.activemq.transport.InactivityMonitor; +import org.apache.activemq.transport.Transport; +import org.apache.activemq.transport.TransportFactory; +import org.apache.activemq.transport.TransportServer; +import org.apache.activemq.transport.WireFormatNegotiator; import org.apache.activemq.util.IOExceptionSupport; import org.apache.activemq.util.IntrospectionSupport; import org.apache.activemq.util.URISupport; @@ -36,13 +40,11 @@ import org.apache.activemq.wireformat.WireFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * @author David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com (logging improvement modifications) - * - */ public class TcpTransportFactory extends TransportFactory { + private static final Logger LOG = LoggerFactory.getLogger(TcpTransportFactory.class); + @Override public TransportServer doBind(final URI location) throws IOException { try { Map options = new HashMap(URISupport.parseParameters(location)); @@ -67,7 +69,7 @@ public class TcpTransportFactory extends TransportFactory { * * @param location * @param serverSocketFactory - * @return + * @return a new TcpTransportServer instance. * @throws IOException * @throws URISyntaxException */ @@ -75,10 +77,11 @@ public class TcpTransportFactory extends TransportFactory { return new TcpTransportServer(this, location, serverSocketFactory); } + @Override @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { - TcpTransport tcpTransport = (TcpTransport)transport.narrow(TcpTransport.class); + TcpTransport tcpTransport = transport.narrow(TcpTransport.class); IntrospectionSupport.setProperties(tcpTransport, options); Map socketOptions = IntrospectionSupport.extractProperties(options, "socket."); @@ -108,12 +111,13 @@ public class TcpTransportFactory extends TransportFactory { /** - * Returns true if the inactivity monitor should be used on the transport + * @return true if the inactivity monitor should be used on the transport */ protected boolean isUseInactivityMonitor(Transport transport) { return true; } + @Override protected Transport createTransport(URI location, WireFormat wf) throws UnknownHostException, IOException { URI localLocation = null; String path = location.getPath(); @@ -137,13 +141,15 @@ public class TcpTransportFactory extends TransportFactory { /** * Allows subclasses of TcpTransportFactory to provide a create custom - * TcpTransport intances. + * TcpTransport instances. * - * @param location * @param wf * @param socketFactory + * @param location * @param localLocation - * @return + * + * @return a new TcpTransport instance connected to the given location. + * * @throws UnknownHostException * @throws IOException */ diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java index b44a462d67..a0778cd7a1 100755 --- a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java @@ -378,7 +378,9 @@ public class TcpTransportServer extends TransportServerThreadSupport implements * * @param socket * @param format - * @return + * + * @return a new Transport instance. + * * @throws IOException */ protected Transport createTransport(Socket socket, WireFormat format) throws IOException { diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/udp/DefaultBufferPool.java b/activemq-client/src/main/java/org/apache/activemq/transport/udp/DefaultBufferPool.java index 4713535ceb..f4f6864bf0 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/udp/DefaultBufferPool.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/udp/DefaultBufferPool.java @@ -21,10 +21,8 @@ import java.util.ArrayList; import java.util.List; /** - * A default implementation of {@link BufferPool} which keeps a pool of direct + * A default implementation of {@link SimpleBufferPool} which keeps a pool of direct * byte buffers. - * - * */ public class DefaultBufferPool extends SimpleBufferPool implements ByteBufferPool { @@ -39,6 +37,7 @@ public class DefaultBufferPool extends SimpleBufferPool implements ByteBufferPoo super(useDirect); } + @Override public synchronized ByteBuffer borrowBuffer() { synchronized (lock) { int size = buffers.size(); @@ -49,15 +48,18 @@ public class DefaultBufferPool extends SimpleBufferPool implements ByteBufferPoo return createBuffer(); } + @Override public void returnBuffer(ByteBuffer buffer) { synchronized (lock) { buffers.add(buffer); } } + @Override public void start() throws Exception { } + @Override public void stop() throws Exception { synchronized (lock) { /* @@ -67,5 +69,4 @@ public class DefaultBufferPool extends SimpleBufferPool implements ByteBufferPoo buffers.clear(); } } - }