[hornetq-commits] JBoss hornetq SVN: r8808 - in branches/HORNETQ-129_STOMP_protocol: src/main/org/hornetq/core/remoting/impl and 5 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jan 20 04:17:22 EST 2010


Author: jmesnil
Date: 2010-01-20 04:17:21 -0500 (Wed, 20 Jan 2010)
New Revision: 8808

Removed:
   branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java
   branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
Modified:
   branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
   branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/RemotingConnectionImpl.java
   branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
   branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/BufferHandler.java
   branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java
   branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
   branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
   branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
Log:
* removed unused HornetQFrameDecoder
* removed unused method from BufferHandler

Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -41,7 +41,6 @@
 import org.hornetq.core.remoting.Packet;
 import org.hornetq.core.remoting.PacketDecoder;
 import org.hornetq.core.remoting.RemotingConnection;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
 import org.hornetq.core.remoting.impl.CorePacketDecoder;
 import org.hornetq.core.remoting.impl.RemotingConnectionImpl;
 import org.hornetq.core.remoting.impl.wireformat.CreateSessionMessage;
@@ -49,6 +48,7 @@
 import org.hornetq.core.remoting.impl.wireformat.PacketImpl;
 import org.hornetq.core.remoting.impl.wireformat.Ping;
 import org.hornetq.core.version.Version;
+import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
 import org.hornetq.spi.core.remoting.Connector;
@@ -1088,7 +1088,7 @@
       }
    }
 
-   private class DelegatingBufferHandler extends AbstractBufferHandler
+   private class DelegatingBufferHandler implements BufferHandler
    {
       public void bufferReceived(final Object connectionID, final HornetQBuffer buffer, final PacketDecoder decoder)
       {

Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -1,46 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *    http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.  See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package org.hornetq.core.remoting.impl;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.spi.core.remoting.BufferHandler;
-import org.hornetq.utils.DataConstants;
-
-/**
- * A AbstractBufferHandler
- * 
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public abstract class AbstractBufferHandler implements BufferHandler
-{
-   private static final Logger log = Logger.getLogger(AbstractBufferHandler.class);
-
-   public int isReadyToHandle(final HornetQBuffer buffer)
-   {
-      if (buffer.readableBytes() < DataConstants.SIZE_INT)
-      {
-         return -1;
-      }
-
-      int length = buffer.readInt();
-
-      if (buffer.readableBytes() < length)
-      {
-         return -1;
-      }
-
-      return length;
-   }
-}

Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/RemotingConnectionImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/RemotingConnectionImpl.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/RemotingConnectionImpl.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -30,6 +30,7 @@
 import org.hornetq.core.remoting.Packet;
 import org.hornetq.core.remoting.PacketDecoder;
 import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
 import org.hornetq.utils.SimpleIDGenerator;
 
@@ -38,7 +39,7 @@
  * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
  * @version <tt>$Revision$</tt> $Id$
  */
-public class RemotingConnectionImpl extends AbstractBufferHandler implements RemotingConnection
+public class RemotingConnectionImpl implements RemotingConnection, BufferHandler
 {
    // Constants
    // ------------------------------------------------------------------------------------

Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -34,7 +34,6 @@
 import org.hornetq.core.remoting.Packet;
 import org.hornetq.core.remoting.PacketDecoder;
 import org.hornetq.core.remoting.RemotingConnection;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
 import org.hornetq.core.remoting.impl.RemotingConnectionImpl;
 import org.hornetq.core.remoting.impl.wireformat.PacketImpl;
 import org.hornetq.core.remoting.impl.wireformat.Ping;
@@ -42,7 +41,6 @@
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.impl.HornetQPacketHandler;
 import org.hornetq.core.server.management.ManagementService;
-import org.hornetq.integration.stomp.StompPacketDecoder;
 import org.hornetq.spi.core.remoting.Acceptor;
 import org.hornetq.spi.core.remoting.AcceptorFactory;
 import org.hornetq.spi.core.remoting.BufferHandler;
@@ -423,7 +421,7 @@
 
    // Inner classes -------------------------------------------------
 
-   private final class DelegatingBufferHandler extends AbstractBufferHandler
+   private final class DelegatingBufferHandler implements BufferHandler
    {
       public void bufferReceived(final Object connectionID, final HornetQBuffer buffer, final PacketDecoder decoder)
       {

Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -1,78 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *    http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.  See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.integration.transports.netty;
-
-import org.hornetq.core.buffers.impl.ChannelBufferWrapper;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.spi.core.remoting.BufferHandler;
-import org.hornetq.utils.DataConstants;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.handler.codec.frame.FrameDecoder;
-
-/**
- * A Netty FrameDecoder used to decode messages.
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- * @author <a href="tlee at redhat.com">Trustin Lee</a>
- *
- * @version $Revision$, $Date$
- */
-public class HornetQFrameDecoder extends FrameDecoder
-{
-   private static final Logger log = Logger.getLogger(HornetQFrameDecoder.class);
-
-   private final BufferHandler handler;
-
-   public HornetQFrameDecoder(final BufferHandler handler)
-   {
-      this.handler = handler;
-   }
-
-   // FrameDecoder overrides
-   // -------------------------------------------------------------------------------------
-
-   @Override
-   protected Object decode(final ChannelHandlerContext ctx, final Channel channel, final ChannelBuffer in) throws Exception
-   {
-      // TODO - we can avoid this entirely if we maintain fragmented packets in the handler
-      int start = in.readerIndex();
-
-      int length = handler.isReadyToHandle(new ChannelBufferWrapper(in));
-
-      in.readerIndex(start);
-
-      if (length == -1)
-      {
-         return null;
-      }
-
-      // in.readerIndex(start + SIZE_INT);
-
-      ChannelBuffer buffer = in.readBytes(length + DataConstants.SIZE_INT);
-
-      // FIXME - we should get Netty to give us a DynamicBuffer - seems to currently give us a non resizable buffer
-
-      ChannelBuffer newBuffer = ChannelBuffers.dynamicBuffer(buffer.writerIndex());
-
-      newBuffer.writeBytes(buffer);
-
-      newBuffer.readInt();
-
-      return newBuffer;
-   }
-}

Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/BufferHandler.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/BufferHandler.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/BufferHandler.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -31,14 +31,4 @@
     * @param buffer       the buffer to decode
     */
    void bufferReceived(Object connectionID, HornetQBuffer buffer, PacketDecoder decoder);
-
-   /**
-    * called by the remoting connection prior to {@link org.hornetq.spi.core.remoting.BufferHandler#bufferReceived(Object, org.hornetq.api.core.HornetQBuffer)}.
-    * <p/>
-    * The implementation should return true if there is enough data in the buffer to decode. otherwise false.
-    *
-    * @param buffer the buffer
-    * @return true id the buffer can be decoded..
-    */
-   int isReadyToHandle(HornetQBuffer buffer);
 }

Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -26,7 +26,6 @@
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.remoting.PacketDecoder;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
 import org.hornetq.integration.transports.netty.NettyAcceptor;
 import org.hornetq.integration.transports.netty.NettyConnector;
 import org.hornetq.integration.transports.netty.TransportConstants;
@@ -462,7 +461,7 @@
       }
    }
 
-   class SimpleBufferHandler extends AbstractBufferHandler
+   class SimpleBufferHandler implements BufferHandler
    {
       int messagesReceieved = 0;
 
@@ -484,7 +483,7 @@
       }
    }
 
-   class SimpleBufferHandler2 extends AbstractBufferHandler
+   class SimpleBufferHandler2 implements BufferHandler
    {
       int messagesReceieved = 0;
 

Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -22,7 +22,6 @@
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.remoting.PacketDecoder;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
 import org.hornetq.integration.transports.netty.NettyAcceptor;
 import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
 import org.hornetq.spi.core.remoting.Acceptor;
@@ -45,7 +44,7 @@
       NettyAcceptorFactory factory = new NettyAcceptorFactory();
 
       Map<String, Object> params = new HashMap<String, Object>();
-      BufferHandler handler = new AbstractBufferHandler()
+      BufferHandler handler = new BufferHandler()
       {
 
          public void bufferReceived(Object connectionID, HornetQBuffer buffer, PacketDecoder decoder)

Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -23,7 +23,6 @@
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.remoting.PacketDecoder;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
 import org.hornetq.integration.transports.netty.NettyAcceptor;
 import org.hornetq.integration.transports.netty.TransportConstants;
 import org.hornetq.spi.core.remoting.BufferHandler;
@@ -58,7 +57,7 @@
 
    public void testStartStop() throws Exception
    {
-      BufferHandler handler = new AbstractBufferHandler()
+      BufferHandler handler = new BufferHandler()
       {
 
          public void bufferReceived(final Object connectionID, final HornetQBuffer buffer, final PacketDecoder decoder)

Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java	2010-01-19 16:04:31 UTC (rev 8807)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java	2010-01-20 09:17:21 UTC (rev 8808)
@@ -22,7 +22,6 @@
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.core.remoting.PacketDecoder;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
 import org.hornetq.integration.transports.netty.NettyConnector;
 import org.hornetq.spi.core.remoting.BufferHandler;
 import org.hornetq.spi.core.remoting.Connection;
@@ -50,7 +49,7 @@
 
    public void testStartStop() throws Exception
    {
-      BufferHandler handler = new AbstractBufferHandler()
+      BufferHandler handler = new BufferHandler()
       {
          public void bufferReceived(final Object connectionID, final HornetQBuffer buffer, final PacketDecoder decoder)
          {
@@ -87,7 +86,7 @@
 
    public void testNullParams() throws Exception
    {
-      BufferHandler handler = new AbstractBufferHandler()
+      BufferHandler handler = new BufferHandler()
       {
          public void bufferReceived(final Object connectionID, final HornetQBuffer buffer, final PacketDecoder decoder)
          {



More information about the hornetq-commits mailing list