JBoss hornetq SVN: r8840 - in branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol: stomp and 1 other directory.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-01-22 07:46:06 -0500 (Fri, 22 Jan 2010)
New Revision: 8840
Added:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompConnection.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompException.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrame.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameError.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompProtocolManagerFactory.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompSessionCallback.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompUtils.java
Removed:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/ProtocolException.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompDestinationConverter.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompException.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrame.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameError.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompPacketDecoder.java
Modified:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/Stomp.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameDelimiter.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* updated code with trunk's refactoring of protocol support
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp (from rev 8826, branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp)
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/ProtocolException.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/ProtocolException.java 2010-01-21 14:41:55 UTC (rev 8826)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/ProtocolException.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -1,50 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.protocol.stomp;
-
-import java.io.IOException;
-
-/**
- * @author <a href="http://hiramchirino.com">chirino</a>
- */
-public class ProtocolException extends IOException {
- private static final long serialVersionUID = -2869735532997332242L;
- private final boolean fatal;
-
- public ProtocolException() {
- this(null);
- }
-
- public ProtocolException(String s) {
- this(s, false);
- }
-
- public ProtocolException(String s, boolean fatal) {
- this(s, fatal, null);
- }
-
- public ProtocolException(String s, boolean fatal, Throwable cause) {
- super(s);
- this.fatal = fatal;
- initCause(cause);
- }
-
- public boolean isFatal() {
- return fatal;
- }
-}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/Stomp.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/Stomp.java 2010-01-21 14:41:55 UTC (rev 8826)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/Stomp.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.hornetq.integration.protocol.stomp;
+package org.hornetq.core.protocol.stomp;
/**
Added: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompConnection.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompConnection.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompConnection.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2010 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.protocol.stomp;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.remoting.CloseListener;
+import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A StompConnection
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+public class StompConnection implements RemotingConnection
+{
+ private static final Logger log = Logger.getLogger(StompConnection.class);
+
+ private final ProtocolManager manager;
+
+ private final Connection transportConnection;
+
+ StompConnection(final Connection transportConnection, final ProtocolManager manager)
+ {
+ this.transportConnection = transportConnection;
+
+ this.manager = manager;
+ }
+
+ public void addCloseListener(CloseListener listener)
+ {
+ }
+
+ public void addFailureListener(FailureListener listener)
+ {
+ }
+
+ public boolean checkDataReceived()
+ {
+ return true;
+ }
+
+ public HornetQBuffer createBuffer(int size)
+ {
+ return HornetQBuffers.dynamicBuffer(size);
+ }
+
+ public void destroy()
+ {
+ }
+
+ public void disconnect()
+ {
+ }
+
+ public void fail(HornetQException me)
+ {
+ }
+
+ public void flush()
+ {
+ }
+
+ public List<FailureListener> getFailureListeners()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ public Object getID()
+ {
+ return transportConnection.getID();
+ }
+
+ public String getRemoteAddress()
+ {
+ return transportConnection.getRemoteAddress();
+ }
+
+ public Connection getTransportConnection()
+ {
+ return transportConnection;
+ }
+
+ public boolean isClient()
+ {
+ return false;
+ }
+
+ public boolean isDestroyed()
+ {
+ return false;
+ }
+
+ public boolean removeCloseListener(CloseListener listener)
+ {
+ return false;
+ }
+
+ public boolean removeFailureListener(FailureListener listener)
+ {
+ return false;
+ }
+
+ public void setFailureListeners(List<FailureListener> listeners)
+ {
+ }
+
+
+ public void bufferReceived(Object connectionID, HornetQBuffer buffer)
+ {
+ manager.handleBuffer(this, buffer);
+ }
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ return -1;
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompDestinationConverter.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompDestinationConverter.java 2010-01-21 14:41:55 UTC (rev 8826)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompDestinationConverter.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -1,85 +0,0 @@
-/*
- * Copyright 2010 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.protocol.stomp;
-
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.jms.client.HornetQQueue;
-import org.hornetq.jms.client.HornetQTemporaryQueue;
-import org.hornetq.jms.client.HornetQTemporaryTopic;
-import org.hornetq.jms.client.HornetQTopic;
-
-/**
- * A StompDestinationConverter
- *
- * @author jmesnil
- *
- *
- */
-public class StompDestinationConverter
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- public static SimpleString convertDestination(String name) throws HornetQException
- {
- if (name == null)
- {
- throw new HornetQException(HornetQException.ILLEGAL_STATE, "No destination is specified!");
- }
- else if (name.startsWith("/queue/"))
- {
- String queueName = name.substring("/queue/".length(), name.length());
- return HornetQQueue.createAddressFromName(queueName);
- }
- else if (name.startsWith("/topic/"))
- {
- String topicName = name.substring("/topic/".length(), name.length());
- return HornetQTopic.createAddressFromName(topicName);
- }
- else if (name.startsWith("/temp-queue/"))
- {
- String tempName = name.substring("/temp-queue/".length(), name.length());
- return HornetQTemporaryQueue.createAddressFromName(tempName);
- }
- else if (name.startsWith("/temp-topic/"))
- {
- String tempName = name.substring("/temp-topic/".length(), name.length());
- return HornetQTemporaryTopic.createAddressFromName(tempName);
- }
- else
- {
- throw new HornetQException(HornetQException.ILLEGAL_STATE, "Illegal destination name: [" + name +
- "] -- StompConnect destinations " +
- "must begine with one of: /queue/ /topic/ /temp-queue/ /temp-topic/");
- }
- }
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompException.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompException.java 2010-01-21 14:41:55 UTC (rev 8826)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompException.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -1,52 +0,0 @@
-/*
- * Copyright 2010 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.protocol.stomp;
-
-/**
- * A StompException
- *
- * @author jmesnil
- *
- *
- */
-public class StompException extends Exception
-{
-
- /**
- * @param string
- */
- public StompException(String string)
- {
- super(string);
- }
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompException.java (from rev 8830, branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompException.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompException.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompException.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -0,0 +1,50 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.protocol.stomp;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="http://hiramchirino.com">chirino</a>
+ */
+class StompException extends IOException {
+ private static final long serialVersionUID = -2869735532997332242L;
+ private final boolean fatal;
+
+ public StompException() {
+ this(null);
+ }
+
+ public StompException(String s) {
+ this(s, false);
+ }
+
+ public StompException(String s, boolean fatal) {
+ this(s, fatal, null);
+ }
+
+ public StompException(String s, boolean fatal, Throwable cause) {
+ super(s);
+ this.fatal = fatal;
+ initCause(cause);
+ }
+
+ public boolean isFatal() {
+ return fatal;
+ }
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrame.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompFrame.java 2010-01-21 14:41:55 UTC (rev 8826)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrame.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -1,70 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.protocol.stomp;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Represents all the data in a STOMP frame.
- *
- * @author <a href="http://hiramchirino.com">chirino</a>
- */
-public class StompFrame
-{
- private static final byte[] NO_DATA = new byte[] {};
-
- private String command;
-
- private Map<String, Object> headers;
-
- private byte[] content = StompFrame.NO_DATA;
-
- public StompFrame()
- {
- this.headers = new HashMap<String, Object>();
- }
-
- public StompFrame(String command, Map<String, Object> headers, byte[] data)
- {
- this.command = command;
- this.headers = headers;
- this.content = data;
- }
-
- public String getCommand()
- {
- return command;
- }
-
- public byte[] getContent()
- {
- return content;
- }
-
- public Map<String, Object> getHeaders()
- {
- return headers;
- }
-
- @Override
- public String toString()
- {
- return "StompFrame[command=" + command + ", headers=" + headers + ",content-length=" + content.length + "]";
- }
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrame.java (from rev 8829, branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompFrame.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrame.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrame.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -0,0 +1,70 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.protocol.stomp;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Represents all the data in a STOMP frame.
+ *
+ * @author <a href="http://hiramchirino.com">chirino</a>
+ */
+class StompFrame
+{
+ private static final byte[] NO_DATA = new byte[] {};
+
+ private String command;
+
+ private Map<String, Object> headers;
+
+ private byte[] content = StompFrame.NO_DATA;
+
+ public StompFrame()
+ {
+ this.headers = new HashMap<String, Object>();
+ }
+
+ public StompFrame(String command, Map<String, Object> headers, byte[] data)
+ {
+ this.command = command;
+ this.headers = headers;
+ this.content = data;
+ }
+
+ public String getCommand()
+ {
+ return command;
+ }
+
+ public byte[] getContent()
+ {
+ return content;
+ }
+
+ public Map<String, Object> getHeaders()
+ {
+ return headers;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "StompFrame[command=" + command + ", headers=" + headers + ",content-length=" + content.length + "]";
+ }
+}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameDelimiter.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompFrameDelimiter.java 2010-01-21 14:41:55 UTC (rev 8826)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameDelimiter.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -11,7 +11,7 @@
* permissions and limitations under the License.
*/
-package org.hornetq.integration.protocol.stomp;
+package org.hornetq.core.protocol.stomp;
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
import org.jboss.netty.handler.codec.frame.Delimiters;
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameError.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompFrameError.java 2010-01-21 14:41:55 UTC (rev 8826)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameError.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -1,35 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.protocol.stomp;
-
-/**
- * Command indicating that an invalid Stomp Frame was received.
- *
- * @author <a href="http://hiramchirino.com">chirino</a>
- */
-public class StompFrameError extends StompFrame {
- private final ProtocolException exception;
-
- public StompFrameError(ProtocolException exception) {
- this.exception = exception;
- }
-
- public ProtocolException getException() {
- return exception;
- }
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameError.java (from rev 8830, branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompFrameError.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameError.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompFrameError.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -0,0 +1,35 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.protocol.stomp;
+
+/**
+ * Command indicating that an invalid Stomp Frame was received.
+ *
+ * @author <a href="http://hiramchirino.com">chirino</a>
+ */
+class StompFrameError extends StompFrame {
+ private final StompException exception;
+
+ public StompFrameError(StompException exception) {
+ this.exception = exception;
+ }
+
+ public StompException getException() {
+ return exception;
+ }
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompMarshaller.java 2010-01-21 14:41:55 UTC (rev 8826)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -1,191 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.protocol.stomp;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.hornetq.api.core.HornetQBuffer;
-
-/**
- * Implements marshalling and unmarsalling the <a href="http://stomp.codehaus.org/">Stomp</a> protocol.
- */
-public class StompMarshaller {
- private static final byte[] NO_DATA = new byte[]{};
- private static final byte[] END_OF_FRAME = new byte[]{0, '\n'};
- private static final int MAX_COMMAND_LENGTH = 1024;
- private static final int MAX_HEADER_LENGTH = 1024 * 10;
- private static final int MAX_HEADERS = 1000;
- private static final int MAX_DATA_LENGTH = 1024 * 1024 * 100;
- private int version = 1;
-
- public int getVersion() {
- return version;
- }
-
- public void setVersion(int version) {
- this.version = version;
- }
-
- public byte[] marshal(StompFrame command) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- DataOutputStream dos = new DataOutputStream(baos);
- marshal(command, dos);
- dos.close();
- return baos.toByteArray();
- }
-
- public void marshal(StompFrame stomp, DataOutput os) throws IOException {
- StringBuffer buffer = new StringBuffer();
- buffer.append(stomp.getCommand());
- buffer.append(Stomp.NEWLINE);
-
- // Output the headers.
- for (Iterator iter = stomp.getHeaders().entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- buffer.append(entry.getKey());
- buffer.append(Stomp.Headers.SEPERATOR);
- buffer.append(entry.getValue());
- buffer.append(Stomp.NEWLINE);
- }
-
- // Add a newline to seperate the headers from the content.
- buffer.append(Stomp.NEWLINE);
-
- os.write(buffer.toString().getBytes("UTF-8"));
- os.write(stomp.getContent());
- os.write(END_OF_FRAME);
- }
-
- public StompFrame unmarshal(HornetQBuffer in) throws IOException {
-
- try {
- String action = null;
-
- // skip white space to next real action line
- while (true) {
- action = readLine(in, MAX_COMMAND_LENGTH, "The maximum command length was exceeded");
- if (action == null) {
- throw new IOException("connection was closed");
- }
- else {
- action = action.trim();
- if (action.length() > 0) {
- break;
- }
- }
- }
-
- // Parse the headers
- HashMap headers = new HashMap(25);
- while (true) {
- String line = readLine(in, MAX_HEADER_LENGTH, "The maximum header length was exceeded");
- if (line != null && line.trim().length() > 0) {
-
- if (headers.size() > MAX_HEADERS) {
- throw new ProtocolException("The maximum number of headers was exceeded", true);
- }
-
- try {
- int seperator_index = line.indexOf(Stomp.Headers.SEPERATOR);
- String name = line.substring(0, seperator_index).trim();
- String value = line.substring(seperator_index + 1, line.length()).trim();
- headers.put(name, value);
- }
- catch (Exception e) {
- throw new ProtocolException("Unable to parser header line [" + line + "]", true);
- }
- }
- else {
- break;
- }
- }
-
- // Read in the data part.
- byte[] data = NO_DATA;
- String contentLength = (String) headers.get(Stomp.Headers.CONTENT_LENGTH);
- if (contentLength != null) {
-
- // Bless the client, he's telling us how much data to read in.
- int length;
- try {
- length = Integer.parseInt(contentLength.trim());
- }
- catch (NumberFormatException e) {
- throw new ProtocolException("Specified content-length is not a valid integer", true);
- }
-
- if (length > MAX_DATA_LENGTH) {
- throw new ProtocolException("The maximum data length was exceeded", true);
- }
-
- data = new byte[length];
- in.readBytes(data);
-
- if (in.readByte() != 0) {
- throw new ProtocolException(Stomp.Headers.CONTENT_LENGTH + " bytes were read and " + "there was no trailing null byte", true);
- }
- }
- else {
-
- // We don't know how much to read.. data ends when we hit a 0
- byte b;
- ByteArrayOutputStream baos = null;
- while (in.readableBytes() > 0 && (b = in.readByte()) != 0) {
-
- if (baos == null) {
- baos = new ByteArrayOutputStream();
- }
- else if (baos.size() > MAX_DATA_LENGTH) {
- throw new ProtocolException("The maximum data length was exceeded", true);
- }
-
- baos.write(b);
- }
-
- if (baos != null) {
- baos.close();
- data = baos.toByteArray();
- }
- }
-
- return new StompFrame(action, headers, data);
- }
- catch (ProtocolException e) {
- return new StompFrameError(e);
- }
- }
-
- protected String readLine(HornetQBuffer in, int maxLength, String errorMessage) throws IOException {
- byte b;
- ByteArrayOutputStream baos = new ByteArrayOutputStream(maxLength);
- while ((b = in.readByte()) != '\n') {
- if (baos.size() > maxLength) {
- throw new ProtocolException(errorMessage, true);
- }
- baos.write(b);
- }
- byte[] sequence = baos.toByteArray();
- return new String(sequence, "UTF-8");
- }
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java (from rev 8830, branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompMarshaller.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompMarshaller.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -0,0 +1,191 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.protocol.stomp;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.hornetq.api.core.HornetQBuffer;
+
+/**
+ * Implements marshalling and unmarsalling the <a href="http://stomp.codehaus.org/">Stomp</a> protocol.
+ */
+class StompMarshaller {
+ private static final byte[] NO_DATA = new byte[]{};
+ private static final byte[] END_OF_FRAME = new byte[]{0, '\n'};
+ private static final int MAX_COMMAND_LENGTH = 1024;
+ private static final int MAX_HEADER_LENGTH = 1024 * 10;
+ private static final int MAX_HEADERS = 1000;
+ private static final int MAX_DATA_LENGTH = 1024 * 1024 * 100;
+ private int version = 1;
+
+ public int getVersion() {
+ return version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ public byte[] marshal(StompFrame command) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dos = new DataOutputStream(baos);
+ marshal(command, dos);
+ dos.close();
+ return baos.toByteArray();
+ }
+
+ public void marshal(StompFrame stomp, DataOutput os) throws IOException {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(stomp.getCommand());
+ buffer.append(Stomp.NEWLINE);
+
+ // Output the headers.
+ for (Iterator iter = stomp.getHeaders().entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ buffer.append(entry.getKey());
+ buffer.append(Stomp.Headers.SEPERATOR);
+ buffer.append(entry.getValue());
+ buffer.append(Stomp.NEWLINE);
+ }
+
+ // Add a newline to seperate the headers from the content.
+ buffer.append(Stomp.NEWLINE);
+
+ os.write(buffer.toString().getBytes("UTF-8"));
+ os.write(stomp.getContent());
+ os.write(END_OF_FRAME);
+ }
+
+ public StompFrame unmarshal(HornetQBuffer in) throws IOException {
+
+ try {
+ String action = null;
+
+ // skip white space to next real action line
+ while (true) {
+ action = readLine(in, MAX_COMMAND_LENGTH, "The maximum command length was exceeded");
+ if (action == null) {
+ throw new IOException("connection was closed");
+ }
+ else {
+ action = action.trim();
+ if (action.length() > 0) {
+ break;
+ }
+ }
+ }
+
+ // Parse the headers
+ HashMap headers = new HashMap(25);
+ while (true) {
+ String line = readLine(in, MAX_HEADER_LENGTH, "The maximum header length was exceeded");
+ if (line != null && line.trim().length() > 0) {
+
+ if (headers.size() > MAX_HEADERS) {
+ throw new StompException("The maximum number of headers was exceeded", true);
+ }
+
+ try {
+ int seperator_index = line.indexOf(Stomp.Headers.SEPERATOR);
+ String name = line.substring(0, seperator_index).trim();
+ String value = line.substring(seperator_index + 1, line.length()).trim();
+ headers.put(name, value);
+ }
+ catch (Exception e) {
+ throw new StompException("Unable to parser header line [" + line + "]", true);
+ }
+ }
+ else {
+ break;
+ }
+ }
+
+ // Read in the data part.
+ byte[] data = NO_DATA;
+ String contentLength = (String) headers.get(Stomp.Headers.CONTENT_LENGTH);
+ if (contentLength != null) {
+
+ // Bless the client, he's telling us how much data to read in.
+ int length;
+ try {
+ length = Integer.parseInt(contentLength.trim());
+ }
+ catch (NumberFormatException e) {
+ throw new StompException("Specified content-length is not a valid integer", true);
+ }
+
+ if (length > MAX_DATA_LENGTH) {
+ throw new StompException("The maximum data length was exceeded", true);
+ }
+
+ data = new byte[length];
+ in.readBytes(data);
+
+ if (in.readByte() != 0) {
+ throw new StompException(Stomp.Headers.CONTENT_LENGTH + " bytes were read and " + "there was no trailing null byte", true);
+ }
+ }
+ else {
+
+ // We don't know how much to read.. data ends when we hit a 0
+ byte b;
+ ByteArrayOutputStream baos = null;
+ while (in.readableBytes() > 0 && (b = in.readByte()) != 0) {
+
+ if (baos == null) {
+ baos = new ByteArrayOutputStream();
+ }
+ else if (baos.size() > MAX_DATA_LENGTH) {
+ throw new StompException("The maximum data length was exceeded", true);
+ }
+
+ baos.write(b);
+ }
+
+ if (baos != null) {
+ baos.close();
+ data = baos.toByteArray();
+ }
+ }
+
+ return new StompFrame(action, headers, data);
+ }
+ catch (StompException e) {
+ return new StompFrameError(e);
+ }
+ }
+
+ protected String readLine(HornetQBuffer in, int maxLength, String errorMessage) throws IOException {
+ byte b;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(maxLength);
+ while ((b = in.readByte()) != '\n') {
+ if (baos.size() > maxLength) {
+ throw new StompException(errorMessage, true);
+ }
+ baos.write(b);
+ }
+ byte[] sequence = baos.toByteArray();
+ return new String(sequence, "UTF-8");
+ }
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompPacketDecoder.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompPacketDecoder.java 2010-01-21 14:41:55 UTC (rev 8826)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompPacketDecoder.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -1,51 +0,0 @@
-/*
- * Copyright 2010 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.protocol.stomp;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.buffers.impl.ChannelBufferWrapper;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ChannelPipelineCoverage;
-import org.jboss.netty.channel.Channels;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.SimpleChannelHandler;
-
-/**
- * A StompPacketDecoder
- *
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- */
-@ChannelPipelineCoverage("one")
-public class StompPacketDecoder extends SimpleChannelHandler
-{
- private final StompMarshaller marshaller;
-
- // PacketDecoder implementation ----------------------------------
-
- public StompPacketDecoder(final StompMarshaller marshaller)
- {
- this.marshaller = marshaller;
- }
-
- @Override
- public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception
- {
- ChannelBuffer in = (ChannelBuffer)e.getMessage();
- HornetQBuffer buffer = new ChannelBufferWrapper(in);
- StompFrame frame = marshaller.unmarshal(buffer);
-
- Channels.fireMessageReceived(ctx, frame);
- }
-}
Added: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2010 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.protocol.stomp;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.api.core.Message;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.ServerMessage;
+import org.hornetq.core.server.ServerSession;
+import org.hornetq.core.server.impl.ServerMessageImpl;
+import org.hornetq.spi.core.protocol.ConnectionEntry;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.remoting.Connection;
+import org.hornetq.utils.UUIDGenerator;
+
+/**
+ * StompProtocolManager
+ *
+ * A stupid protocol to demonstrate how to implement a new protocol in HornetQ
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class StompProtocolManager implements ProtocolManager
+{
+ private static final Logger log = Logger.getLogger(StompProtocolManager.class);
+
+ private final HornetQServer server;
+
+ private final StompMarshaller marshaller;
+
+ private final Map<RemotingConnection, ServerSession> sessions = new HashMap<RemotingConnection, ServerSession>();
+
+ public StompProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
+ {
+ this.server = server;
+ this.marshaller = new StompMarshaller();
+ }
+
+ public ConnectionEntry createConnectionEntry(final Connection connection)
+ {
+ StompConnection conn = new StompConnection(connection, this);
+
+ return new ConnectionEntry(conn, 0, 0);
+ }
+
+ public void removeHandler(String name)
+ {
+ }
+
+ public void handleBuffer(RemotingConnection connection, HornetQBuffer buffer)
+ {
+ StompFrame frame = null;
+ try
+ {
+ frame = marshaller.unmarshal(buffer);
+ System.out.println("RECEIVED " + frame);
+
+ String command = frame.getCommand();
+
+ StompFrame response = null;
+ if (Stomp.Commands.CONNECT.equals(command))
+ {
+ response = onConnect(frame, server, connection);
+ }
+ else if (Stomp.Commands.DISCONNECT.equals(command))
+ {
+ response = onDisconnect(frame, server, connection);
+ }
+ else if (Stomp.Commands.SEND.equals(command))
+ {
+ response = onSend(frame, server, connection);
+ }
+ else if (Stomp.Commands.SUBSCRIBE.equals(command))
+ {
+ response = onSubscribe(frame, server, connection);
+ }
+ else
+ {
+ log.error("Unsupported Stomp frame: " + frame);
+ response = new StompFrame(Stomp.Responses.ERROR,
+ new HashMap<String, Object>(),
+ ("Unsupported frame: " + command).getBytes());
+ }
+
+ if (response != null)
+ {
+ send(connection, response);
+ }
+ }
+ catch (StompException ex)
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try
+ {
+ // Let the stomp client know about any protocol errors.
+ PrintWriter stream = new PrintWriter(new OutputStreamWriter(baos, "UTF-8"));
+ ex.printStackTrace(stream);
+ stream.close();
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put(Stomp.Headers.Error.MESSAGE, ex.getMessage());
+
+ final String receiptId = (String)frame.getHeaders().get(Stomp.Headers.RECEIPT_REQUESTED);
+ if (receiptId != null)
+ {
+ headers.put(Stomp.Headers.Response.RECEIPT_ID, receiptId);
+ }
+
+ StompFrame errorMessage = new StompFrame(Stomp.Responses.ERROR, headers, baos.toByteArray());
+ try
+ {
+ send(connection, errorMessage);
+ }
+ catch (IOException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ private StompFrame onSubscribe(StompFrame frame, HornetQServer server, RemotingConnection connection) throws Exception,
+ StompException,
+ HornetQException
+ {
+ Map<String, Object> headers = frame.getHeaders();
+ String queue = (String)headers.get(Stomp.Headers.Send.DESTINATION);
+ SimpleString queueName = SimpleString.toSimpleString(StompUtils.toHornetQAddress(queue));
+
+ ServerSession session = checkAndGetSession(connection);
+ long consumerID = server.getStorageManager().generateUniqueID();
+ session.createConsumer(consumerID, queueName, null, false);
+ session.receiveConsumerCredits(consumerID, -1);
+ session.start();
+
+ return null;
+ }
+
+ private ServerSession checkAndGetSession(RemotingConnection connection) throws StompException
+ {
+ ServerSession session = sessions.get(connection);
+ if (session == null)
+ {
+ throw new StompException("Not connected");
+ }
+ return session;
+ }
+
+ private StompFrame onDisconnect(StompFrame frame, HornetQServer server, RemotingConnection connection) throws StompException
+ {
+ ServerSession session = checkAndGetSession(connection);
+ if (session != null)
+ {
+ try
+ {
+ session.close();
+ }
+ catch (Exception e)
+ {
+ throw new StompException(e.getMessage());
+ }
+ sessions.remove(connection);
+ }
+ return null;
+ }
+
+ private StompFrame onSend(StompFrame frame, HornetQServer server, RemotingConnection connection) throws Exception
+ {
+ ServerSession session = checkAndGetSession(connection);
+
+ Map<String, Object> headers = frame.getHeaders();
+ String queue = (String)headers.get(Stomp.Headers.Send.DESTINATION);
+ /*
+ String type = (String)headers.get(Stomp.Headers.Send.TYPE);
+ long expiration = (Long)headers.get(Stomp.Headers.Send.EXPIRATION_TIME);
+ byte priority = (Byte)headers.get(Stomp.Headers.Send.PRIORITY);
+ boolean durable = (Boolean)headers.get(Stomp.Headers.Send.PERSISTENT);
+ */
+ byte type = Message.TEXT_TYPE;
+ if (headers.containsKey(Stomp.Headers.CONTENT_LENGTH))
+ {
+ type = Message.BYTES_TYPE;
+ }
+ long timestamp = System.currentTimeMillis();
+ boolean durable = false;
+ long expiration = -1;
+ byte priority = 9;
+ SimpleString address = SimpleString.toSimpleString(StompUtils.toHornetQAddress(queue));
+
+ ServerMessage message = new ServerMessageImpl(server.getStorageManager().generateUniqueID(), 512);
+ message.setType(type);
+ message.setTimestamp(timestamp);
+ message.setAddress(address);
+ byte[] content = frame.getContent();
+ if (type == Message.TEXT_TYPE)
+ {
+ message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(new String(content)));
+ }
+ else
+ {
+ message.getBodyBuffer().writeBytes(content);
+ }
+
+ session.send(message);
+ if (headers.containsKey(Stomp.Headers.RECEIPT_REQUESTED))
+ {
+ Map<String, Object> h = new HashMap<String, Object>();
+ h.put(Stomp.Headers.Response.RECEIPT_ID, headers.get(Stomp.Headers.RECEIPT_REQUESTED));
+ return new StompFrame(Stomp.Responses.RECEIPT, h, new byte[] {});
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private StompFrame onConnect(StompFrame frame, HornetQServer server, final RemotingConnection connection) throws Exception
+ {
+ Map<String, Object> headers = frame.getHeaders();
+ String login = (String)headers.get(Stomp.Headers.Connect.LOGIN);
+ String passcode = (String)headers.get(Stomp.Headers.Connect.PASSCODE);
+ String requestID = (String)headers.get(Stomp.Headers.Connect.REQUEST_ID);
+
+ String name = UUIDGenerator.getInstance().generateStringUUID();
+ ServerSession session = server.createSession(name,
+ login,
+ passcode,
+ HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ connection,
+ true,
+ true,
+ false,
+ false,
+ new StompSessionCallback(marshaller, connection));
+ sessions.put(connection, session);
+ System.out.println(">>> created session " + session);
+ HashMap<String, Object> h = new HashMap<String, Object>();
+ h.put(Stomp.Headers.Connected.SESSION, name);
+ h.put(Stomp.Headers.Connected.RESPONSE_ID, requestID);
+ return new StompFrame(Stomp.Responses.CONNECTED, h, new byte[] {});
+ }
+
+ private void send(RemotingConnection connection, StompFrame frame) throws IOException
+ {
+ System.out.println("SENDING >>> " + frame);
+ byte[] bytes = marshaller.marshal(frame);
+ HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(bytes);
+ System.out.println("ready to send reply: " + buffer);
+ connection.getTransportConnection().write(buffer, true);
+ }
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ return -1;
+ }
+
+}
Added: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompProtocolManagerFactory.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompProtocolManagerFactory.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompProtocolManagerFactory.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2010 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.protocol.stomp;
+
+import java.util.List;
+
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.ProtocolManagerFactory;
+
+/**
+ * A StompProtocolManagerFactory
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+public class StompProtocolManagerFactory implements ProtocolManagerFactory
+{
+
+ public ProtocolManager createProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
+ {
+ return new StompProtocolManager(server, interceptors);
+ }
+
+}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompSessionCallback.java (from rev 8836, branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompSessionCallback.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompSessionCallback.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompSessionCallback.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2010 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.protocol.stomp;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.Message;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.server.ServerMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.protocol.SessionCallback;
+
+/**
+ * A StompSessionCallback
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ */
+class StompSessionCallback implements SessionCallback
+{
+ private final RemotingConnection connection;
+
+ private final StompMarshaller marshaller;
+
+ StompSessionCallback(final StompMarshaller marshaller, final RemotingConnection connection)
+ {
+ this.marshaller = marshaller;
+ this.connection = connection;
+ }
+
+ public void sendProducerCreditsMessage(int credits, SimpleString address, int offset)
+ {
+ }
+
+ public int sendMessage(ServerMessage serverMessage, long consumerID, int deliveryCount)
+ {
+ try
+ {
+ Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put(Stomp.Headers.Message.DESTINATION, StompUtils.toStompDestination(serverMessage.getAddress()
+ .toString()));
+ byte[] data = new byte[] {};
+ if (serverMessage.getType() == Message.TEXT_TYPE)
+ {
+ SimpleString text = serverMessage.getBodyBuffer().readNullableSimpleString();
+ if (text != null)
+ {
+ data = text.toString().getBytes();
+ }
+ }
+ StompFrame msg = new StompFrame(Stomp.Responses.MESSAGE, headers, data);
+ System.out.println("SENDING : " + msg);
+ byte[] bytes = marshaller.marshal(msg);
+ HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(bytes);
+ connection.getTransportConnection().write(buffer, true);
+
+ return bytes.length;
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ return 0;
+ }
+
+ }
+
+ public int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse)
+ {
+ return 0;
+ }
+
+ public int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount)
+ {
+ return 0;
+ }
+
+ public void closed()
+ {
+ }
+}
\ No newline at end of file
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompUtils.java (from rev 8830, branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompUtils.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompUtils.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/stomp/StompUtils.java 2010-01-22 12:46:06 UTC (rev 8840)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2010 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.protocol.stomp;
+
+import org.hornetq.api.core.HornetQException;
+
+/**
+ * A StompUtils
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+class StompUtils
+{
+
+ public static String HQ_QUEUE_PREFIX = "jms.queue.";
+
+ public static String STOMP_QUEUE_PREFIX = "/queue/";
+
+ public static String HQ_TEMP_QUEUE_PREFIX = "jms.tempqueue.";
+
+ public static String STOMP_TEMP_QUEUE_PREFIX = "/temp-queue/";
+
+ public static String HQ_TOPIC_PREFIX = "jms.topic.";
+
+ public static String STOMP_TOPIC_PREFIX = "/topic/";
+
+ public static String HQ_TEMP_TOPIC_PREFIX = "jms.temptopic.";
+
+ public static String STOMP_TEMP_TOPIC_PREFIX = "/temp-topic/";
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ public static String toHornetQAddress(String stompDestination) throws HornetQException
+ {
+ if (stompDestination == null)
+ {
+ throw new HornetQException(HornetQException.ILLEGAL_STATE, "No destination is specified!");
+ }
+ else if (stompDestination.startsWith(STOMP_QUEUE_PREFIX))
+ {
+ return convert(stompDestination, STOMP_QUEUE_PREFIX, HQ_QUEUE_PREFIX);
+ }
+ else if (stompDestination.startsWith(STOMP_TOPIC_PREFIX))
+ {
+ return convert(stompDestination, STOMP_TOPIC_PREFIX, HQ_TOPIC_PREFIX);
+ }
+ else if (stompDestination.startsWith(STOMP_TEMP_QUEUE_PREFIX))
+ {
+ return convert(stompDestination, STOMP_TEMP_QUEUE_PREFIX, HQ_TEMP_QUEUE_PREFIX);
+ }
+ else if (stompDestination.startsWith(STOMP_TEMP_TOPIC_PREFIX))
+ {
+ return convert(stompDestination, STOMP_TEMP_TOPIC_PREFIX, HQ_TEMP_TOPIC_PREFIX);
+ }
+ else
+ {
+ throw new HornetQException(HornetQException.ILLEGAL_STATE, "Illegal destination name: [" + stompDestination +
+ "] -- StompConnect destinations " +
+ "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/");
+ }
+ }
+
+ public static String toStompDestination(String hornetqAddress) throws HornetQException
+ {
+ if (hornetqAddress == null)
+ {
+ throw new HornetQException(HornetQException.ILLEGAL_STATE, "No destination is specified!");
+ }
+ else if (hornetqAddress.startsWith(HQ_QUEUE_PREFIX))
+ {
+ return convert(hornetqAddress, HQ_QUEUE_PREFIX, STOMP_QUEUE_PREFIX);
+ }
+ else if (hornetqAddress.startsWith(HQ_TOPIC_PREFIX))
+ {
+ return convert(hornetqAddress, HQ_TOPIC_PREFIX, STOMP_TOPIC_PREFIX);
+ }
+ else if (hornetqAddress.startsWith(HQ_TEMP_QUEUE_PREFIX))
+ {
+ return convert(hornetqAddress, HQ_TEMP_QUEUE_PREFIX, STOMP_TEMP_QUEUE_PREFIX);
+ }
+ else if (hornetqAddress.startsWith(HQ_TEMP_TOPIC_PREFIX))
+ {
+ return convert(hornetqAddress, HQ_TEMP_TOPIC_PREFIX, STOMP_TEMP_TOPIC_PREFIX);
+ }
+ else
+ {
+ throw new HornetQException(HornetQException.ILLEGAL_STATE, "Illegal address name: [" + hornetqAddress +
+ "] -- Acceptable address must comply to JMS semantics");
+ }
+ }
+
+ private static String convert(String str, String oldPrefix, String newPrefix)
+ {
+ String sub = str.substring(oldPrefix.length(), str.length());
+ return new String(newPrefix + sub);
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
14 years, 11 months
JBoss hornetq SVN: r8839 - in branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq: core/protocol/core/impl and 1 other directory.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-01-22 07:23:23 -0500 (Fri, 22 Jan 2010)
New Revision: 8839
Modified:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/api/core/Message.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* updated code with trunk's refactoring of protocol support
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/api/core/Message.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/api/core/Message.java 2010-01-22 12:22:23 UTC (rev 8838)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/api/core/Message.java 2010-01-22 12:23:23 UTC (rev 8839)
@@ -70,6 +70,18 @@
public static final SimpleString HDR_LAST_VALUE_NAME = new SimpleString("_HQ_LVQ_NAME");
+ public static final byte DEFAULT_TYPE = 0;
+
+ public static final byte OBJECT_TYPE = 2;
+
+ public static final byte TEXT_TYPE = 3;
+
+ public static final byte BYTES_TYPE = 4;
+
+ public static final byte MAP_TYPE = 5;
+
+ public static final byte STREAM_TYPE = 6;
+
/**
* Returns the messageID.
* <br>
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2010-01-22 12:22:23 UTC (rev 8838)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2010-01-22 12:23:23 UTC (rev 8839)
@@ -30,6 +30,7 @@
import org.hornetq.core.server.HornetQServer;
import org.hornetq.spi.core.protocol.ConnectionEntry;
import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.spi.core.remoting.Connection;
/**
@@ -120,7 +121,7 @@
sessionHandlers.remove(name);
}
- public void bufferReceived(Object connectionID, HornetQBuffer buffer)
+ public void handleBuffer(RemotingConnection connection, HornetQBuffer buffer)
{
}
14 years, 11 months
JBoss hornetq SVN: r8838 - in branches/HORNETQ-129_STOMP_protocol: src/main/org/hornetq/core/remoting/server/impl and 8 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-01-22 07:22:23 -0500 (Fri, 22 Jan 2010)
New Revision: 8838
Removed:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ServerHolder.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/DummyServerHolder.java
Modified:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.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/integration/transports/netty/ChannelPipelineSupport.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQBytesMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQMapMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQObjectMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQStreamMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQTextMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.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/integration/stomp/StompTest.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
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* updated code with trunk's refactoring of protocol support
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -23,7 +23,6 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.server.management.NotificationService;
-import org.hornetq.integration.transports.netty.ServerHolder;
import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -64,7 +63,6 @@
public InVMAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
- final ServerHolder holder,
final ConnectionLifeCycleListener listener,
final Executor threadPool)
{
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -17,7 +17,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
-import org.hornetq.integration.transports.netty.ServerHolder;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.AcceptorFactory;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -33,12 +32,11 @@
{
public Acceptor createAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
- final ServerHolder holder,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
final ScheduledExecutorService scheduledThreadPool)
{
- return new InVMAcceptor(configuration, handler, holder, listener, threadPool);
+ return new InVMAcceptor(configuration, handler, listener, threadPool);
}
public Set<String> getAllowableProperties()
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-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -22,6 +22,8 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
+import com.sun.corba.se.spi.activation.ServerHolder;
+
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
@@ -33,7 +35,6 @@
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.management.ManagementService;
-import org.hornetq.integration.transports.netty.ServerHolder;
import org.hornetq.spi.core.protocol.ConnectionEntry;
import org.hornetq.spi.core.protocol.ProtocolManager;
import org.hornetq.spi.core.protocol.ProtocolType;
@@ -170,27 +171,6 @@
Acceptor acceptor = factory.createAcceptor(info.getParams(),
new DelegatingBufferHandler(manager),
- new ServerHolder()
- {
- public HornetQServer getServer()
- {
- return server;
- }
-
- public RemotingConnection getRemotingConnection(int connectionID)
- {
- ConnectionEntry conn = connections.get(connectionID);
-
- if (conn != null)
- {
- return conn.connection;
- }
- else
- {
- return null;
- }
- }
- },
this,
threadPool,
scheduledThreadPool);
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -16,6 +16,7 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
+import org.hornetq.core.protocol.stomp.StompFrameDelimiter;
import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.jboss.netty.channel.ChannelPipeline;
@@ -53,6 +54,10 @@
{
pipeline.addLast("decoder", new HornetQFrameDecoder2());
}
+ else if (protocol == ProtocolType.STOMP)
+ {
+ pipeline.addLast("delimiter", new StompFrameDelimiter());
+ }
else
{
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -35,9 +35,6 @@
import org.hornetq.core.remoting.impl.ssl.SSLSupport;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.server.management.NotificationService;
-import org.hornetq.integration.protocol.stomp.StompChannelHandler;
-import org.hornetq.integration.protocol.stomp.StompFrameDecoder;
-import org.hornetq.integration.protocol.stomp.StompFrameDelimiter;
import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -136,19 +133,14 @@
private boolean paused;
- private ServerHolder serverHolder;
-
public NettyAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
- final ServerHolder serverHandler,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
final ScheduledExecutorService scheduledThreadPool)
{
this.handler = handler;
- this.serverHolder = serverHandler;
-
this.listener = listener;
sslEnabled = ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME,
@@ -295,6 +287,7 @@
pipeline.addLast("httpResponseEncoder", new HttpResponseEncoder());
pipeline.addLast("httphandler", new HttpAcceptorHandler(httpKeepAliveRunnable, httpResponseTime));
}
+ /*
if (protocol == ProtocolType.STOMP)
{
pipeline.addLast("delimiter", new StompFrameDelimiter());
@@ -305,10 +298,10 @@
new Listener()));
}
else
- {
- ChannelPipelineSupport.addCodecFilter(ProtocolType.CORE, pipeline, handler);
+ {*/
+ ChannelPipelineSupport.addCodecFilter(protocol, pipeline, handler);
pipeline.addLast("handler", new HornetQServerChannelHandler(channelGroup, handler, new Listener()));
- }
+// }
return pipeline;
}
};
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -18,7 +18,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
-import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.AcceptorFactory;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -33,12 +32,11 @@
{
public Acceptor createAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
- final ServerHolder serverHolder,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
final ScheduledExecutorService scheduledThreadPool)
{
- return new NettyAcceptor(configuration, handler, serverHolder, listener, threadPool, scheduledThreadPool);
+ return new NettyAcceptor(configuration, handler, listener, threadPool, scheduledThreadPool);
}
public Set<String> getAllowableProperties()
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ServerHolder.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ServerHolder.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ServerHolder.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -1,31 +0,0 @@
-/*
- * Copyright 2010 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.server.HornetQServer;
-import org.hornetq.spi.core.protocol.RemotingConnection;
-
-/**
- * A ServerHolder
- *
- * @author jmesnil
- *
- *
- */
-public interface ServerHolder
-{
- HornetQServer getServer();
-
- RemotingConnection getRemotingConnection(int connectionID);
-}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQBytesMessage.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQBytesMessage.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQBytesMessage.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -19,6 +19,7 @@
import javax.jms.MessageFormatException;
import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.Message;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.core.logging.Logger;
@@ -42,7 +43,7 @@
private static final Logger log = Logger.getLogger(HornetQBytesMessage.class);
- public static final byte TYPE = 4;
+ public static final byte TYPE = Message.BYTES_TYPE;
// Attributes ----------------------------------------------------
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQMapMessage.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQMapMessage.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQMapMessage.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -22,6 +22,7 @@
import javax.jms.MapMessage;
import javax.jms.MessageFormatException;
+import org.hornetq.api.core.Message;
import org.hornetq.api.core.PropertyConversionException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientMessage;
@@ -45,7 +46,7 @@
{
// Constants -----------------------------------------------------
- public static final byte TYPE = 5;
+ public static final byte TYPE = Message.MAP_TYPE;
// Attributes ----------------------------------------------------
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQMessage.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQMessage.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQMessage.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -83,7 +83,7 @@
private static final String JMSXGROUPID = "JMSXGroupID";
- public static final byte TYPE = 0;
+ public static final byte TYPE = org.hornetq.api.core.Message.DEFAULT_TYPE;
public static Map<String, Object> coreMaptoJMSMap(final Map<String, Object> coreMessage)
{
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQObjectMessage.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQObjectMessage.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQObjectMessage.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -22,6 +22,7 @@
import javax.jms.JMSException;
import javax.jms.ObjectMessage;
+import org.hornetq.api.core.Message;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientSession;
@@ -44,7 +45,7 @@
{
// Constants -----------------------------------------------------
- public static final byte TYPE = 2;
+ public static final byte TYPE = Message.OBJECT_TYPE;
// Attributes ----------------------------------------------------
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQStreamMessage.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQStreamMessage.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQStreamMessage.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -19,6 +19,7 @@
import javax.jms.StreamMessage;
import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.Message;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.core.client.impl.ClientMessageImpl;
@@ -48,7 +49,7 @@
private static final Logger log = Logger.getLogger(HornetQStreamMessage.class);
- public static final byte TYPE = 6;
+ public static final byte TYPE = Message.STREAM_TYPE;
// Attributes ----------------------------------------------------
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQTextMessage.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQTextMessage.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/jms/client/HornetQTextMessage.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -17,6 +17,7 @@
import javax.jms.TextMessage;
import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientSession;
@@ -42,7 +43,7 @@
{
// Constants -----------------------------------------------------
- public static final byte TYPE = 3;
+ public static final byte TYPE = Message.TEXT_TYPE;
public static final Logger log = Logger.getLogger(HornetQTextMessage.class);
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -14,7 +14,6 @@
package org.hornetq.spi.core.protocol;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
/**
@@ -24,11 +23,14 @@
*
*
*/
-public interface ProtocolManager extends BufferHandler
+public interface ProtocolManager
{
ConnectionEntry createConnectionEntry(Connection connection);
public void removeHandler(final String name);
public int isReadyToHandle(HornetQBuffer buffer);
+
+ void handleBuffer(RemotingConnection connection, HornetQBuffer buffer);
+
}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -18,12 +18,10 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
-import org.hornetq.integration.transports.netty.ServerHolder;
-
/**
* A factory for creating acceptors.
* <p/>
- * An Acceptor is an endpoin that a {@link org.hornetq.spi.core.remoting.Connector} will connect to and is used by the remoting service.
+ * An Acceptor is an endpoint that a {@link org.hornetq.spi.core.remoting.Connector} will connect to and is used by the remoting service.
*
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
* @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
@@ -43,7 +41,6 @@
*/
Acceptor createAcceptor(final Map<String, Object> configuration,
BufferHandler handler,
- ServerHolder holder,
ConnectionLifeCycleListener listener,
Executor threadPool,
ScheduledExecutorService scheduledThreadPool);
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-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/BufferHandler.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -24,9 +24,8 @@
public interface BufferHandler
{
/**
- * called by the remoting connection when a buffer is received.
+ * called when a buffer is received.
*
- * @param connectionID the connection the buffer was received on
* @param buffer the buffer to decode
*/
void bufferReceived(Object connectionID, 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-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -32,7 +32,6 @@
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
-import org.hornetq.tests.unit.core.remoting.impl.netty.DummyServerHolder;
import org.hornetq.tests.util.UnitTestCase;
/**
@@ -99,8 +98,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- DummyServerHolder serverHolder = new DummyServerHolder();
- acceptor = new NettyAcceptor(conf, acceptorHandler, serverHolder, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
acceptor.start();
SimpleBufferHandler2 connectorHandler = new SimpleBufferHandler2(connectorLatch);
@@ -154,8 +152,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- DummyServerHolder serverHolder = new DummyServerHolder();
- acceptor = new NettyAcceptor(conf, acceptorHandler, serverHolder, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
acceptor.start();
SimpleBufferHandler2 connectorHandler = new SimpleBufferHandler2(connectorLatch);
@@ -213,8 +210,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- DummyServerHolder serverHolder = new DummyServerHolder();
- acceptor = new NettyAcceptor(conf, acceptorHandler, serverHolder, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
acceptor.start();
SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -273,8 +269,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- DummyServerHolder serverHolder = new DummyServerHolder();
- acceptor = new NettyAcceptor(conf, acceptorHandler, serverHolder, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
acceptor.start();
SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -332,8 +327,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME, 500l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- DummyServerHolder serverHolder = new DummyServerHolder();
- acceptor = new NettyAcceptor(conf, acceptorHandler, serverHolder, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
acceptor.start();
SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -387,8 +381,7 @@
conf.put(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME, 5000l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- DummyServerHolder serverHolder = new DummyServerHolder();
- acceptor = new NettyAcceptor(conf, acceptorHandler, serverHolder, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
acceptor.start();
BogusResponseHandler connectorHandler = new BogusResponseHandler(connectorLatch);
@@ -435,8 +428,7 @@
conf.put(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME, 5000l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler2 acceptorHandler = new SimpleBufferHandler2(acceptorLatch);
- DummyServerHolder serverHolder = new DummyServerHolder();
- acceptor = new NettyAcceptor(conf, acceptorHandler, serverHolder, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
acceptor.start();
BogusResponseHandler connectorHandler = new BogusResponseHandler(connectorLatch);
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -45,11 +45,11 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.stomp.Stomp;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
-import org.hornetq.integration.protocol.stomp.Stomp;
import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
import org.hornetq.integration.transports.netty.TransportConstants;
import org.hornetq.jms.client.HornetQConnectionFactory;
@@ -69,12 +69,12 @@
private Connection connection;
private Session session;
private Queue queue;
- private JMSServerManager server;
+ private JMSServerManager server;
public void testConnect() throws Exception {
- String connect_frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "request-id: 1\n" + "\n" + Stomp.NULL;
- sendFrame(connect_frame);
+ String connect_frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n" + "request-id: 1\n" + "\n" + Stomp.NULL;
+ sendFrame(connect_frame);
String f = receiveFrame(10000);
Assert.assertTrue(f.startsWith("CONNECTED"));
Deleted: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/DummyServerHolder.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/DummyServerHolder.java 2010-01-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/DummyServerHolder.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -1,57 +0,0 @@
-/*
- * Copyright 2010 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.tests.unit.core.remoting.impl.netty;
-
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.integration.transports.netty.ServerHolder;
-
-/**
- * A DummyServerHolder
- *
- * @author jmesnil
- *
- *
- */
-public class DummyServerHolder implements ServerHolder
-{
- public HornetQServer getServer()
- {
- return null;
- }
-
- public CoreRemotingConnection getRemotingConnection(int connectionID)
- {
- return null;
- }
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
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-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -23,7 +23,6 @@
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
-import org.hornetq.integration.transports.netty.ServerHolder;
import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -68,10 +67,8 @@
{
}
};
- ServerHolder holder = new DummyServerHolder();
Acceptor acceptor = factory.createAcceptor(params,
handler,
- holder,
listener,
Executors.newCachedThreadPool(),
Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE));
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-22 11:06:32 UTC (rev 8837)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java 2010-01-22 12:22:23 UTC (rev 8838)
@@ -23,7 +23,6 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.integration.transports.netty.NettyAcceptor;
-import org.hornetq.integration.transports.netty.ServerHolder;
import org.hornetq.integration.transports.netty.TransportConstants;
import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -82,11 +81,9 @@
{
}
};
- ServerHolder holder = new DummyServerHolder();
NettyAcceptor acceptor = new NettyAcceptor(params,
handler,
- holder,
listener,
Executors.newCachedThreadPool(),
Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE));
14 years, 11 months
JBoss hornetq SVN: r8837 - in trunk: src/main/org/hornetq/core/protocol/aardvark/impl and 8 other directories.
by do-not-reply@jboss.org
Author: timfox
Date: 2010-01-22 06:06:32 -0500 (Fri, 22 Jan 2010)
New Revision: 8837
Added:
trunk/src/main/org/hornetq/spi/core/remoting/BufferDecoder.java
Removed:
trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java
Modified:
trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java
trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java
trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder2.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java
trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java
trunk/src/main/org/hornetq/spi/core/remoting/BufferHandler.java
trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
Log:
removed the buffer decoding abstraction from the handler
Modified: trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -39,7 +39,6 @@
import org.hornetq.core.protocol.core.ChannelHandler;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
@@ -48,6 +47,7 @@
import org.hornetq.core.remoting.FailureListener;
import org.hornetq.core.version.Version;
import org.hornetq.spi.core.protocol.ProtocolType;
+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;
@@ -1085,7 +1085,7 @@
}
}
- private class DelegatingBufferHandler extends AbstractBufferHandler
+ private class DelegatingBufferHandler implements BufferHandler
{
public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
{
Modified: trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -130,10 +130,4 @@
{
manager.handleBuffer(this, buffer);
}
-
- public int isReadyToHandle(HornetQBuffer buffer)
- {
- return -1;
- }
-
}
Deleted: trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -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.protocol.core.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@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: trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -124,6 +124,8 @@
{
}
+ //This is never called using the core protocol, since we override the HornetQFrameDecoder with our core
+ //optimised version HornetQFrameDecoder2, which nevers calls this
public int isReadyToHandle(HornetQBuffer buffer)
{
return -1;
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -31,6 +31,7 @@
import org.hornetq.core.protocol.core.Packet;
import org.hornetq.core.remoting.CloseListener;
import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.utils.SimpleIDGenerator;
@@ -39,7 +40,7 @@
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
* @version <tt>$Revision$</tt> $Id$
*/
-public class RemotingConnectionImpl extends AbstractBufferHandler implements CoreRemotingConnection
+public class RemotingConnectionImpl implements BufferHandler, CoreRemotingConnection
{
// Constants
// ------------------------------------------------------------------------------------
Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -46,7 +46,7 @@
private final int id;
private final BufferHandler handler;
-
+
private final ConnectionLifeCycleListener listener;
private final ConcurrentMap<String, Connection> connections = new ConcurrentHashMap<String, Connection>();
@@ -62,13 +62,13 @@
private final ProtocolType protocol;
public InVMAcceptor(final Map<String, Object> configuration,
- final BufferHandler handler,
+ final BufferHandler handler,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
final ProtocolType protocol)
{
this.handler = handler;
-
+
this.listener = listener;
id = ConfigurationHelper.getIntProperty(TransportConstants.SERVER_ID_PROP_NAME, 0, configuration);
Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -20,6 +20,7 @@
import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.AcceptorFactory;
+import org.hornetq.spi.core.remoting.BufferDecoder;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -33,6 +34,7 @@
{
public Acceptor createAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
+ final BufferDecoder decoder,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
final ScheduledExecutorService scheduledThreadPool,
Modified: trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -70,8 +70,6 @@
private final Map<Object, ConnectionEntry> connections = new ConcurrentHashMap<Object, ConnectionEntry>();
- //private final BufferHandler bufferHandler = new DelegatingBufferHandler();
-
private final Configuration config;
private final HornetQServer server;
@@ -169,6 +167,7 @@
Acceptor acceptor = factory.createAcceptor(info.getParams(),
new DelegatingBufferHandler(manager),
+ manager,
this,
threadPool,
scheduledThreadPool,
@@ -405,11 +404,6 @@
conn.connection.bufferReceived(connectionID, buffer);
}
}
-
- public int isReadyToHandle(HornetQBuffer buffer)
- {
- return manager.isReadyToHandle(buffer);
- }
}
private final class FailureCheckAndFlushThread extends Thread
Modified: trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -17,7 +17,7 @@
import javax.net.ssl.SSLEngine;
import org.hornetq.spi.core.protocol.ProtocolType;
-import org.hornetq.spi.core.remoting.BufferHandler;
+import org.hornetq.spi.core.remoting.BufferDecoder;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.ssl.SslHandler;
@@ -45,18 +45,19 @@
// Public --------------------------------------------------------
- public static void addCodecFilter(final ProtocolType protocol, final ChannelPipeline pipeline, final BufferHandler handler)
+ public static void addCodecFilter(final ProtocolType protocol, final ChannelPipeline pipeline, final BufferDecoder decoder)
{
assert pipeline != null;
if (protocol == ProtocolType.CORE)
{
+ //Core protocol uses it's own optimised decoder
pipeline.addLast("decoder", new HornetQFrameDecoder2());
}
else
{
//Use the old frame decoder for other protocols
- pipeline.addLast("decoder", new HornetQFrameDecoder(handler));
+ pipeline.addLast("decoder", new HornetQFrameDecoder(decoder));
}
}
Modified: trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -15,8 +15,7 @@
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.hornetq.spi.core.remoting.BufferDecoder;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
@@ -36,11 +35,11 @@
{
private static final Logger log = Logger.getLogger(HornetQFrameDecoder.class);
- private final BufferHandler handler;
+ private final BufferDecoder decoder;
- public HornetQFrameDecoder(final BufferHandler handler)
+ public HornetQFrameDecoder(final BufferDecoder decoder)
{
- this.handler = handler;
+ this.decoder = decoder;
}
// FrameDecoder overrides
@@ -48,34 +47,24 @@
@Override
protected Object decode(final ChannelHandlerContext ctx, final Channel channel, final ChannelBuffer in) throws Exception
- {
- log.info("dewcoding!!");
-
+ {
int start = in.readerIndex();
- int length = handler.isReadyToHandle(new ChannelBufferWrapper(in));
+ int length = decoder.isReadyToHandle(new ChannelBufferWrapper(in));
- log.info("length is " + length);
-
in.readerIndex(start);
- log.info("length is 2 " + length);
-
if (length == -1)
{
return null;
}
- log.info("creating buffer");
-
ChannelBuffer buffer = in.readBytes(length);
ChannelBuffer newBuffer = ChannelBuffers.dynamicBuffer(buffer.writerIndex());
newBuffer.writeBytes(buffer);
- log.info("got the buffer");
-
return newBuffer;
}
}
Modified: trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder2.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder2.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder2.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -24,7 +24,7 @@
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
/**
- * A Netty decoder used to decode messages.
+ * A Netty decoder specially optimised to to decode messages on the core protocol only
*
* @author <a href="tlee(a)redhat.com">Trustin Lee</a>
*
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -36,6 +36,7 @@
import org.hornetq.core.server.management.NotificationService;
import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
+import org.hornetq.spi.core.remoting.BufferDecoder;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -88,6 +89,8 @@
private ServerBootstrap bootstrap;
private final BufferHandler handler;
+
+ private final BufferDecoder decoder;
private final ConnectionLifeCycleListener listener;
@@ -137,12 +140,15 @@
public NettyAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
+ final BufferDecoder decoder,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
final ScheduledExecutorService scheduledThreadPool,
final ProtocolType protocol)
{
this.handler = handler;
+
+ this.decoder = decoder;
this.listener = listener;
@@ -288,7 +294,7 @@
pipeline.addLast("httphandler", new HttpAcceptorHandler(httpKeepAliveRunnable, httpResponseTime));
}
- ChannelPipelineSupport.addCodecFilter(protocol, pipeline, handler);
+ ChannelPipelineSupport.addCodecFilter(protocol, pipeline, decoder);
pipeline.addLast("handler", new HornetQServerChannelHandler(channelGroup, handler, new Listener()));
return pipeline;
}
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -21,6 +21,7 @@
import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.AcceptorFactory;
+import org.hornetq.spi.core.remoting.BufferDecoder;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -33,12 +34,13 @@
{
public Acceptor createAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
+ final BufferDecoder decoder,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
final ScheduledExecutorService scheduledThreadPool,
final ProtocolType protocol)
{
- return new NettyAcceptor(configuration, handler, listener, threadPool, scheduledThreadPool,
+ return new NettyAcceptor(configuration, handler, decoder, listener, threadPool, scheduledThreadPool,
protocol);
}
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -311,7 +311,7 @@
pipeline.addLast("httpResponseDecoder", new HttpResponseDecoder());
pipeline.addLast("httphandler", new HttpHandler());
}
- ChannelPipelineSupport.addCodecFilter(ProtocolType.CORE, pipeline, handler);
+ ChannelPipelineSupport.addCodecFilter(ProtocolType.CORE, pipeline, null);
pipeline.addLast("handler", new HornetQClientChannelHandler(channelGroup, handler, new Listener()));
return pipeline;
}
Modified: trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -13,6 +13,7 @@
package org.hornetq.spi.core.protocol;
+import org.hornetq.spi.core.remoting.BufferDecoder;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
@@ -23,7 +24,7 @@
*
*
*/
-public interface ProtocolManager extends BufferHandler
+public interface ProtocolManager extends BufferHandler, BufferDecoder
{
ConnectionEntry createConnectionEntry(Connection connection);
}
Modified: trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -36,6 +36,7 @@
*
* @param configuration the configuration
* @param handler the handler
+ * @param decoder the decoder
* @param listener the listener
* @param threadPool the threadpool
* @param scheduledThreadPool a scheduled thread pool
@@ -43,6 +44,7 @@
*/
Acceptor createAcceptor(final Map<String, Object> configuration,
BufferHandler handler,
+ BufferDecoder decoder,
ConnectionLifeCycleListener listener,
Executor threadPool,
ScheduledExecutorService scheduledThreadPool,
Added: trunk/src/main/org/hornetq/spi/core/remoting/BufferDecoder.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/remoting/BufferDecoder.java (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/remoting/BufferDecoder.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 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.spi.core.remoting;
+
+import org.hornetq.api.core.HornetQBuffer;
+
+/**
+ * A BufferDecoder
+ *
+ * @author tim
+ *
+ *
+ */
+public interface BufferDecoder
+{
+ /**
+ * called by the remoting system 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: trunk/src/main/org/hornetq/spi/core/remoting/BufferHandler.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/remoting/BufferHandler.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/src/main/org/hornetq/spi/core/remoting/BufferHandler.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -29,15 +29,5 @@
* @param connectionID the connection the buffer was received on
* @param buffer the buffer to decode
*/
- void bufferReceived(Object connectionID, HornetQBuffer buffer);
-
- /**
- * 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);
+ void bufferReceived(Object connectionID, HornetQBuffer buffer);
}
Modified: trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -25,7 +25,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.NettyConnector;
import org.hornetq.integration.transports.netty.TransportConstants;
@@ -99,7 +98,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, null, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler2 connectorHandler = new SimpleBufferHandler2(connectorLatch);
@@ -153,7 +152,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, null, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler2 connectorHandler = new SimpleBufferHandler2(connectorLatch);
@@ -211,7 +210,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, null, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -270,7 +269,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, null, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -328,7 +327,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME, 500l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, null, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -382,7 +381,7 @@
conf.put(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME, 5000l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, null, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
BogusResponseHandler connectorHandler = new BogusResponseHandler(connectorLatch);
@@ -429,7 +428,7 @@
conf.put(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME, 5000l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler2 acceptorHandler = new SimpleBufferHandler2(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, null, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
BogusResponseHandler connectorHandler = new BogusResponseHandler(connectorLatch);
@@ -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;
@@ -525,11 +524,6 @@
this.latch = latch;
}
- public int isReadyToHandle(final HornetQBuffer buffer)
- {
- return 0;
- }
-
public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
{
int i = buffer.readInt();
Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -21,7 +21,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
import org.hornetq.spi.core.protocol.ProtocolType;
@@ -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(final Object connectionID, final HornetQBuffer buffer)
@@ -71,6 +70,7 @@
Acceptor acceptor = factory.createAcceptor(params,
handler,
+ null,
listener,
Executors.newCachedThreadPool(),
Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE),
Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -22,7 +22,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.TransportConstants;
import org.hornetq.spi.core.protocol.ProtocolType;
@@ -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)
@@ -84,6 +83,7 @@
};
NettyAcceptor acceptor = new NettyAcceptor(params,
handler,
+ null,
listener,
Executors.newCachedThreadPool(),
Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE),
Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java 2010-01-22 10:29:26 UTC (rev 8836)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java 2010-01-22 11:06:32 UTC (rev 8837)
@@ -21,7 +21,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
import org.hornetq.integration.transports.netty.NettyConnector;
import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -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)
{
@@ -73,7 +72,7 @@
};
NettyConnector connector = new NettyConnector(params,
- handler,
+ handler,
listener,
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool(),
@@ -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)
{
14 years, 11 months
JBoss hornetq SVN: r8836 - in branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq: core/protocol/core/impl and 16 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-01-22 05:29:26 -0500 (Fri, 22 Jan 2010)
New Revision: 8836
Added:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolType.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/SessionCallback.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/utils/XidCodecSupport.java
Removed:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/ChannelImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/PacketDecoder.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/PacketImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/wireformat/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/ProtocolType.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/RemotingConnection.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/ProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/SessionCallback.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolType.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/SessionCallback.java
Modified:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreSessionCallback.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/Packet.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/CloseListener.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/RemotingService.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/core/replication/impl/ReplicationEndpointImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/HornetQServer.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/ServerSession.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/cluster/Bridge.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompChannelHandler.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompSessionCallback.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyConnection.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ServerHolder.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/TransportConstants.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* sync with the trunk: svn merge -r 8821:8832 https://svn.jboss.org/repos/hornetq/trunk
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/ChannelImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/ChannelImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/ChannelImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,508 +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.protocol.core;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.PacketsConfirmedMessage;
-import org.hornetq.core.remoting.RemotingConnection;
-
-/**
- * A ChannelImpl
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- */
-public class ChannelImpl implements Channel
-{
- private static final Logger log = Logger.getLogger(ChannelImpl.class);
-
- private volatile long id;
-
- private ChannelHandler handler;
-
- private Packet response;
-
- private final java.util.Queue<Packet> resendCache;
-
- private volatile int firstStoredCommandID;
-
- private volatile int lastConfirmedCommandID = -1;
-
- private volatile CoreRemotingConnection connection;
-
- private volatile boolean closed;
-
- private final Lock lock = new ReentrantLock();
-
- private final Condition sendCondition = lock.newCondition();
-
- private final Condition failoverCondition = lock.newCondition();
-
- private final Object sendLock = new Object();
-
- private final Object sendBlockingLock = new Object();
-
- private boolean failingOver;
-
- private final int confWindowSize;
-
- private int receivedBytes;
-
- private CommandConfirmationHandler commandConfirmationHandler;
-
- private volatile boolean transferring;
-
- public ChannelImpl(final CoreRemotingConnection connection, final long id, final int confWindowSize)
- {
- this.connection = connection;
-
- this.id = id;
-
- this.confWindowSize = confWindowSize;
-
- if (confWindowSize != -1)
- {
- resendCache = new ConcurrentLinkedQueue<Packet>();
- }
- else
- {
- resendCache = null;
- }
- }
-
- public long getID()
- {
- return id;
- }
-
- public int getLastConfirmedCommandID()
- {
- return lastConfirmedCommandID;
- }
-
- public Lock getLock()
- {
- return lock;
- }
-
- public int getConfirmationWindowSize()
- {
- return confWindowSize;
- }
-
- public void returnBlocking()
- {
- lock.lock();
-
- try
- {
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.UNBLOCKED,
- "Connection failure detected. Unblocking a blocking call that will never get a response"
-
- ));
-
- sendCondition.signal();
- }
- finally
- {
- lock.unlock();
- }
- }
-
- public void sendAndFlush(final Packet packet)
- {
- send(packet, true);
- }
-
- public void send(final Packet packet)
- {
- send(packet, false);
- }
-
- public void setTransferring(boolean transferring)
- {
- this.transferring = transferring;
- }
-
- // This must never called by more than one thread concurrently
- public void send(final Packet packet, final boolean flush)
- {
- synchronized (sendLock)
- {
- packet.setChannelID(id);
-
- final HornetQBuffer buffer = packet.encode(connection);
-
- lock.lock();
-
- try
- {
- while (failingOver)
- {
- // TODO - don't hardcode this timeout
- try
- {
- failoverCondition.await(10000, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e)
- {
- }
- }
-
- //Sanity check
- if (transferring)
- {
- throw new IllegalStateException("Cannot send a packet while channel is doing failover");
- }
-
-
- if (resendCache != null && packet.isRequiresConfirmations())
- {
- resendCache.add(packet);
- }
-
- connection.getTransportConnection().write(buffer, flush);
- }
- finally
- {
- lock.unlock();
- }
- }
- }
-
- public Packet sendBlocking(final Packet packet) throws HornetQException
- {
- if (closed)
- {
- throw new HornetQException(HornetQException.NOT_CONNECTED, "Connection is destroyed");
- }
-
- if (connection.getBlockingCallTimeout() == -1)
- {
- throw new IllegalStateException("Cannot do a blocking call timeout on a server side connection");
- }
-
- // Synchronized since can't be called concurrently by more than one thread and this can occur
- // E.g. blocking acknowledge() from inside a message handler at some time as other operation on main thread
- synchronized (sendBlockingLock)
- {
- packet.setChannelID(id);
-
- final HornetQBuffer buffer = packet.encode(connection);
-
- lock.lock();
-
- try
- {
- while (failingOver)
- {
- // TODO - don't hardcode this timeout
- try
- {
- failoverCondition.await(10000, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e)
- {
- }
- }
-
- response = null;
-
- if (resendCache != null && packet.isRequiresConfirmations())
- {
- resendCache.add(packet);
- }
-
- connection.getTransportConnection().write(buffer);
-
- long toWait = connection.getBlockingCallTimeout();
-
- long start = System.currentTimeMillis();
-
- while (response == null && toWait > 0)
- {
- try
- {
- sendCondition.await(toWait, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e)
- {
- }
-
- if (closed)
- {
- break;
- }
-
- final long now = System.currentTimeMillis();
-
- toWait -= now - start;
-
- start = now;
- }
-
- if (response == null)
- {
- throw new HornetQException(HornetQException.CONNECTION_TIMEDOUT,
- "Timed out waiting for response when sending packet " + packet.getType());
- }
-
- if (response.getType() == PacketImpl.EXCEPTION)
- {
- final HornetQExceptionMessage mem = (HornetQExceptionMessage)response;
-
- HornetQException e = mem.getException();
-
- e.fillInStackTrace();
-
- throw e;
- }
- }
- finally
- {
- lock.unlock();
- }
-
- return response;
- }
- }
-
- public void setCommandConfirmationHandler(final CommandConfirmationHandler handler)
- {
- commandConfirmationHandler = handler;
- }
-
- public void setHandler(final ChannelHandler handler)
- {
- this.handler = handler;
- }
-
- public void close()
- {
- if (closed)
- {
- return;
- }
-
- if (!connection.isDestroyed() && !connection.removeChannel(id))
- {
- throw new IllegalArgumentException("Cannot find channel with id " + id + " to close");
- }
-
- closed = true;
- }
-
- public void transferConnection(final CoreRemotingConnection newConnection)
- {
- // Needs to synchronize on the connection to make sure no packets from
- // the old connection get processed after transfer has occurred
- synchronized (connection.getTransferLock())
- {
- connection.removeChannel(id);
-
- // And switch it
-
- final CoreRemotingConnection rnewConnection = (CoreRemotingConnection)newConnection;
-
- rnewConnection.putChannel(id, this);
-
- connection = rnewConnection;
-
- transferring = true;
- }
- }
-
- public void replayCommands(final int otherLastConfirmedCommandID)
- {
- if (resendCache != null)
- {
- clearUpTo(otherLastConfirmedCommandID);
-
- for (final Packet packet : resendCache)
- {
- doWrite(packet);
- }
- }
- }
-
- public void lock()
- {
- lock.lock();
-
- failingOver = true;
-
- lock.unlock();
- }
-
- public void unlock()
- {
- lock.lock();
-
- failingOver = false;
-
- failoverCondition.signalAll();
-
- lock.unlock();
- }
-
- public CoreRemotingConnection getConnection()
- {
- return connection;
- }
-
- //Needs to be synchronized since can be called by remoting service timer thread too for timeout flush
- public synchronized void flushConfirmations()
- {
- if (resendCache != null && receivedBytes != 0)
- {
- receivedBytes = 0;
-
- final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
-
- confirmed.setChannelID(id);
-
- doWrite(confirmed);
- }
- }
-
- public void confirm(final Packet packet)
- {
- if (resendCache != null && packet.isRequiresConfirmations())
- {
- lastConfirmedCommandID++;
-
- receivedBytes += packet.getPacketSize();
-
- if (receivedBytes >= confWindowSize)
- {
- receivedBytes = 0;
-
- final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
-
- confirmed.setChannelID(id);
-
- doWrite(confirmed);
- }
- }
- }
-
- public void clearCommands()
- {
- if (resendCache != null)
- {
- lastConfirmedCommandID = -1;
-
- firstStoredCommandID = 0;
-
- resendCache.clear();
- }
- }
-
- public void handlePacket(final Packet packet)
- {
- if (packet.getType() == PacketImpl.PACKETS_CONFIRMED)
- {
- if (resendCache != null)
- {
- final PacketsConfirmedMessage msg = (PacketsConfirmedMessage)packet;
-
- clearUpTo(msg.getCommandID());
- }
-
- if (!connection.isClient())
- {
- handler.handlePacket(packet);
- }
-
- return;
- }
- else
- {
- if (packet.isResponse())
- {
- confirm(packet);
-
- lock.lock();
-
- response = packet;
-
- try
- {
- sendCondition.signal();
- }
- finally
- {
- lock.unlock();
- }
- }
- else if (handler != null)
- {
- handler.handlePacket(packet);
- }
- }
- }
-
- private void doWrite(final Packet packet)
- {
- final HornetQBuffer buffer = packet.encode(connection);
-
- connection.getTransportConnection().write(buffer);
- }
-
- private void clearUpTo(final int lastReceivedCommandID)
- {
- final int numberToClear = 1 + lastReceivedCommandID - firstStoredCommandID;
-
- if (numberToClear == -1)
- {
- throw new IllegalArgumentException("Invalid lastReceivedCommandID: " + lastReceivedCommandID);
- }
-
- int sizeToFree = 0;
-
- for (int i = 0; i < numberToClear; i++)
- {
- final Packet packet = resendCache.poll();
-
- if (packet == null)
- {
- ChannelImpl.log.warn("Can't find packet to clear: " + " last received command id " +
- lastReceivedCommandID +
- " first stored command id " +
- firstStoredCommandID);
- return;
- }
-
- if (packet.getType() != PacketImpl.PACKETS_CONFIRMED)
- {
- sizeToFree += packet.getPacketSize();
- }
-
- if (commandConfirmationHandler != null)
- {
- commandConfirmationHandler.commandConfirmed(packet);
- }
- }
-
- firstStoredCommandID += numberToClear;
- }
-}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,116 +0,0 @@
-/*
- * Copyright 2010 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.protocol.core;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.protocol.core.wireformat.Ping;
-import org.hornetq.core.remoting.server.ConnectionEntry;
-import org.hornetq.core.remoting.server.ProtocolManager;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A CoreProtocolManager
- *
- * @author Tim Fox
- *
- *
- */
-public class CoreProtocolManager implements ProtocolManager
-{
- private final HornetQServer server;
-
- private final List<Interceptor> interceptors;
-
- public CoreProtocolManager(final HornetQServer server,
- final List<Interceptor> interceptors)
- {
- this.server = server;
-
- this.interceptors = interceptors;
- }
-
- public ConnectionEntry createConnectionEntry(final Connection connection)
- {
- final Configuration config = server.getConfiguration();
-
- CoreRemotingConnection rc = new RemotingConnectionImpl(connection,
- interceptors,
- config.isAsyncConnectionExecutionEnabled() ? server.getExecutorFactory().getExecutor()
- : null);
-
- Channel channel1 = rc.getChannel(1, -1);
-
- ChannelHandler handler = new HornetQPacketHandler(this, server, channel1, rc);
-
- channel1.setHandler(handler);
-
- long ttl = HornetQClient.DEFAULT_CONNECTION_TTL;
-
- if (config.getConnectionTTLOverride() != -1)
- {
- ttl = config.getConnectionTTLOverride();
- }
-
- final ConnectionEntry entry = new ConnectionEntry(rc, System.currentTimeMillis(), ttl);
-
- final Channel channel0 = rc.getChannel(0, -1);
-
- channel0.setHandler(new ChannelHandler()
- {
- public void handlePacket(final Packet packet)
- {
- if (packet.getType() == PacketImpl.PING)
- {
- Ping ping = (Ping)packet;
-
- if (config.getConnectionTTLOverride() == -1)
- {
- // Allow clients to specify connection ttl
- entry.ttl = ping.getConnectionTTL();
- }
-
- // Just send a ping back
- channel0.send(packet);
- }
- }
- });
-
- return entry;
- }
-
- private Map<String, ServerSessionPacketHandler> sessionHandlers =
- new ConcurrentHashMap<String, ServerSessionPacketHandler>();
-
- public ServerSessionPacketHandler getSessionHandler(final String sessionName)
- {
- return sessionHandlers.get(sessionName);
- }
-
- public void addSessionHandler(final String name, final ServerSessionPacketHandler handler)
- {
- sessionHandlers.put(name, handler);
- }
-
- public void removeHandler(final String name)
- {
- sessionHandlers.remove(name);
- }
-}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -13,7 +13,7 @@
package org.hornetq.core.protocol.core;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreSessionCallback.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreSessionCallback.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/CoreSessionCallback.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,13 +1,13 @@
package org.hornetq.core.protocol.core;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.server.ProtocolManager;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
import org.hornetq.core.server.ServerMessage;
-import org.hornetq.core.server.SessionCallback;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.SessionCallback;
/**
* A CoreSessionCallback
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,308 +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.protocol.core;
-
-import static org.hornetq.core.protocol.core.PacketImpl.CREATESESSION;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_REPLICATION;
-import static org.hornetq.core.protocol.core.PacketImpl.REATTACH_SESSION;
-
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.replication.ReplicationEndpoint;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.version.Version;
-
-/**
- * A packet handler for all packets that need to be handled at the server level
- *
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
- */
-public class HornetQPacketHandler implements ChannelHandler
-{
- private static final Logger log = Logger.getLogger(HornetQPacketHandler.class);
-
- private final HornetQServer server;
-
- private final Channel channel1;
-
- private final CoreRemotingConnection connection;
-
- private final CoreProtocolManager protocolManager;
-
- public HornetQPacketHandler(final CoreProtocolManager protocolManager,
- final HornetQServer server,
- final Channel channel1,
- final CoreRemotingConnection connection)
- {
- this.protocolManager = protocolManager;
-
- this.server = server;
-
- this.channel1 = channel1;
-
- this.connection = connection;
- }
-
- public void handlePacket(final Packet packet)
- {
- byte type = packet.getType();
-
- switch (type)
- {
- case CREATESESSION:
- {
- CreateSessionMessage request = (CreateSessionMessage)packet;
-
- handleCreateSession(request);
-
- break;
- }
- case REATTACH_SESSION:
- {
- ReattachSessionMessage request = (ReattachSessionMessage)packet;
-
- handleReattachSession(request);
-
- break;
- }
- case CREATE_QUEUE:
- {
- // Create queue can also be fielded here in the case of a replicated store and forward queue creation
-
- CreateQueueMessage request = (CreateQueueMessage)packet;
-
- handleCreateQueue(request);
-
- break;
- }
- case CREATE_REPLICATION:
- {
- // Create queue can also be fielded here in the case of a replicated store and forward queue creation
-
- CreateReplicationSessionMessage request = (CreateReplicationSessionMessage)packet;
-
- handleCreateReplication(request);
-
- break;
- }
- default:
- {
- HornetQPacketHandler.log.error("Invalid packet " + packet);
- }
- }
- }
-
- private void handleCreateSession(final CreateSessionMessage request)
- {
- boolean incompatibleVersion = false;
- Packet response;
- try
- {
- Version version = server.getVersion();
-
- if (version.getIncrementingVersion() != request.getVersion())
- {
- log.warn("Client with version " + request.getVersion() +
- " and address " +
- connection.getRemoteAddress() +
- " is not compatible with server version " +
- version.getFullVersion() +
- ". " +
- "Please ensure all clients and servers are upgraded to the same version for them to " +
- "interoperate properly");
- throw new HornetQException(HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS,
- "Server and client versions incompatible");
- }
-
- if (!server.isStarted())
- {
- throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED, "Server not started");
- }
-
- if (!server.checkActivate())
- {
- throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED,
- "Server will not accept create session requests");
- }
-
- final Channel channel = connection.getChannel(request.getSessionChannelID(), request.getWindowSize());
-
- ServerSession session = server.createSession(request.getName(),
- request.getUsername(),
- request.getPassword(),
- request.getMinLargeMessageSize(),
- connection,
- request.isAutoCommitSends(),
- request.isAutoCommitAcks(),
- request.isPreAcknowledge(),
- request.isXA(),
- new CoreSessionCallback(request.getName(), protocolManager, channel));
-
- ServerSessionPacketHandler handler = new ServerSessionPacketHandler(session,
- server.getStorageManager()
- .newContext(server.getExecutorFactory()
- .getExecutor()),
- server.getStorageManager(),
- channel);
-
- channel.setHandler(handler);
-
- // TODO - where is this removed?
- protocolManager.addSessionHandler(request.getName(), handler);
-
- response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion());
- }
- catch (HornetQException e)
- {
- response = new HornetQExceptionMessage((HornetQException)e);
-
- if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
- {
- incompatibleVersion = true;
- }
- }
- catch (Exception e)
- {
- HornetQPacketHandler.log.error("Failed to create session", e);
-
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
- }
-
- // send the exception to the client and destroy
- // the connection if the client and server versions
- // are not compatible
- if (incompatibleVersion)
- {
- channel1.sendAndFlush(response);
- }
- else
- {
- channel1.send(response);
- }
- }
-
- private void handleReattachSession(final ReattachSessionMessage request)
- {
- Packet response = null;
-
- try
- {
-
- if (!server.isStarted())
- {
- response = new ReattachSessionResponseMessage(-1, false);
- }
-
- ServerSessionPacketHandler sessionHandler = protocolManager.getSessionHandler(request.getName());
-
- if (!server.checkActivate())
- {
- response = new ReattachSessionResponseMessage(-1, false);
- }
-
- if (sessionHandler == null)
- {
- response = new ReattachSessionResponseMessage(-1, false);
- }
- else
- {
- if (sessionHandler.getChannel().getConfirmationWindowSize() == -1)
- {
- // Even though session exists, we can't reattach since confi window size == -1,
- // i.e. we don't have a resend cache for commands, so we just close the old session
- // and let the client recreate
-
- sessionHandler.close();
-
- response = new ReattachSessionResponseMessage(-1, false);
- }
- else
- {
- // Reconnect the channel to the new connection
- int serverLastConfirmedCommandID = sessionHandler.transferConnection(connection,
- request.getLastConfirmedCommandID());
-
- response = new ReattachSessionResponseMessage(serverLastConfirmedCommandID, true);
- }
- }
- }
- catch (Exception e)
- {
- HornetQPacketHandler.log.error("Failed to reattach session", e);
-
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
- }
-
- channel1.send(response);
- }
-
- private void handleCreateQueue(final CreateQueueMessage request)
- {
- try
- {
- server.createQueue(request.getAddress(),
- request.getQueueName(),
- request.getFilterString(),
- request.isDurable(),
- request.isTemporary());
- }
- catch (Exception e)
- {
- HornetQPacketHandler.log.error("Failed to handle create queue", e);
- }
- }
-
- private void handleCreateReplication(final CreateReplicationSessionMessage request)
- {
- Packet response;
-
- try
- {
- Channel channel = connection.getChannel(request.getSessionChannelID(), -1);
-
- ReplicationEndpoint endpoint = server.connectToReplicationEndpoint(channel);
-
- channel.setHandler(endpoint);
-
- response = new NullResponseMessage();
- }
- catch (Exception e)
- {
- if (e instanceof HornetQException)
- {
- response = new HornetQExceptionMessage((HornetQException)e);
- }
- else
- {
- HornetQPacketHandler.log.warn(e.getMessage(), e);
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
- }
- }
-
- channel1.send(response);
- }
-
-}
\ No newline at end of file
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/Packet.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/Packet.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/Packet.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -14,7 +14,7 @@
package org.hornetq.core.protocol.core;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A Packet represents a pcaket of data transmitted over a connection.
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/PacketDecoder.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/PacketDecoder.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/PacketDecoder.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,492 +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.protocol.core;
-
-import static org.hornetq.core.protocol.core.PacketImpl.CREATESESSION;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATESESSION_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_REPLICATION;
-import static org.hornetq.core.protocol.core.PacketImpl.DELETE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.DISCONNECT;
-import static org.hornetq.core.protocol.core.PacketImpl.EXCEPTION;
-import static org.hornetq.core.protocol.core.PacketImpl.NULL_RESPONSE;
-import static org.hornetq.core.protocol.core.PacketImpl.PACKETS_CONFIRMED;
-import static org.hornetq.core.protocol.core.PacketImpl.PING;
-import static org.hornetq.core.protocol.core.PacketImpl.REATTACH_SESSION;
-import static org.hornetq.core.protocol.core.PacketImpl.REATTACH_SESSION_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_APPEND;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_APPEND_TX;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_COMMIT_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_COMPARE_DATA;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_DELETE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_DELETE_TX;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_LARGE_MESSAGE_END;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_PAGE_EVENT;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_PAGE_WRITE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_PREPARE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_RESPONSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ACKNOWLEDGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_BINDINGQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_BINDINGQUERY_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CONSUMER_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CREATECONSUMER;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_EXPIRED;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FLOWTOKEN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_PRODUCER_CREDITS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_PRODUCER_REQUEST_CREDITS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_QUEUEQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_QUEUEQUERY_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_LARGE_MSG;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_MSG;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_LARGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_STOP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_END;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_FORGET;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_GET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_GET_TIMEOUT_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_INDOUBT_XIDS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_INDOUBT_XIDS_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_JOIN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_PREPARE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_RESUME;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SET_TIMEOUT_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SUSPEND;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.PacketsConfirmedMessage;
-import org.hornetq.core.protocol.core.wireformat.Ping;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAStartMessage;
-
-/**
- * A PacketDecoder
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- *
- */
-public class PacketDecoder
-{
- private static final Logger log = Logger.getLogger(PacketDecoder.class);
-
- public Packet decode(final HornetQBuffer in)
- {
- final byte packetType = in.readByte();
-
- Packet packet;
-
- switch (packetType)
- {
- case PING:
- {
- packet = new Ping();
- break;
- }
- case DISCONNECT:
- {
- packet = new PacketImpl(PacketImpl.DISCONNECT);
- break;
- }
- case EXCEPTION:
- {
- packet = new HornetQExceptionMessage();
- break;
- }
- case PACKETS_CONFIRMED:
- {
- packet = new PacketsConfirmedMessage();
- break;
- }
- case CREATESESSION:
- {
- packet = new CreateSessionMessage();
- break;
- }
- case CREATESESSION_RESP:
- {
- packet = new CreateSessionResponseMessage();
- break;
- }
- case REATTACH_SESSION:
- {
- packet = new ReattachSessionMessage();
- break;
- }
- case REATTACH_SESSION_RESP:
- {
- packet = new ReattachSessionResponseMessage();
- break;
- }
- case SESS_CLOSE:
- {
- packet = new SessionCloseMessage();
- break;
- }
- case SESS_CREATECONSUMER:
- {
- packet = new SessionCreateConsumerMessage();
- break;
- }
- case SESS_ACKNOWLEDGE:
- {
- packet = new SessionAcknowledgeMessage();
- break;
- }
- case SESS_EXPIRED:
- {
- packet = new SessionExpiredMessage();
- break;
- }
- case SESS_COMMIT:
- {
- packet = new SessionCommitMessage();
- break;
- }
- case SESS_ROLLBACK:
- {
- packet = new RollbackMessage();
- break;
- }
- case SESS_QUEUEQUERY:
- {
- packet = new SessionQueueQueryMessage();
- break;
- }
- case SESS_QUEUEQUERY_RESP:
- {
- packet = new SessionQueueQueryResponseMessage();
- break;
- }
- case CREATE_QUEUE:
- {
- packet = new CreateQueueMessage();
- break;
- }
- case DELETE_QUEUE:
- {
- packet = new SessionDeleteQueueMessage();
- break;
- }
- case SESS_BINDINGQUERY:
- {
- packet = new SessionBindingQueryMessage();
- break;
- }
- case SESS_BINDINGQUERY_RESP:
- {
- packet = new SessionBindingQueryResponseMessage();
- break;
- }
- case SESS_XA_START:
- {
- packet = new SessionXAStartMessage();
- break;
- }
- case SESS_XA_END:
- {
- packet = new SessionXAEndMessage();
- break;
- }
- case SESS_XA_COMMIT:
- {
- packet = new SessionXACommitMessage();
- break;
- }
- case SESS_XA_PREPARE:
- {
- packet = new SessionXAPrepareMessage();
- break;
- }
- case SESS_XA_RESP:
- {
- packet = new SessionXAResponseMessage();
- break;
- }
- case SESS_XA_ROLLBACK:
- {
- packet = new SessionXARollbackMessage();
- break;
- }
- case SESS_XA_JOIN:
- {
- packet = new SessionXAJoinMessage();
- break;
- }
- case SESS_XA_SUSPEND:
- {
- packet = new PacketImpl(PacketImpl.SESS_XA_SUSPEND);
- break;
- }
- case SESS_XA_RESUME:
- {
- packet = new SessionXAResumeMessage();
- break;
- }
- case SESS_XA_FORGET:
- {
- packet = new SessionXAForgetMessage();
- break;
- }
- case SESS_XA_INDOUBT_XIDS:
- {
- packet = new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS);
- break;
- }
- case SESS_XA_INDOUBT_XIDS_RESP:
- {
- packet = new SessionXAGetInDoubtXidsResponseMessage();
- break;
- }
- case SESS_XA_SET_TIMEOUT:
- {
- packet = new SessionXASetTimeoutMessage();
- break;
- }
- case SESS_XA_SET_TIMEOUT_RESP:
- {
- packet = new SessionXASetTimeoutResponseMessage();
- break;
- }
- case SESS_XA_GET_TIMEOUT:
- {
- packet = new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT);
- break;
- }
- case SESS_XA_GET_TIMEOUT_RESP:
- {
- packet = new SessionXAGetTimeoutResponseMessage();
- break;
- }
- case SESS_START:
- {
- packet = new PacketImpl(PacketImpl.SESS_START);
- break;
- }
- case SESS_STOP:
- {
- packet = new PacketImpl(PacketImpl.SESS_STOP);
- break;
- }
- case SESS_FLOWTOKEN:
- {
- packet = new SessionConsumerFlowCreditMessage();
- break;
- }
- case SESS_SEND:
- {
- packet = new SessionSendMessage();
- break;
- }
- case SESS_SEND_LARGE:
- {
- packet = new SessionSendLargeMessage();
- break;
- }
- case SESS_RECEIVE_MSG:
- {
- packet = new SessionReceiveMessage();
- break;
- }
- case SESS_RECEIVE_LARGE_MSG:
- {
- packet = new SessionReceiveLargeMessage();
- break;
- }
- case SESS_CONSUMER_CLOSE:
- {
- packet = new SessionConsumerCloseMessage();
- break;
- }
- case NULL_RESPONSE:
- {
- packet = new NullResponseMessage();
- break;
- }
- case SESS_RECEIVE_CONTINUATION:
- {
- packet = new SessionReceiveContinuationMessage();
- break;
- }
- case SESS_SEND_CONTINUATION:
- {
- packet = new SessionSendContinuationMessage();
- break;
- }
- case SESS_PRODUCER_REQUEST_CREDITS:
- {
- packet = new SessionRequestProducerCreditsMessage();
- break;
- }
- case SESS_PRODUCER_CREDITS:
- {
- packet = new SessionProducerCreditsMessage();
- break;
- }
- case CREATE_REPLICATION:
- {
- packet = new CreateReplicationSessionMessage();
- break;
- }
- case REPLICATION_APPEND:
- {
- packet = new ReplicationAddMessage();
- break;
- }
- case REPLICATION_APPEND_TX:
- {
- packet = new ReplicationAddTXMessage();
- break;
- }
- case REPLICATION_DELETE:
- {
- packet = new ReplicationDeleteMessage();
- break;
- }
- case REPLICATION_DELETE_TX:
- {
- packet = new ReplicationDeleteTXMessage();
- break;
- }
- case REPLICATION_PREPARE:
- {
- packet = new ReplicationPrepareMessage();
- break;
- }
- case REPLICATION_COMMIT_ROLLBACK:
- {
- packet = new ReplicationCommitMessage();
- break;
- }
- case REPLICATION_RESPONSE:
- {
- packet = new ReplicationResponseMessage();
- break;
- }
- case REPLICATION_PAGE_WRITE:
- {
- packet = new ReplicationPageWriteMessage();
- break;
- }
- case REPLICATION_PAGE_EVENT:
- {
- packet = new ReplicationPageEventMessage();
- break;
- }
- case REPLICATION_LARGE_MESSAGE_BEGIN:
- {
- packet = new ReplicationLargeMessageBeingMessage();
- break;
- }
- case REPLICATION_LARGE_MESSAGE_END:
- {
- packet = new ReplicationLargemessageEndMessage();
- break;
- }
- case REPLICATION_LARGE_MESSAGE_WRITE:
- {
- packet = new ReplicationLargeMessageWriteMessage();
- break;
- }
- case REPLICATION_COMPARE_DATA:
- {
- packet = new ReplicationCompareDataMessage();
- break;
- }
- case SESS_FORCE_CONSUMER_DELIVERY:
- {
- packet = new SessionForceConsumerDelivery();
- break;
- }
- default:
- {
- throw new IllegalArgumentException("Invalid type: " + packetType);
- }
- }
-
- packet.decode(in);
-
- return packet;
- }
-
-}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/PacketImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/PacketImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/PacketImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,310 +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.protocol.core;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
-import org.hornetq.utils.DataConstants;
-
-/**
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- */
-public class PacketImpl implements Packet
-{
- // Constants -------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(PacketImpl.class);
-
- // The minimal size for all the packets, Common data for all the packets (look at PacketImpl.encode)
- public static final int PACKET_HEADERS_SIZE = DataConstants.SIZE_INT + DataConstants.SIZE_BYTE +
- DataConstants.SIZE_LONG;
-
- private static final int INITIAL_PACKET_SIZE = 1500;
-
- protected long channelID;
-
- protected final byte type;
-
- protected int size = -1;
-
- // The packet types
- // -----------------------------------------------------------------------------------
-
- public static final byte PING = 10;
-
- public static final byte DISCONNECT = 11;
-
- // Miscellaneous
- public static final byte EXCEPTION = 20;
-
- public static final byte NULL_RESPONSE = 21;
-
- public static final byte PACKETS_CONFIRMED = 22;
-
- // Server
- public static final byte CREATESESSION = 30;
-
- public static final byte CREATESESSION_RESP = 31;
-
- public static final byte REATTACH_SESSION = 32;
-
- public static final byte REATTACH_SESSION_RESP = 33;
-
- public static final byte CREATE_QUEUE = 34;
-
- public static final byte DELETE_QUEUE = 35;
-
- public static final byte CREATE_REPLICATION = 36;
-
- // Session
- public static final byte SESS_CREATECONSUMER = 40;
-
- public static final byte SESS_ACKNOWLEDGE = 41;
-
- public static final byte SESS_EXPIRED = 42;
-
- public static final byte SESS_COMMIT = 43;
-
- public static final byte SESS_ROLLBACK = 44;
-
- public static final byte SESS_QUEUEQUERY = 45;
-
- public static final byte SESS_QUEUEQUERY_RESP = 46;
-
- public static final byte SESS_BINDINGQUERY = 49;
-
- public static final byte SESS_BINDINGQUERY_RESP = 50;
-
- public static final byte SESS_XA_START = 51;
-
- public static final byte SESS_XA_END = 52;
-
- public static final byte SESS_XA_COMMIT = 53;
-
- public static final byte SESS_XA_PREPARE = 54;
-
- public static final byte SESS_XA_RESP = 55;
-
- public static final byte SESS_XA_ROLLBACK = 56;
-
- public static final byte SESS_XA_JOIN = 57;
-
- public static final byte SESS_XA_SUSPEND = 58;
-
- public static final byte SESS_XA_RESUME = 59;
-
- public static final byte SESS_XA_FORGET = 60;
-
- public static final byte SESS_XA_INDOUBT_XIDS = 61;
-
- public static final byte SESS_XA_INDOUBT_XIDS_RESP = 62;
-
- public static final byte SESS_XA_SET_TIMEOUT = 63;
-
- public static final byte SESS_XA_SET_TIMEOUT_RESP = 64;
-
- public static final byte SESS_XA_GET_TIMEOUT = 65;
-
- public static final byte SESS_XA_GET_TIMEOUT_RESP = 66;
-
- public static final byte SESS_START = 67;
-
- public static final byte SESS_STOP = 68;
-
- public static final byte SESS_CLOSE = 69;
-
- public static final byte SESS_FLOWTOKEN = 70;
-
- public static final byte SESS_SEND = 71;
-
- public static final byte SESS_SEND_LARGE = 72;
-
- public static final byte SESS_SEND_CONTINUATION = 73;
-
- public static final byte SESS_CONSUMER_CLOSE = 74;
-
- public static final byte SESS_RECEIVE_MSG = 75;
-
- public static final byte SESS_RECEIVE_LARGE_MSG = 76;
-
- public static final byte SESS_RECEIVE_CONTINUATION = 77;
-
- public static final byte SESS_FORCE_CONSUMER_DELIVERY = 78;
-
- public static final byte SESS_PRODUCER_REQUEST_CREDITS = 79;
-
- public static final byte SESS_PRODUCER_CREDITS = 80;
-
- // Replication
-
- public static final byte REPLICATION_RESPONSE = 90;
-
- public static final byte REPLICATION_APPEND = 91;
-
- public static final byte REPLICATION_APPEND_TX = 92;
-
- public static final byte REPLICATION_DELETE = 93;
-
- public static final byte REPLICATION_DELETE_TX = 94;
-
- public static final byte REPLICATION_PREPARE = 95;
-
- public static final byte REPLICATION_COMMIT_ROLLBACK = 96;
-
- public static final byte REPLICATION_PAGE_WRITE = 97;
-
- public static final byte REPLICATION_PAGE_EVENT = 98;
-
- public static final byte REPLICATION_LARGE_MESSAGE_BEGIN = 99;
-
- public static final byte REPLICATION_LARGE_MESSAGE_END = 100;
-
- public static final byte REPLICATION_LARGE_MESSAGE_WRITE = 101;
-
- public static final byte REPLICATION_COMPARE_DATA = 102;
-
- public static final byte REPLICATION_SYNC = 103;
-
- // Static --------------------------------------------------------
-
- public PacketImpl(final byte type)
- {
- this.type = type;
- }
-
- // Public --------------------------------------------------------
-
- public byte getType()
- {
- return type;
- }
-
- public long getChannelID()
- {
- return channelID;
- }
-
- public void setChannelID(final long channelID)
- {
- this.channelID = channelID;
- }
-
- public HornetQBuffer encode(final RemotingConnection connection)
- {
- HornetQBuffer buffer = connection.createBuffer(PacketImpl.INITIAL_PACKET_SIZE);
-
- // The standard header fields
-
- buffer.writeInt(0); // The length gets filled in at the end
- buffer.writeByte(type);
- buffer.writeLong(channelID);
-
- encodeRest(buffer);
-
- size = buffer.writerIndex();
-
- // The length doesn't include the actual length byte
- int len = size - DataConstants.SIZE_INT;
-
- buffer.setInt(0, len);
-
- return buffer;
- }
-
- public void decode(final HornetQBuffer buffer)
- {
- channelID = buffer.readLong();
-
- decodeRest(buffer);
-
- size = buffer.readerIndex();
- }
-
- public int getPacketSize()
- {
- if (size == -1)
- {
- throw new IllegalStateException("Packet hasn't been encoded/decoded yet");
- }
-
- return size;
- }
-
- public boolean isResponse()
- {
- return false;
- }
-
- public void encodeRest(final HornetQBuffer buffer)
- {
- }
-
- public void decodeRest(final HornetQBuffer buffer)
- {
- }
-
- public boolean isRequiresConfirmations()
- {
- return true;
- }
-
- public boolean isAsyncExec()
- {
- return false;
- }
-
- @Override
- public String toString()
- {
- return getParentString() + "]";
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof PacketImpl == false)
- {
- return false;
- }
-
- PacketImpl r = (PacketImpl)other;
-
- return r.type == type && r.channelID == channelID;
- }
-
- // Package protected ---------------------------------------------
-
- protected String getParentString()
- {
- return "PACKET[type=" + type + ", channelID=" + channelID + "]";
- }
-
- // Protected -----------------------------------------------------
-
- protected int stringEncodeSize(final String str)
- {
- return DataConstants.SIZE_INT + str.length() * 2;
- }
-
- protected int nullableStringEncodeSize(final String str)
- {
- return DataConstants.SIZE_BOOLEAN + (str != null ? stringEncodeSize(str) : 0);
- }
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,509 +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.protocol.core;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.Executor;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.spi.core.remoting.BufferHandler;
-import org.hornetq.spi.core.remoting.Connection;
-import org.hornetq.utils.SimpleIDGenerator;
-
-/**
- * @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @version <tt>$Revision$</tt> $Id$
- */
-public class RemotingConnectionImpl implements CoreRemotingConnection, BufferHandler
-{
- // Constants
- // ------------------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(RemotingConnectionImpl.class);
-
- // Static
- // ---------------------------------------------------------------------------------------
-
- // Attributes
- // -----------------------------------------------------------------------------------
-
- private final Connection transportConnection;
-
- private final Map<Long, Channel> channels = new ConcurrentHashMap<Long, Channel>();
-
- private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
-
- private final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>();
-
- private final long blockingCallTimeout;
-
- private final List<Interceptor> interceptors;
-
- private volatile boolean destroyed;
-
- private final boolean client;
-
- // Channels 0-9 are reserved for the system
- // 0 is for pinging
- // 1 is for session creation and attachment
- // 2 is for replication
- private volatile SimpleIDGenerator idGenerator = new SimpleIDGenerator(10);
-
- private boolean idGeneratorSynced = false;
-
- private final Object transferLock = new Object();
-
- private final Object failLock = new Object();
-
- private volatile boolean dataReceived;
-
- private final Executor executor;
-
- private volatile boolean executing;
-
- private final PacketDecoder decoder = new PacketDecoder();
-
- // Constructors
- // ---------------------------------------------------------------------------------
-
- /*
- * Create a client side connection
- */
- public RemotingConnectionImpl(final Connection transportConnection,
- final long blockingCallTimeout,
- final List<Interceptor> interceptors)
- {
- this(transportConnection, blockingCallTimeout, interceptors, true, null);
- }
-
- /*
- * Create a server side connection
- */
- public RemotingConnectionImpl(final Connection transportConnection,
- final List<Interceptor> interceptors,
- final Executor executor)
-
- {
- this(transportConnection, -1, interceptors, false, executor);
- }
-
- private RemotingConnectionImpl(final Connection transportConnection,
- final long blockingCallTimeout,
- final List<Interceptor> interceptors,
- final boolean client,
- final Executor executor)
-
- {
- this.transportConnection = transportConnection;
-
- this.blockingCallTimeout = blockingCallTimeout;
-
- this.interceptors = interceptors;
-
- this.client = client;
-
- this.executor = executor;
- }
-
- // RemotingConnection implementation
- // ------------------------------------------------------------
-
- public Connection getTransportConnection()
- {
- return transportConnection;
- }
-
- public List<FailureListener> getFailureListeners()
- {
- return new ArrayList<FailureListener>(failureListeners);
- }
-
- public void setFailureListeners(final List<FailureListener> listeners)
- {
- failureListeners.clear();
-
- failureListeners.addAll(listeners);
- }
-
- public Object getID()
- {
- return transportConnection.getID();
- }
-
- public String getRemoteAddress()
- {
- return transportConnection.getRemoteAddress();
- }
-
- public synchronized Channel getChannel(final long channelID, final int confWindowSize)
- {
- Channel channel = channels.get(channelID);
-
- if (channel == null)
- {
- channel = new ChannelImpl(this, channelID, confWindowSize);
-
- channels.put(channelID, channel);
- }
-
- return channel;
- }
-
- public synchronized boolean removeChannel(final long channelID)
- {
- return channels.remove(channelID) != null;
- }
-
- public synchronized void putChannel(final long channelID, final Channel channel)
- {
- channels.put(channelID, channel);
- }
-
- public void addFailureListener(final FailureListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("FailureListener cannot be null");
- }
-
- failureListeners.add(listener);
- }
-
- public boolean removeFailureListener(final FailureListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("FailureListener cannot be null");
- }
-
- return failureListeners.remove(listener);
- }
-
- public void addCloseListener(final CloseListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("CloseListener cannot be null");
- }
-
- closeListeners.add(listener);
- }
-
- public boolean removeCloseListener(final CloseListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("CloseListener cannot be null");
- }
-
- return closeListeners.remove(listener);
- }
-
- public HornetQBuffer createBuffer(final int size)
- {
- return transportConnection.createBuffer(size);
- }
-
- /*
- * This can be called concurrently by more than one thread so needs to be locked
- */
- public void fail(final HornetQException me)
- {
- synchronized (failLock)
- {
- if (destroyed)
- {
- return;
- }
-
- destroyed = true;
- }
-
- RemotingConnectionImpl.log.warn("Connection failure has been detected: " + me.getMessage() +
- " [code=" +
- me.getCode() +
- "]");
-
- // Then call the listeners
- callFailureListeners(me);
-
- callClosingListeners();
-
- internalClose();
-
- for (Channel channel : channels.values())
- {
- channel.returnBlocking();
- }
- }
-
- public void destroy()
- {
- synchronized (failLock)
- {
- if (destroyed)
- {
- return;
- }
-
- destroyed = true;
- }
-
- internalClose();
-
- callClosingListeners();
- }
-
- public void disconnect()
- {
- Channel channel0 = getChannel(0, -1);
-
- // And we remove all channels from the connection, this ensures no more packets will be processed after this
- // method is
- // complete
-
- Set<Channel> allChannels = new HashSet<Channel>(channels.values());
-
- removeAllChannels();
-
- // Now we are 100% sure that no more packets will be processed we can flush then send the disconnect
-
- for (Channel channel: allChannels)
- {
- channel.flushConfirmations();
- }
-
- channel0.sendAndFlush(new PacketImpl(PacketImpl.DISCONNECT));
- }
-
- public long generateChannelID()
- {
- return idGenerator.generateID();
- }
-
- public synchronized void syncIDGeneratorSequence(final long id)
- {
- if (!idGeneratorSynced)
- {
- idGenerator = new SimpleIDGenerator(id);
-
- idGeneratorSynced = true;
- }
- }
-
- public long getIDGeneratorSequence()
- {
- return idGenerator.getCurrentID();
- }
-
- public Object getTransferLock()
- {
- return transferLock;
- }
-
- public boolean isClient()
- {
- return client;
- }
-
- public boolean isDestroyed()
- {
- return destroyed;
- }
-
- public long getBlockingCallTimeout()
- {
- return blockingCallTimeout;
- }
-
- public boolean checkDataReceived()
- {
- boolean res = dataReceived;
-
- dataReceived = false;
-
- return res;
- }
-
- //We flush any confirmations on the connection - this prevents idle bridges for example
- //sitting there with many unacked messages
- public void flush()
- {
- synchronized (transferLock)
- {
- for (Channel channel : channels.values())
- {
- channel.flushConfirmations();
- }
- }
- }
-
- // Buffer Handler implementation
- // ----------------------------------------------------
-
- public void bufferReceived(Object connectionID, HornetQBuffer buffer)
- {
- final Packet packet = decoder.decode(buffer);
-
- if (packet.isAsyncExec() && executor != null)
- {
- executing = true;
-
- executor.execute(new Runnable()
- {
- public void run()
- {
- try
- {
- doBufferReceived(packet);
- }
- catch (Throwable t)
- {
- RemotingConnectionImpl.log.error("Unexpected error", t);
- }
-
- executing = false;
- }
- });
- }
- else
- {
- //To prevent out of order execution if interleaving sync and async operations on same connection
- while (executing)
- {
- Thread.yield();
- }
-
- // Pings must always be handled out of band so we can send pings back to the client quickly
- // otherwise they would get in the queue with everything else which might give an intolerable delay
- doBufferReceived(packet);
- }
-
- dataReceived = true;
- }
-
- private void doBufferReceived(final Packet packet)
- {
- if (interceptors != null)
- {
- for (final Interceptor interceptor : interceptors)
- {
- try
- {
- boolean callNext = interceptor.intercept(packet, this);
-
- if (!callNext)
- {
- return;
- }
- }
- catch (final Throwable e)
- {
- RemotingConnectionImpl.log.warn("Failure in calling interceptor: " + interceptor, e);
- }
- }
- }
-
- synchronized (transferLock)
- {
- final Channel channel = channels.get(packet.getChannelID());
-
- if (channel != null)
- {
- channel.handlePacket(packet);
- }
- }
- }
-
- // Package protected
- // ----------------------------------------------------------------------------
-
- // Protected
- // ------------------------------------------------------------------------------------
-
- // Private
- // --------------------------------------------------------------------------------------
-
- private void removeAllChannels()
- {
- // We get the transfer lock first - this ensures no packets are being processed AND
- // it's guaranteed no more packets will be processed once this method is complete
- synchronized (transferLock)
- {
- channels.clear();
- }
- }
- private void callFailureListeners(final HornetQException me)
- {
- final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
-
- for (final FailureListener listener : listenersClone)
- {
- try
- {
- listener.connectionFailed(me);
- }
- catch (final Throwable t)
- {
- // Failure of one listener to execute shouldn't prevent others
- // from
- // executing
- RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
- }
- }
- }
-
- private void callClosingListeners()
- {
- final List<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners);
-
- for (final CloseListener listener : listenersClone)
- {
- try
- {
- listener.connectionClosed();
- }
- catch (final Throwable t)
- {
- // Failure of one listener to execute shouldn't prevent others
- // from
- // executing
- RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
- }
- }
- }
-
- private void internalClose()
- {
- // We close the underlying transport connection
- transportConnection.close();
-
- for (Channel channel : channels.values())
- {
- channel.close();
- }
- }
-}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -13,36 +13,36 @@
package org.hornetq.core.protocol.core;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.DELETE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ACKNOWLEDGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_BINDINGQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CONSUMER_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CREATECONSUMER;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_EXPIRED;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FLOWTOKEN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_QUEUEQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_LARGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_STOP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_END;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_FORGET;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_GET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_INDOUBT_XIDS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_JOIN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_PREPARE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_RESUME;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SUSPEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ACKNOWLEDGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CONSUMER_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CREATECONSUMER;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_EXPIRED;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FLOWTOKEN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_LARGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_STOP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_END;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_FORGET;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_JOIN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_PREPARE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESUME;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SUSPEND;
import java.util.List;
@@ -55,38 +55,39 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.persistence.OperationContext;
import org.hornetq.core.persistence.StorageManager;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAStartMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
import org.hornetq.core.remoting.CloseListener;
import org.hornetq.core.remoting.FailureListener;
import org.hornetq.core.server.BindingQueryResult;
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl)
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -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.protocol.core.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@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;
- }
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,46 @@
+/*
+ * 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.protocol.core.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@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;
+ }
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,513 +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.protocol.core.impl;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.ChannelHandler;
-import org.hornetq.core.protocol.core.CommandConfirmationHandler;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.PacketsConfirmedMessage;
-import org.hornetq.spi.core.protocol.RemotingConnection;
-
-/**
- * A ChannelImpl
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- */
-public class ChannelImpl implements Channel
-{
- private static final Logger log = Logger.getLogger(ChannelImpl.class);
-
- private volatile long id;
-
- private ChannelHandler handler;
-
- private Packet response;
-
- private final java.util.Queue<Packet> resendCache;
-
- private volatile int firstStoredCommandID;
-
- private volatile int lastConfirmedCommandID = -1;
-
- private volatile CoreRemotingConnection connection;
-
- private volatile boolean closed;
-
- private final Lock lock = new ReentrantLock();
-
- private final Condition sendCondition = lock.newCondition();
-
- private final Condition failoverCondition = lock.newCondition();
-
- private final Object sendLock = new Object();
-
- private final Object sendBlockingLock = new Object();
-
- private boolean failingOver;
-
- private final int confWindowSize;
-
- private int receivedBytes;
-
- private CommandConfirmationHandler commandConfirmationHandler;
-
- private volatile boolean transferring;
-
- public ChannelImpl(final CoreRemotingConnection connection, final long id, final int confWindowSize)
- {
- this.connection = connection;
-
- this.id = id;
-
- this.confWindowSize = confWindowSize;
-
- if (confWindowSize != -1)
- {
- resendCache = new ConcurrentLinkedQueue<Packet>();
- }
- else
- {
- resendCache = null;
- }
- }
-
- public long getID()
- {
- return id;
- }
-
- public int getLastConfirmedCommandID()
- {
- return lastConfirmedCommandID;
- }
-
- public Lock getLock()
- {
- return lock;
- }
-
- public int getConfirmationWindowSize()
- {
- return confWindowSize;
- }
-
- public void returnBlocking()
- {
- lock.lock();
-
- try
- {
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.UNBLOCKED,
- "Connection failure detected. Unblocking a blocking call that will never get a response"
-
- ));
-
- sendCondition.signal();
- }
- finally
- {
- lock.unlock();
- }
- }
-
- public void sendAndFlush(final Packet packet)
- {
- send(packet, true);
- }
-
- public void send(final Packet packet)
- {
- send(packet, false);
- }
-
- public void setTransferring(boolean transferring)
- {
- this.transferring = transferring;
- }
-
- // This must never called by more than one thread concurrently
- public void send(final Packet packet, final boolean flush)
- {
- synchronized (sendLock)
- {
- packet.setChannelID(id);
-
- final HornetQBuffer buffer = packet.encode(connection);
-
- lock.lock();
-
- try
- {
- while (failingOver)
- {
- // TODO - don't hardcode this timeout
- try
- {
- failoverCondition.await(10000, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e)
- {
- }
- }
-
- //Sanity check
- if (transferring)
- {
- throw new IllegalStateException("Cannot send a packet while channel is doing failover");
- }
-
-
- if (resendCache != null && packet.isRequiresConfirmations())
- {
- resendCache.add(packet);
- }
-
- connection.getTransportConnection().write(buffer, flush);
- }
- finally
- {
- lock.unlock();
- }
- }
- }
-
- public Packet sendBlocking(final Packet packet) throws HornetQException
- {
- if (closed)
- {
- throw new HornetQException(HornetQException.NOT_CONNECTED, "Connection is destroyed");
- }
-
- if (connection.getBlockingCallTimeout() == -1)
- {
- throw new IllegalStateException("Cannot do a blocking call timeout on a server side connection");
- }
-
- // Synchronized since can't be called concurrently by more than one thread and this can occur
- // E.g. blocking acknowledge() from inside a message handler at some time as other operation on main thread
- synchronized (sendBlockingLock)
- {
- packet.setChannelID(id);
-
- final HornetQBuffer buffer = packet.encode(connection);
-
- lock.lock();
-
- try
- {
- while (failingOver)
- {
- // TODO - don't hardcode this timeout
- try
- {
- failoverCondition.await(10000, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e)
- {
- }
- }
-
- response = null;
-
- if (resendCache != null && packet.isRequiresConfirmations())
- {
- resendCache.add(packet);
- }
-
- connection.getTransportConnection().write(buffer);
-
- long toWait = connection.getBlockingCallTimeout();
-
- long start = System.currentTimeMillis();
-
- while (response == null && toWait > 0)
- {
- try
- {
- sendCondition.await(toWait, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e)
- {
- }
-
- if (closed)
- {
- break;
- }
-
- final long now = System.currentTimeMillis();
-
- toWait -= now - start;
-
- start = now;
- }
-
- if (response == null)
- {
- throw new HornetQException(HornetQException.CONNECTION_TIMEDOUT,
- "Timed out waiting for response when sending packet " + packet.getType());
- }
-
- if (response.getType() == PacketImpl.EXCEPTION)
- {
- final HornetQExceptionMessage mem = (HornetQExceptionMessage)response;
-
- HornetQException e = mem.getException();
-
- e.fillInStackTrace();
-
- throw e;
- }
- }
- finally
- {
- lock.unlock();
- }
-
- return response;
- }
- }
-
- public void setCommandConfirmationHandler(final CommandConfirmationHandler handler)
- {
- commandConfirmationHandler = handler;
- }
-
- public void setHandler(final ChannelHandler handler)
- {
- this.handler = handler;
- }
-
- public void close()
- {
- if (closed)
- {
- return;
- }
-
- if (!connection.isDestroyed() && !connection.removeChannel(id))
- {
- throw new IllegalArgumentException("Cannot find channel with id " + id + " to close");
- }
-
- closed = true;
- }
-
- public void transferConnection(final CoreRemotingConnection newConnection)
- {
- // Needs to synchronize on the connection to make sure no packets from
- // the old connection get processed after transfer has occurred
- synchronized (connection.getTransferLock())
- {
- connection.removeChannel(id);
-
- // And switch it
-
- final CoreRemotingConnection rnewConnection = (CoreRemotingConnection)newConnection;
-
- rnewConnection.putChannel(id, this);
-
- connection = rnewConnection;
-
- transferring = true;
- }
- }
-
- public void replayCommands(final int otherLastConfirmedCommandID)
- {
- if (resendCache != null)
- {
- clearUpTo(otherLastConfirmedCommandID);
-
- for (final Packet packet : resendCache)
- {
- doWrite(packet);
- }
- }
- }
-
- public void lock()
- {
- lock.lock();
-
- failingOver = true;
-
- lock.unlock();
- }
-
- public void unlock()
- {
- lock.lock();
-
- failingOver = false;
-
- failoverCondition.signalAll();
-
- lock.unlock();
- }
-
- public CoreRemotingConnection getConnection()
- {
- return connection;
- }
-
- //Needs to be synchronized since can be called by remoting service timer thread too for timeout flush
- public synchronized void flushConfirmations()
- {
- if (resendCache != null && receivedBytes != 0)
- {
- receivedBytes = 0;
-
- final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
-
- confirmed.setChannelID(id);
-
- doWrite(confirmed);
- }
- }
-
- public void confirm(final Packet packet)
- {
- if (resendCache != null && packet.isRequiresConfirmations())
- {
- lastConfirmedCommandID++;
-
- receivedBytes += packet.getPacketSize();
-
- if (receivedBytes >= confWindowSize)
- {
- receivedBytes = 0;
-
- final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
-
- confirmed.setChannelID(id);
-
- doWrite(confirmed);
- }
- }
- }
-
- public void clearCommands()
- {
- if (resendCache != null)
- {
- lastConfirmedCommandID = -1;
-
- firstStoredCommandID = 0;
-
- resendCache.clear();
- }
- }
-
- public void handlePacket(final Packet packet)
- {
- if (packet.getType() == PacketImpl.PACKETS_CONFIRMED)
- {
- if (resendCache != null)
- {
- final PacketsConfirmedMessage msg = (PacketsConfirmedMessage)packet;
-
- clearUpTo(msg.getCommandID());
- }
-
- if (!connection.isClient())
- {
- handler.handlePacket(packet);
- }
-
- return;
- }
- else
- {
- if (packet.isResponse())
- {
- confirm(packet);
-
- lock.lock();
-
- response = packet;
-
- try
- {
- sendCondition.signal();
- }
- finally
- {
- lock.unlock();
- }
- }
- else if (handler != null)
- {
- handler.handlePacket(packet);
- }
- }
- }
-
- private void doWrite(final Packet packet)
- {
- final HornetQBuffer buffer = packet.encode(connection);
-
- connection.getTransportConnection().write(buffer);
- }
-
- private void clearUpTo(final int lastReceivedCommandID)
- {
- final int numberToClear = 1 + lastReceivedCommandID - firstStoredCommandID;
-
- if (numberToClear == -1)
- {
- throw new IllegalArgumentException("Invalid lastReceivedCommandID: " + lastReceivedCommandID);
- }
-
- int sizeToFree = 0;
-
- for (int i = 0; i < numberToClear; i++)
- {
- final Packet packet = resendCache.poll();
-
- if (packet == null)
- {
- ChannelImpl.log.warn("Can't find packet to clear: " + " last received command id " +
- lastReceivedCommandID +
- " first stored command id " +
- firstStoredCommandID);
- return;
- }
-
- if (packet.getType() != PacketImpl.PACKETS_CONFIRMED)
- {
- sizeToFree += packet.getPacketSize();
- }
-
- if (commandConfirmationHandler != null)
- {
- commandConfirmationHandler.commandConfirmed(packet);
- }
- }
-
- firstStoredCommandID += numberToClear;
- }
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,513 @@
+/*
+ * 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.protocol.core.impl;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.ChannelHandler;
+import org.hornetq.core.protocol.core.CommandConfirmationHandler;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.PacketsConfirmedMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+
+/**
+ * A ChannelImpl
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ */
+public class ChannelImpl implements Channel
+{
+ private static final Logger log = Logger.getLogger(ChannelImpl.class);
+
+ private volatile long id;
+
+ private ChannelHandler handler;
+
+ private Packet response;
+
+ private final java.util.Queue<Packet> resendCache;
+
+ private volatile int firstStoredCommandID;
+
+ private volatile int lastConfirmedCommandID = -1;
+
+ private volatile CoreRemotingConnection connection;
+
+ private volatile boolean closed;
+
+ private final Lock lock = new ReentrantLock();
+
+ private final Condition sendCondition = lock.newCondition();
+
+ private final Condition failoverCondition = lock.newCondition();
+
+ private final Object sendLock = new Object();
+
+ private final Object sendBlockingLock = new Object();
+
+ private boolean failingOver;
+
+ private final int confWindowSize;
+
+ private int receivedBytes;
+
+ private CommandConfirmationHandler commandConfirmationHandler;
+
+ private volatile boolean transferring;
+
+ public ChannelImpl(final CoreRemotingConnection connection, final long id, final int confWindowSize)
+ {
+ this.connection = connection;
+
+ this.id = id;
+
+ this.confWindowSize = confWindowSize;
+
+ if (confWindowSize != -1)
+ {
+ resendCache = new ConcurrentLinkedQueue<Packet>();
+ }
+ else
+ {
+ resendCache = null;
+ }
+ }
+
+ public long getID()
+ {
+ return id;
+ }
+
+ public int getLastConfirmedCommandID()
+ {
+ return lastConfirmedCommandID;
+ }
+
+ public Lock getLock()
+ {
+ return lock;
+ }
+
+ public int getConfirmationWindowSize()
+ {
+ return confWindowSize;
+ }
+
+ public void returnBlocking()
+ {
+ lock.lock();
+
+ try
+ {
+ response = new HornetQExceptionMessage(new HornetQException(HornetQException.UNBLOCKED,
+ "Connection failure detected. Unblocking a blocking call that will never get a response"
+
+ ));
+
+ sendCondition.signal();
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+
+ public void sendAndFlush(final Packet packet)
+ {
+ send(packet, true);
+ }
+
+ public void send(final Packet packet)
+ {
+ send(packet, false);
+ }
+
+ public void setTransferring(boolean transferring)
+ {
+ this.transferring = transferring;
+ }
+
+ // This must never called by more than one thread concurrently
+ public void send(final Packet packet, final boolean flush)
+ {
+ synchronized (sendLock)
+ {
+ packet.setChannelID(id);
+
+ final HornetQBuffer buffer = packet.encode(connection);
+
+ lock.lock();
+
+ try
+ {
+ while (failingOver)
+ {
+ // TODO - don't hardcode this timeout
+ try
+ {
+ failoverCondition.await(10000, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+
+ //Sanity check
+ if (transferring)
+ {
+ throw new IllegalStateException("Cannot send a packet while channel is doing failover");
+ }
+
+
+ if (resendCache != null && packet.isRequiresConfirmations())
+ {
+ resendCache.add(packet);
+ }
+
+ connection.getTransportConnection().write(buffer, flush);
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+ }
+
+ public Packet sendBlocking(final Packet packet) throws HornetQException
+ {
+ if (closed)
+ {
+ throw new HornetQException(HornetQException.NOT_CONNECTED, "Connection is destroyed");
+ }
+
+ if (connection.getBlockingCallTimeout() == -1)
+ {
+ throw new IllegalStateException("Cannot do a blocking call timeout on a server side connection");
+ }
+
+ // Synchronized since can't be called concurrently by more than one thread and this can occur
+ // E.g. blocking acknowledge() from inside a message handler at some time as other operation on main thread
+ synchronized (sendBlockingLock)
+ {
+ packet.setChannelID(id);
+
+ final HornetQBuffer buffer = packet.encode(connection);
+
+ lock.lock();
+
+ try
+ {
+ while (failingOver)
+ {
+ // TODO - don't hardcode this timeout
+ try
+ {
+ failoverCondition.await(10000, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+
+ response = null;
+
+ if (resendCache != null && packet.isRequiresConfirmations())
+ {
+ resendCache.add(packet);
+ }
+
+ connection.getTransportConnection().write(buffer);
+
+ long toWait = connection.getBlockingCallTimeout();
+
+ long start = System.currentTimeMillis();
+
+ while (response == null && toWait > 0)
+ {
+ try
+ {
+ sendCondition.await(toWait, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException e)
+ {
+ }
+
+ if (closed)
+ {
+ break;
+ }
+
+ final long now = System.currentTimeMillis();
+
+ toWait -= now - start;
+
+ start = now;
+ }
+
+ if (response == null)
+ {
+ throw new HornetQException(HornetQException.CONNECTION_TIMEDOUT,
+ "Timed out waiting for response when sending packet " + packet.getType());
+ }
+
+ if (response.getType() == PacketImpl.EXCEPTION)
+ {
+ final HornetQExceptionMessage mem = (HornetQExceptionMessage)response;
+
+ HornetQException e = mem.getException();
+
+ e.fillInStackTrace();
+
+ throw e;
+ }
+ }
+ finally
+ {
+ lock.unlock();
+ }
+
+ return response;
+ }
+ }
+
+ public void setCommandConfirmationHandler(final CommandConfirmationHandler handler)
+ {
+ commandConfirmationHandler = handler;
+ }
+
+ public void setHandler(final ChannelHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ public void close()
+ {
+ if (closed)
+ {
+ return;
+ }
+
+ if (!connection.isDestroyed() && !connection.removeChannel(id))
+ {
+ throw new IllegalArgumentException("Cannot find channel with id " + id + " to close");
+ }
+
+ closed = true;
+ }
+
+ public void transferConnection(final CoreRemotingConnection newConnection)
+ {
+ // Needs to synchronize on the connection to make sure no packets from
+ // the old connection get processed after transfer has occurred
+ synchronized (connection.getTransferLock())
+ {
+ connection.removeChannel(id);
+
+ // And switch it
+
+ final CoreRemotingConnection rnewConnection = (CoreRemotingConnection)newConnection;
+
+ rnewConnection.putChannel(id, this);
+
+ connection = rnewConnection;
+
+ transferring = true;
+ }
+ }
+
+ public void replayCommands(final int otherLastConfirmedCommandID)
+ {
+ if (resendCache != null)
+ {
+ clearUpTo(otherLastConfirmedCommandID);
+
+ for (final Packet packet : resendCache)
+ {
+ doWrite(packet);
+ }
+ }
+ }
+
+ public void lock()
+ {
+ lock.lock();
+
+ failingOver = true;
+
+ lock.unlock();
+ }
+
+ public void unlock()
+ {
+ lock.lock();
+
+ failingOver = false;
+
+ failoverCondition.signalAll();
+
+ lock.unlock();
+ }
+
+ public CoreRemotingConnection getConnection()
+ {
+ return connection;
+ }
+
+ //Needs to be synchronized since can be called by remoting service timer thread too for timeout flush
+ public synchronized void flushConfirmations()
+ {
+ if (resendCache != null && receivedBytes != 0)
+ {
+ receivedBytes = 0;
+
+ final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
+
+ confirmed.setChannelID(id);
+
+ doWrite(confirmed);
+ }
+ }
+
+ public void confirm(final Packet packet)
+ {
+ if (resendCache != null && packet.isRequiresConfirmations())
+ {
+ lastConfirmedCommandID++;
+
+ receivedBytes += packet.getPacketSize();
+
+ if (receivedBytes >= confWindowSize)
+ {
+ receivedBytes = 0;
+
+ final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
+
+ confirmed.setChannelID(id);
+
+ doWrite(confirmed);
+ }
+ }
+ }
+
+ public void clearCommands()
+ {
+ if (resendCache != null)
+ {
+ lastConfirmedCommandID = -1;
+
+ firstStoredCommandID = 0;
+
+ resendCache.clear();
+ }
+ }
+
+ public void handlePacket(final Packet packet)
+ {
+ if (packet.getType() == PacketImpl.PACKETS_CONFIRMED)
+ {
+ if (resendCache != null)
+ {
+ final PacketsConfirmedMessage msg = (PacketsConfirmedMessage)packet;
+
+ clearUpTo(msg.getCommandID());
+ }
+
+ if (!connection.isClient())
+ {
+ handler.handlePacket(packet);
+ }
+
+ return;
+ }
+ else
+ {
+ if (packet.isResponse())
+ {
+ confirm(packet);
+
+ lock.lock();
+
+ response = packet;
+
+ try
+ {
+ sendCondition.signal();
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+ else if (handler != null)
+ {
+ handler.handlePacket(packet);
+ }
+ }
+ }
+
+ private void doWrite(final Packet packet)
+ {
+ final HornetQBuffer buffer = packet.encode(connection);
+
+ connection.getTransportConnection().write(buffer);
+ }
+
+ private void clearUpTo(final int lastReceivedCommandID)
+ {
+ final int numberToClear = 1 + lastReceivedCommandID - firstStoredCommandID;
+
+ if (numberToClear == -1)
+ {
+ throw new IllegalArgumentException("Invalid lastReceivedCommandID: " + lastReceivedCommandID);
+ }
+
+ int sizeToFree = 0;
+
+ for (int i = 0; i < numberToClear; i++)
+ {
+ final Packet packet = resendCache.poll();
+
+ if (packet == null)
+ {
+ ChannelImpl.log.warn("Can't find packet to clear: " + " last received command id " +
+ lastReceivedCommandID +
+ " first stored command id " +
+ firstStoredCommandID);
+ return;
+ }
+
+ if (packet.getType() != PacketImpl.PACKETS_CONFIRMED)
+ {
+ sizeToFree += packet.getPacketSize();
+ }
+
+ if (commandConfirmationHandler != null)
+ {
+ commandConfirmationHandler.commandConfirmed(packet);
+ }
+ }
+
+ firstStoredCommandID += numberToClear;
+ }
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,131 +0,0 @@
-/*
- * Copyright 2010 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.protocol.core.impl;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.ChannelHandler;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.ServerSessionPacketHandler;
-import org.hornetq.core.protocol.core.impl.wireformat.Ping;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.spi.core.protocol.ConnectionEntry;
-import org.hornetq.spi.core.protocol.ProtocolManager;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A CoreProtocolManager
- *
- * @author Tim Fox
- *
- *
- */
-public class CoreProtocolManager implements ProtocolManager
-{
- private final HornetQServer server;
-
- private final List<Interceptor> interceptors;
-
- public CoreProtocolManager(final HornetQServer server,
- final List<Interceptor> interceptors)
- {
- this.server = server;
-
- this.interceptors = interceptors;
- }
-
- public ConnectionEntry createConnectionEntry(final Connection connection)
- {
- final Configuration config = server.getConfiguration();
-
- CoreRemotingConnection rc = new RemotingConnectionImpl(connection,
- interceptors,
- config.isAsyncConnectionExecutionEnabled() ? server.getExecutorFactory().getExecutor()
- : null);
-
- Channel channel1 = rc.getChannel(1, -1);
-
- ChannelHandler handler = new HornetQPacketHandler(this, server, channel1, rc);
-
- channel1.setHandler(handler);
-
- long ttl = HornetQClient.DEFAULT_CONNECTION_TTL;
-
- if (config.getConnectionTTLOverride() != -1)
- {
- ttl = config.getConnectionTTLOverride();
- }
-
- final ConnectionEntry entry = new ConnectionEntry(rc, System.currentTimeMillis(), ttl);
-
- final Channel channel0 = rc.getChannel(0, -1);
-
- channel0.setHandler(new ChannelHandler()
- {
- public void handlePacket(final Packet packet)
- {
- if (packet.getType() == PacketImpl.PING)
- {
- Ping ping = (Ping)packet;
-
- if (config.getConnectionTTLOverride() == -1)
- {
- // Allow clients to specify connection ttl
- entry.ttl = ping.getConnectionTTL();
- }
-
- // Just send a ping back
- channel0.send(packet);
- }
- }
- });
-
- return entry;
- }
-
- private Map<String, ServerSessionPacketHandler> sessionHandlers =
- new ConcurrentHashMap<String, ServerSessionPacketHandler>();
-
- public ServerSessionPacketHandler getSessionHandler(final String sessionName)
- {
- return sessionHandlers.get(sessionName);
- }
-
- public void addSessionHandler(final String name, final ServerSessionPacketHandler handler)
- {
- sessionHandlers.put(name, handler);
- }
-
- public void removeHandler(final String name)
- {
- sessionHandlers.remove(name);
- }
-
- public void bufferReceived(Object connectionID, HornetQBuffer buffer)
- {
- }
-
- public int isReadyToHandle(HornetQBuffer buffer)
- {
- return -1;
- }
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2010 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.protocol.core.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.ChannelHandler;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.ServerSessionPacketHandler;
+import org.hornetq.core.protocol.core.impl.wireformat.Ping;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.ConnectionEntry;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A CoreProtocolManager
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class CoreProtocolManager implements ProtocolManager
+{
+ private final HornetQServer server;
+
+ private final List<Interceptor> interceptors;
+
+ public CoreProtocolManager(final HornetQServer server,
+ final List<Interceptor> interceptors)
+ {
+ this.server = server;
+
+ this.interceptors = interceptors;
+ }
+
+ public ConnectionEntry createConnectionEntry(final Connection connection)
+ {
+ final Configuration config = server.getConfiguration();
+
+ CoreRemotingConnection rc = new RemotingConnectionImpl(connection,
+ interceptors,
+ config.isAsyncConnectionExecutionEnabled() ? server.getExecutorFactory().getExecutor()
+ : null);
+
+ Channel channel1 = rc.getChannel(1, -1);
+
+ ChannelHandler handler = new HornetQPacketHandler(this, server, channel1, rc);
+
+ channel1.setHandler(handler);
+
+ long ttl = HornetQClient.DEFAULT_CONNECTION_TTL;
+
+ if (config.getConnectionTTLOverride() != -1)
+ {
+ ttl = config.getConnectionTTLOverride();
+ }
+
+ final ConnectionEntry entry = new ConnectionEntry(rc, System.currentTimeMillis(), ttl);
+
+ final Channel channel0 = rc.getChannel(0, -1);
+
+ channel0.setHandler(new ChannelHandler()
+ {
+ public void handlePacket(final Packet packet)
+ {
+ if (packet.getType() == PacketImpl.PING)
+ {
+ Ping ping = (Ping)packet;
+
+ if (config.getConnectionTTLOverride() == -1)
+ {
+ // Allow clients to specify connection ttl
+ entry.ttl = ping.getConnectionTTL();
+ }
+
+ // Just send a ping back
+ channel0.send(packet);
+ }
+ }
+ });
+
+ return entry;
+ }
+
+ private Map<String, ServerSessionPacketHandler> sessionHandlers =
+ new ConcurrentHashMap<String, ServerSessionPacketHandler>();
+
+ public ServerSessionPacketHandler getSessionHandler(final String sessionName)
+ {
+ return sessionHandlers.get(sessionName);
+ }
+
+ public void addSessionHandler(final String name, final ServerSessionPacketHandler handler)
+ {
+ sessionHandlers.put(name, handler);
+ }
+
+ public void removeHandler(final String name)
+ {
+ sessionHandlers.remove(name);
+ }
+
+ public void bufferReceived(Object connectionID, HornetQBuffer buffer)
+ {
+ }
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ return -1;
+ }
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,36 +0,0 @@
-/*
- * Copyright 2010 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.protocol.core.impl;
-
-import java.util.List;
-
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.spi.core.protocol.ProtocolManager;
-import org.hornetq.spi.core.protocol.ProtocolManagerFactory;
-
-/**
- * A CoreProtocolManagerFactory
- *
- * @author Tim Fox
- *
- *
- */
-public class CoreProtocolManagerFactory implements ProtocolManagerFactory
-{
- public ProtocolManager createProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
- {
- return new CoreProtocolManager(server, interceptors);
- }
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 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.protocol.core.impl;
+
+import java.util.List;
+
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.ProtocolManagerFactory;
+
+/**
+ * A CoreProtocolManagerFactory
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class CoreProtocolManagerFactory implements ProtocolManagerFactory
+{
+ public ProtocolManager createProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
+ {
+ return new CoreProtocolManager(server, interceptors);
+ }
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,315 +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.protocol.core.impl;
-
-import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_REPLICATION;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION;
-
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.ChannelHandler;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.ServerSessionPacketHandler;
-import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.replication.ReplicationEndpoint;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.version.Version;
-
-/**
- * A packet handler for all packets that need to be handled at the server level
- *
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
- */
-public class HornetQPacketHandler implements ChannelHandler
-{
- private static final Logger log = Logger.getLogger(HornetQPacketHandler.class);
-
- private final HornetQServer server;
-
- private final Channel channel1;
-
- private final CoreRemotingConnection connection;
-
- private final CoreProtocolManager protocolManager;
-
- public HornetQPacketHandler(final CoreProtocolManager protocolManager,
- final HornetQServer server,
- final Channel channel1,
- final CoreRemotingConnection connection)
- {
- this.protocolManager = protocolManager;
-
- this.server = server;
-
- this.channel1 = channel1;
-
- this.connection = connection;
- }
-
- public void handlePacket(final Packet packet)
- {
- byte type = packet.getType();
-
- switch (type)
- {
- case CREATESESSION:
- {
- CreateSessionMessage request = (CreateSessionMessage)packet;
-
- handleCreateSession(request);
-
- break;
- }
- case REATTACH_SESSION:
- {
- ReattachSessionMessage request = (ReattachSessionMessage)packet;
-
- handleReattachSession(request);
-
- break;
- }
- case CREATE_QUEUE:
- {
- // Create queue can also be fielded here in the case of a replicated store and forward queue creation
-
- CreateQueueMessage request = (CreateQueueMessage)packet;
-
- handleCreateQueue(request);
-
- break;
- }
- case CREATE_REPLICATION:
- {
- // Create queue can also be fielded here in the case of a replicated store and forward queue creation
-
- CreateReplicationSessionMessage request = (CreateReplicationSessionMessage)packet;
-
- handleCreateReplication(request);
-
- break;
- }
- default:
- {
- HornetQPacketHandler.log.error("Invalid packet " + packet);
- }
- }
- }
-
- private void handleCreateSession(final CreateSessionMessage request)
- {
- boolean incompatibleVersion = false;
- Packet response;
- try
- {
- Version version = server.getVersion();
-
- if (version.getIncrementingVersion() != request.getVersion())
- {
- log.warn("Client with version " + request.getVersion() +
- " and address " +
- connection.getRemoteAddress() +
- " is not compatible with server version " +
- version.getFullVersion() +
- ". " +
- "Please ensure all clients and servers are upgraded to the same version for them to " +
- "interoperate properly");
- throw new HornetQException(HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS,
- "Server and client versions incompatible");
- }
-
- if (!server.isStarted())
- {
- throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED, "Server not started");
- }
-
- if (!server.checkActivate())
- {
- throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED,
- "Server will not accept create session requests");
- }
-
- Channel channel = connection.getChannel(request.getSessionChannelID(), request.getWindowSize());
-
- ServerSession session = server.createSession(request.getName(),
- request.getUsername(),
- request.getPassword(),
- request.getMinLargeMessageSize(),
- connection,
- request.isAutoCommitSends(),
- request.isAutoCommitAcks(),
- request.isPreAcknowledge(),
- request.isXA());
-
- ServerSessionPacketHandler handler = new ServerSessionPacketHandler(protocolManager,
- session,
- server.getStorageManager()
- .newContext(server.getExecutorFactory()
- .getExecutor()),
- server.getStorageManager(),
- channel);
-
- session.setCallback(handler);
-
- channel.setHandler(handler);
-
- // TODO - where is this removed?
- protocolManager.addSessionHandler(request.getName(), handler);
-
- response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion());
- }
- catch (HornetQException e)
- {
- response = new HornetQExceptionMessage((HornetQException)e);
-
- if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
- {
- incompatibleVersion = true;
- }
- }
- catch (Exception e)
- {
- HornetQPacketHandler.log.error("Failed to create session", e);
-
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
- }
-
- // send the exception to the client and destroy
- // the connection if the client and server versions
- // are not compatible
- if (incompatibleVersion)
- {
- channel1.sendAndFlush(response);
- }
- else
- {
- channel1.send(response);
- }
- }
-
- private void handleReattachSession(final ReattachSessionMessage request)
- {
- Packet response = null;
-
- try
- {
-
- if (!server.isStarted())
- {
- response = new ReattachSessionResponseMessage(-1, false);
- }
-
- ServerSessionPacketHandler sessionHandler = protocolManager.getSessionHandler(request.getName());
-
- if (!server.checkActivate())
- {
- response = new ReattachSessionResponseMessage(-1, false);
- }
-
- if (sessionHandler == null)
- {
- response = new ReattachSessionResponseMessage(-1, false);
- }
- else
- {
- if (sessionHandler.getChannel().getConfirmationWindowSize() == -1)
- {
- // Even though session exists, we can't reattach since confi window size == -1,
- // i.e. we don't have a resend cache for commands, so we just close the old session
- // and let the client recreate
-
- sessionHandler.close();
-
- response = new ReattachSessionResponseMessage(-1, false);
- }
- else
- {
- // Reconnect the channel to the new connection
- int serverLastConfirmedCommandID = sessionHandler.transferConnection(connection,
- request.getLastConfirmedCommandID());
-
- response = new ReattachSessionResponseMessage(serverLastConfirmedCommandID, true);
- }
- }
- }
- catch (Exception e)
- {
- HornetQPacketHandler.log.error("Failed to reattach session", e);
-
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
- }
-
- channel1.send(response);
- }
-
- private void handleCreateQueue(final CreateQueueMessage request)
- {
- try
- {
- server.createQueue(request.getAddress(),
- request.getQueueName(),
- request.getFilterString(),
- request.isDurable(),
- request.isTemporary());
- }
- catch (Exception e)
- {
- HornetQPacketHandler.log.error("Failed to handle create queue", e);
- }
- }
-
- private void handleCreateReplication(final CreateReplicationSessionMessage request)
- {
- Packet response;
-
- try
- {
- Channel channel = connection.getChannel(request.getSessionChannelID(), -1);
-
- ReplicationEndpoint endpoint = server.connectToReplicationEndpoint(channel);
-
- channel.setHandler(endpoint);
-
- response = new NullResponseMessage();
- }
- catch (Exception e)
- {
- if (e instanceof HornetQException)
- {
- response = new HornetQExceptionMessage((HornetQException)e);
- }
- else
- {
- HornetQPacketHandler.log.warn(e.getMessage(), e);
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
- }
- }
-
- channel1.send(response);
- }
-
-}
\ No newline at end of file
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,313 @@
+/*
+ * 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.protocol.core.impl;
+
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_REPLICATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION;
+
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.ChannelHandler;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.CoreSessionCallback;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.ServerSessionPacketHandler;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
+import org.hornetq.core.replication.ReplicationEndpoint;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.ServerSession;
+import org.hornetq.core.version.Version;
+
+/**
+ * A packet handler for all packets that need to be handled at the server level
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
+ */
+public class HornetQPacketHandler implements ChannelHandler
+{
+ private static final Logger log = Logger.getLogger(HornetQPacketHandler.class);
+
+ private final HornetQServer server;
+
+ private final Channel channel1;
+
+ private final CoreRemotingConnection connection;
+
+ private final CoreProtocolManager protocolManager;
+
+ public HornetQPacketHandler(final CoreProtocolManager protocolManager,
+ final HornetQServer server,
+ final Channel channel1,
+ final CoreRemotingConnection connection)
+ {
+ this.protocolManager = protocolManager;
+
+ this.server = server;
+
+ this.channel1 = channel1;
+
+ this.connection = connection;
+ }
+
+ public void handlePacket(final Packet packet)
+ {
+ byte type = packet.getType();
+
+ switch (type)
+ {
+ case CREATESESSION:
+ {
+ CreateSessionMessage request = (CreateSessionMessage)packet;
+
+ handleCreateSession(request);
+
+ break;
+ }
+ case REATTACH_SESSION:
+ {
+ ReattachSessionMessage request = (ReattachSessionMessage)packet;
+
+ handleReattachSession(request);
+
+ break;
+ }
+ case CREATE_QUEUE:
+ {
+ // Create queue can also be fielded here in the case of a replicated store and forward queue creation
+
+ CreateQueueMessage request = (CreateQueueMessage)packet;
+
+ handleCreateQueue(request);
+
+ break;
+ }
+ case CREATE_REPLICATION:
+ {
+ // Create queue can also be fielded here in the case of a replicated store and forward queue creation
+
+ CreateReplicationSessionMessage request = (CreateReplicationSessionMessage)packet;
+
+ handleCreateReplication(request);
+
+ break;
+ }
+ default:
+ {
+ HornetQPacketHandler.log.error("Invalid packet " + packet);
+ }
+ }
+ }
+
+ private void handleCreateSession(final CreateSessionMessage request)
+ {
+ boolean incompatibleVersion = false;
+ Packet response;
+ try
+ {
+ Version version = server.getVersion();
+
+ if (version.getIncrementingVersion() != request.getVersion())
+ {
+ log.warn("Client with version " + request.getVersion() +
+ " and address " +
+ connection.getRemoteAddress() +
+ " is not compatible with server version " +
+ version.getFullVersion() +
+ ". " +
+ "Please ensure all clients and servers are upgraded to the same version for them to " +
+ "interoperate properly");
+ throw new HornetQException(HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS,
+ "Server and client versions incompatible");
+ }
+
+ if (!server.isStarted())
+ {
+ throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED, "Server not started");
+ }
+
+ if (!server.checkActivate())
+ {
+ throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED,
+ "Server will not accept create session requests");
+ }
+
+ Channel channel = connection.getChannel(request.getSessionChannelID(), request.getWindowSize());
+
+ ServerSession session = server.createSession(request.getName(),
+ request.getUsername(),
+ request.getPassword(),
+ request.getMinLargeMessageSize(),
+ connection,
+ request.isAutoCommitSends(),
+ request.isAutoCommitAcks(),
+ request.isPreAcknowledge(),
+ request.isXA(),
+ new CoreSessionCallback(request.getName(), protocolManager, channel));
+
+ ServerSessionPacketHandler handler = new ServerSessionPacketHandler(session,
+ server.getStorageManager()
+ .newContext(server.getExecutorFactory()
+ .getExecutor()),
+ server.getStorageManager(),
+ channel);
+ channel.setHandler(handler);
+
+ // TODO - where is this removed?
+ protocolManager.addSessionHandler(request.getName(), handler);
+
+ response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion());
+ }
+ catch (HornetQException e)
+ {
+ response = new HornetQExceptionMessage((HornetQException)e);
+
+ if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
+ {
+ incompatibleVersion = true;
+ }
+ }
+ catch (Exception e)
+ {
+ HornetQPacketHandler.log.error("Failed to create session", e);
+
+ response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
+ }
+
+ // send the exception to the client and destroy
+ // the connection if the client and server versions
+ // are not compatible
+ if (incompatibleVersion)
+ {
+ channel1.sendAndFlush(response);
+ }
+ else
+ {
+ channel1.send(response);
+ }
+ }
+
+ private void handleReattachSession(final ReattachSessionMessage request)
+ {
+ Packet response = null;
+
+ try
+ {
+
+ if (!server.isStarted())
+ {
+ response = new ReattachSessionResponseMessage(-1, false);
+ }
+
+ ServerSessionPacketHandler sessionHandler = protocolManager.getSessionHandler(request.getName());
+
+ if (!server.checkActivate())
+ {
+ response = new ReattachSessionResponseMessage(-1, false);
+ }
+
+ if (sessionHandler == null)
+ {
+ response = new ReattachSessionResponseMessage(-1, false);
+ }
+ else
+ {
+ if (sessionHandler.getChannel().getConfirmationWindowSize() == -1)
+ {
+ // Even though session exists, we can't reattach since confi window size == -1,
+ // i.e. we don't have a resend cache for commands, so we just close the old session
+ // and let the client recreate
+
+ sessionHandler.close();
+
+ response = new ReattachSessionResponseMessage(-1, false);
+ }
+ else
+ {
+ // Reconnect the channel to the new connection
+ int serverLastConfirmedCommandID = sessionHandler.transferConnection(connection,
+ request.getLastConfirmedCommandID());
+
+ response = new ReattachSessionResponseMessage(serverLastConfirmedCommandID, true);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ HornetQPacketHandler.log.error("Failed to reattach session", e);
+
+ response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
+ }
+
+ channel1.send(response);
+ }
+
+ private void handleCreateQueue(final CreateQueueMessage request)
+ {
+ try
+ {
+ server.createQueue(request.getAddress(),
+ request.getQueueName(),
+ request.getFilterString(),
+ request.isDurable(),
+ request.isTemporary());
+ }
+ catch (Exception e)
+ {
+ HornetQPacketHandler.log.error("Failed to handle create queue", e);
+ }
+ }
+
+ private void handleCreateReplication(final CreateReplicationSessionMessage request)
+ {
+ Packet response;
+
+ try
+ {
+ Channel channel = connection.getChannel(request.getSessionChannelID(), -1);
+
+ ReplicationEndpoint endpoint = server.connectToReplicationEndpoint(channel);
+
+ channel.setHandler(endpoint);
+
+ response = new NullResponseMessage();
+ }
+ catch (Exception e)
+ {
+ if (e instanceof HornetQException)
+ {
+ response = new HornetQExceptionMessage((HornetQException)e);
+ }
+ else
+ {
+ HornetQPacketHandler.log.warn(e.getMessage(), e);
+ response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
+ }
+ }
+
+ channel1.send(response);
+ }
+
+}
\ No newline at end of file
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,493 +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.protocol.core.impl;
-
-import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION_RESP;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_REPLICATION;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.DISCONNECT;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.EXCEPTION;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.NULL_RESPONSE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.PACKETS_CONFIRMED;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.PING;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION_RESP;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND_TX;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_COMMIT_ROLLBACK;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_COMPARE_DATA;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE_TX;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_END;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_EVENT;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_WRITE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PREPARE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_RESPONSE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ACKNOWLEDGE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY_RESP;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CLOSE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_COMMIT;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CONSUMER_CLOSE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CREATECONSUMER;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_EXPIRED;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FLOWTOKEN;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_PRODUCER_CREDITS;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_PRODUCER_REQUEST_CREDITS;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY_RESP;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_CONTINUATION;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_LARGE_MSG;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_MSG;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ROLLBACK;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_CONTINUATION;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_LARGE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_START;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_STOP;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_COMMIT;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_END;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_FORGET;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT_RESP;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS_RESP;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_JOIN;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_PREPARE;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESP;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESUME;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_ROLLBACK;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT_RESP;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_START;
-import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SUSPEND;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.PacketsConfirmedMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.Ping;
-import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.ReplicationResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionCloseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionCommitMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
-
-/**
- * A PacketDecoder
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- *
- */
-public class PacketDecoder
-{
- private static final Logger log = Logger.getLogger(PacketDecoder.class);
-
- public Packet decode(final HornetQBuffer in)
- {
- final byte packetType = in.readByte();
-
- Packet packet;
-
- switch (packetType)
- {
- case PING:
- {
- packet = new Ping();
- break;
- }
- case DISCONNECT:
- {
- packet = new PacketImpl(PacketImpl.DISCONNECT);
- break;
- }
- case EXCEPTION:
- {
- packet = new HornetQExceptionMessage();
- break;
- }
- case PACKETS_CONFIRMED:
- {
- packet = new PacketsConfirmedMessage();
- break;
- }
- case CREATESESSION:
- {
- packet = new CreateSessionMessage();
- break;
- }
- case CREATESESSION_RESP:
- {
- packet = new CreateSessionResponseMessage();
- break;
- }
- case REATTACH_SESSION:
- {
- packet = new ReattachSessionMessage();
- break;
- }
- case REATTACH_SESSION_RESP:
- {
- packet = new ReattachSessionResponseMessage();
- break;
- }
- case SESS_CLOSE:
- {
- packet = new SessionCloseMessage();
- break;
- }
- case SESS_CREATECONSUMER:
- {
- packet = new SessionCreateConsumerMessage();
- break;
- }
- case SESS_ACKNOWLEDGE:
- {
- packet = new SessionAcknowledgeMessage();
- break;
- }
- case SESS_EXPIRED:
- {
- packet = new SessionExpiredMessage();
- break;
- }
- case SESS_COMMIT:
- {
- packet = new SessionCommitMessage();
- break;
- }
- case SESS_ROLLBACK:
- {
- packet = new RollbackMessage();
- break;
- }
- case SESS_QUEUEQUERY:
- {
- packet = new SessionQueueQueryMessage();
- break;
- }
- case SESS_QUEUEQUERY_RESP:
- {
- packet = new SessionQueueQueryResponseMessage();
- break;
- }
- case CREATE_QUEUE:
- {
- packet = new CreateQueueMessage();
- break;
- }
- case DELETE_QUEUE:
- {
- packet = new SessionDeleteQueueMessage();
- break;
- }
- case SESS_BINDINGQUERY:
- {
- packet = new SessionBindingQueryMessage();
- break;
- }
- case SESS_BINDINGQUERY_RESP:
- {
- packet = new SessionBindingQueryResponseMessage();
- break;
- }
- case SESS_XA_START:
- {
- packet = new SessionXAStartMessage();
- break;
- }
- case SESS_XA_END:
- {
- packet = new SessionXAEndMessage();
- break;
- }
- case SESS_XA_COMMIT:
- {
- packet = new SessionXACommitMessage();
- break;
- }
- case SESS_XA_PREPARE:
- {
- packet = new SessionXAPrepareMessage();
- break;
- }
- case SESS_XA_RESP:
- {
- packet = new SessionXAResponseMessage();
- break;
- }
- case SESS_XA_ROLLBACK:
- {
- packet = new SessionXARollbackMessage();
- break;
- }
- case SESS_XA_JOIN:
- {
- packet = new SessionXAJoinMessage();
- break;
- }
- case SESS_XA_SUSPEND:
- {
- packet = new PacketImpl(PacketImpl.SESS_XA_SUSPEND);
- break;
- }
- case SESS_XA_RESUME:
- {
- packet = new SessionXAResumeMessage();
- break;
- }
- case SESS_XA_FORGET:
- {
- packet = new SessionXAForgetMessage();
- break;
- }
- case SESS_XA_INDOUBT_XIDS:
- {
- packet = new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS);
- break;
- }
- case SESS_XA_INDOUBT_XIDS_RESP:
- {
- packet = new SessionXAGetInDoubtXidsResponseMessage();
- break;
- }
- case SESS_XA_SET_TIMEOUT:
- {
- packet = new SessionXASetTimeoutMessage();
- break;
- }
- case SESS_XA_SET_TIMEOUT_RESP:
- {
- packet = new SessionXASetTimeoutResponseMessage();
- break;
- }
- case SESS_XA_GET_TIMEOUT:
- {
- packet = new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT);
- break;
- }
- case SESS_XA_GET_TIMEOUT_RESP:
- {
- packet = new SessionXAGetTimeoutResponseMessage();
- break;
- }
- case SESS_START:
- {
- packet = new PacketImpl(PacketImpl.SESS_START);
- break;
- }
- case SESS_STOP:
- {
- packet = new PacketImpl(PacketImpl.SESS_STOP);
- break;
- }
- case SESS_FLOWTOKEN:
- {
- packet = new SessionConsumerFlowCreditMessage();
- break;
- }
- case SESS_SEND:
- {
- packet = new SessionSendMessage();
- break;
- }
- case SESS_SEND_LARGE:
- {
- packet = new SessionSendLargeMessage();
- break;
- }
- case SESS_RECEIVE_MSG:
- {
- packet = new SessionReceiveMessage();
- break;
- }
- case SESS_RECEIVE_LARGE_MSG:
- {
- packet = new SessionReceiveLargeMessage();
- break;
- }
- case SESS_CONSUMER_CLOSE:
- {
- packet = new SessionConsumerCloseMessage();
- break;
- }
- case NULL_RESPONSE:
- {
- packet = new NullResponseMessage();
- break;
- }
- case SESS_RECEIVE_CONTINUATION:
- {
- packet = new SessionReceiveContinuationMessage();
- break;
- }
- case SESS_SEND_CONTINUATION:
- {
- packet = new SessionSendContinuationMessage();
- break;
- }
- case SESS_PRODUCER_REQUEST_CREDITS:
- {
- packet = new SessionRequestProducerCreditsMessage();
- break;
- }
- case SESS_PRODUCER_CREDITS:
- {
- packet = new SessionProducerCreditsMessage();
- break;
- }
- case CREATE_REPLICATION:
- {
- packet = new CreateReplicationSessionMessage();
- break;
- }
- case REPLICATION_APPEND:
- {
- packet = new ReplicationAddMessage();
- break;
- }
- case REPLICATION_APPEND_TX:
- {
- packet = new ReplicationAddTXMessage();
- break;
- }
- case REPLICATION_DELETE:
- {
- packet = new ReplicationDeleteMessage();
- break;
- }
- case REPLICATION_DELETE_TX:
- {
- packet = new ReplicationDeleteTXMessage();
- break;
- }
- case REPLICATION_PREPARE:
- {
- packet = new ReplicationPrepareMessage();
- break;
- }
- case REPLICATION_COMMIT_ROLLBACK:
- {
- packet = new ReplicationCommitMessage();
- break;
- }
- case REPLICATION_RESPONSE:
- {
- packet = new ReplicationResponseMessage();
- break;
- }
- case REPLICATION_PAGE_WRITE:
- {
- packet = new ReplicationPageWriteMessage();
- break;
- }
- case REPLICATION_PAGE_EVENT:
- {
- packet = new ReplicationPageEventMessage();
- break;
- }
- case REPLICATION_LARGE_MESSAGE_BEGIN:
- {
- packet = new ReplicationLargeMessageBeingMessage();
- break;
- }
- case REPLICATION_LARGE_MESSAGE_END:
- {
- packet = new ReplicationLargemessageEndMessage();
- break;
- }
- case REPLICATION_LARGE_MESSAGE_WRITE:
- {
- packet = new ReplicationLargeMessageWriteMessage();
- break;
- }
- case REPLICATION_COMPARE_DATA:
- {
- packet = new ReplicationCompareDataMessage();
- break;
- }
- case SESS_FORCE_CONSUMER_DELIVERY:
- {
- packet = new SessionForceConsumerDelivery();
- break;
- }
- default:
- {
- throw new IllegalArgumentException("Invalid type: " + packetType);
- }
- }
-
- packet.decode(in);
-
- return packet;
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,493 @@
+/*
+ * 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.protocol.core.impl;
+
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_REPLICATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.DISCONNECT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.EXCEPTION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.NULL_RESPONSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.PACKETS_CONFIRMED;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.PING;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND_TX;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_COMMIT_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_COMPARE_DATA;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE_TX;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_END;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_EVENT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_WRITE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PREPARE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_RESPONSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ACKNOWLEDGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CONSUMER_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CREATECONSUMER;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_EXPIRED;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FLOWTOKEN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_PRODUCER_CREDITS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_PRODUCER_REQUEST_CREDITS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_LARGE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_LARGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_STOP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_END;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_FORGET;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_JOIN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_PREPARE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESUME;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SUSPEND;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.PacketsConfirmedMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.Ping;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
+
+/**
+ * A PacketDecoder
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ *
+ */
+public class PacketDecoder
+{
+ private static final Logger log = Logger.getLogger(PacketDecoder.class);
+
+ public Packet decode(final HornetQBuffer in)
+ {
+ final byte packetType = in.readByte();
+
+ Packet packet;
+
+ switch (packetType)
+ {
+ case PING:
+ {
+ packet = new Ping();
+ break;
+ }
+ case DISCONNECT:
+ {
+ packet = new PacketImpl(PacketImpl.DISCONNECT);
+ break;
+ }
+ case EXCEPTION:
+ {
+ packet = new HornetQExceptionMessage();
+ break;
+ }
+ case PACKETS_CONFIRMED:
+ {
+ packet = new PacketsConfirmedMessage();
+ break;
+ }
+ case CREATESESSION:
+ {
+ packet = new CreateSessionMessage();
+ break;
+ }
+ case CREATESESSION_RESP:
+ {
+ packet = new CreateSessionResponseMessage();
+ break;
+ }
+ case REATTACH_SESSION:
+ {
+ packet = new ReattachSessionMessage();
+ break;
+ }
+ case REATTACH_SESSION_RESP:
+ {
+ packet = new ReattachSessionResponseMessage();
+ break;
+ }
+ case SESS_CLOSE:
+ {
+ packet = new SessionCloseMessage();
+ break;
+ }
+ case SESS_CREATECONSUMER:
+ {
+ packet = new SessionCreateConsumerMessage();
+ break;
+ }
+ case SESS_ACKNOWLEDGE:
+ {
+ packet = new SessionAcknowledgeMessage();
+ break;
+ }
+ case SESS_EXPIRED:
+ {
+ packet = new SessionExpiredMessage();
+ break;
+ }
+ case SESS_COMMIT:
+ {
+ packet = new SessionCommitMessage();
+ break;
+ }
+ case SESS_ROLLBACK:
+ {
+ packet = new RollbackMessage();
+ break;
+ }
+ case SESS_QUEUEQUERY:
+ {
+ packet = new SessionQueueQueryMessage();
+ break;
+ }
+ case SESS_QUEUEQUERY_RESP:
+ {
+ packet = new SessionQueueQueryResponseMessage();
+ break;
+ }
+ case CREATE_QUEUE:
+ {
+ packet = new CreateQueueMessage();
+ break;
+ }
+ case DELETE_QUEUE:
+ {
+ packet = new SessionDeleteQueueMessage();
+ break;
+ }
+ case SESS_BINDINGQUERY:
+ {
+ packet = new SessionBindingQueryMessage();
+ break;
+ }
+ case SESS_BINDINGQUERY_RESP:
+ {
+ packet = new SessionBindingQueryResponseMessage();
+ break;
+ }
+ case SESS_XA_START:
+ {
+ packet = new SessionXAStartMessage();
+ break;
+ }
+ case SESS_XA_END:
+ {
+ packet = new SessionXAEndMessage();
+ break;
+ }
+ case SESS_XA_COMMIT:
+ {
+ packet = new SessionXACommitMessage();
+ break;
+ }
+ case SESS_XA_PREPARE:
+ {
+ packet = new SessionXAPrepareMessage();
+ break;
+ }
+ case SESS_XA_RESP:
+ {
+ packet = new SessionXAResponseMessage();
+ break;
+ }
+ case SESS_XA_ROLLBACK:
+ {
+ packet = new SessionXARollbackMessage();
+ break;
+ }
+ case SESS_XA_JOIN:
+ {
+ packet = new SessionXAJoinMessage();
+ break;
+ }
+ case SESS_XA_SUSPEND:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_XA_SUSPEND);
+ break;
+ }
+ case SESS_XA_RESUME:
+ {
+ packet = new SessionXAResumeMessage();
+ break;
+ }
+ case SESS_XA_FORGET:
+ {
+ packet = new SessionXAForgetMessage();
+ break;
+ }
+ case SESS_XA_INDOUBT_XIDS:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS);
+ break;
+ }
+ case SESS_XA_INDOUBT_XIDS_RESP:
+ {
+ packet = new SessionXAGetInDoubtXidsResponseMessage();
+ break;
+ }
+ case SESS_XA_SET_TIMEOUT:
+ {
+ packet = new SessionXASetTimeoutMessage();
+ break;
+ }
+ case SESS_XA_SET_TIMEOUT_RESP:
+ {
+ packet = new SessionXASetTimeoutResponseMessage();
+ break;
+ }
+ case SESS_XA_GET_TIMEOUT:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT);
+ break;
+ }
+ case SESS_XA_GET_TIMEOUT_RESP:
+ {
+ packet = new SessionXAGetTimeoutResponseMessage();
+ break;
+ }
+ case SESS_START:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_START);
+ break;
+ }
+ case SESS_STOP:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_STOP);
+ break;
+ }
+ case SESS_FLOWTOKEN:
+ {
+ packet = new SessionConsumerFlowCreditMessage();
+ break;
+ }
+ case SESS_SEND:
+ {
+ packet = new SessionSendMessage();
+ break;
+ }
+ case SESS_SEND_LARGE:
+ {
+ packet = new SessionSendLargeMessage();
+ break;
+ }
+ case SESS_RECEIVE_MSG:
+ {
+ packet = new SessionReceiveMessage();
+ break;
+ }
+ case SESS_RECEIVE_LARGE_MSG:
+ {
+ packet = new SessionReceiveLargeMessage();
+ break;
+ }
+ case SESS_CONSUMER_CLOSE:
+ {
+ packet = new SessionConsumerCloseMessage();
+ break;
+ }
+ case NULL_RESPONSE:
+ {
+ packet = new NullResponseMessage();
+ break;
+ }
+ case SESS_RECEIVE_CONTINUATION:
+ {
+ packet = new SessionReceiveContinuationMessage();
+ break;
+ }
+ case SESS_SEND_CONTINUATION:
+ {
+ packet = new SessionSendContinuationMessage();
+ break;
+ }
+ case SESS_PRODUCER_REQUEST_CREDITS:
+ {
+ packet = new SessionRequestProducerCreditsMessage();
+ break;
+ }
+ case SESS_PRODUCER_CREDITS:
+ {
+ packet = new SessionProducerCreditsMessage();
+ break;
+ }
+ case CREATE_REPLICATION:
+ {
+ packet = new CreateReplicationSessionMessage();
+ break;
+ }
+ case REPLICATION_APPEND:
+ {
+ packet = new ReplicationAddMessage();
+ break;
+ }
+ case REPLICATION_APPEND_TX:
+ {
+ packet = new ReplicationAddTXMessage();
+ break;
+ }
+ case REPLICATION_DELETE:
+ {
+ packet = new ReplicationDeleteMessage();
+ break;
+ }
+ case REPLICATION_DELETE_TX:
+ {
+ packet = new ReplicationDeleteTXMessage();
+ break;
+ }
+ case REPLICATION_PREPARE:
+ {
+ packet = new ReplicationPrepareMessage();
+ break;
+ }
+ case REPLICATION_COMMIT_ROLLBACK:
+ {
+ packet = new ReplicationCommitMessage();
+ break;
+ }
+ case REPLICATION_RESPONSE:
+ {
+ packet = new ReplicationResponseMessage();
+ break;
+ }
+ case REPLICATION_PAGE_WRITE:
+ {
+ packet = new ReplicationPageWriteMessage();
+ break;
+ }
+ case REPLICATION_PAGE_EVENT:
+ {
+ packet = new ReplicationPageEventMessage();
+ break;
+ }
+ case REPLICATION_LARGE_MESSAGE_BEGIN:
+ {
+ packet = new ReplicationLargeMessageBeingMessage();
+ break;
+ }
+ case REPLICATION_LARGE_MESSAGE_END:
+ {
+ packet = new ReplicationLargemessageEndMessage();
+ break;
+ }
+ case REPLICATION_LARGE_MESSAGE_WRITE:
+ {
+ packet = new ReplicationLargeMessageWriteMessage();
+ break;
+ }
+ case REPLICATION_COMPARE_DATA:
+ {
+ packet = new ReplicationCompareDataMessage();
+ break;
+ }
+ case SESS_FORCE_CONSUMER_DELIVERY:
+ {
+ packet = new SessionForceConsumerDelivery();
+ break;
+ }
+ default:
+ {
+ throw new IllegalArgumentException("Invalid type: " + packetType);
+ }
+ }
+
+ packet.decode(in);
+
+ return packet;
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,311 +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.protocol.core.impl;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.spi.core.protocol.RemotingConnection;
-import org.hornetq.utils.DataConstants;
-
-/**
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- */
-public class PacketImpl implements Packet
-{
- // Constants -------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(PacketImpl.class);
-
- // The minimal size for all the packets, Common data for all the packets (look at PacketImpl.encode)
- public static final int PACKET_HEADERS_SIZE = DataConstants.SIZE_INT + DataConstants.SIZE_BYTE +
- DataConstants.SIZE_LONG;
-
- private static final int INITIAL_PACKET_SIZE = 1500;
-
- protected long channelID;
-
- protected final byte type;
-
- protected int size = -1;
-
- // The packet types
- // -----------------------------------------------------------------------------------
-
- public static final byte PING = 10;
-
- public static final byte DISCONNECT = 11;
-
- // Miscellaneous
- public static final byte EXCEPTION = 20;
-
- public static final byte NULL_RESPONSE = 21;
-
- public static final byte PACKETS_CONFIRMED = 22;
-
- // Server
- public static final byte CREATESESSION = 30;
-
- public static final byte CREATESESSION_RESP = 31;
-
- public static final byte REATTACH_SESSION = 32;
-
- public static final byte REATTACH_SESSION_RESP = 33;
-
- public static final byte CREATE_QUEUE = 34;
-
- public static final byte DELETE_QUEUE = 35;
-
- public static final byte CREATE_REPLICATION = 36;
-
- // Session
- public static final byte SESS_CREATECONSUMER = 40;
-
- public static final byte SESS_ACKNOWLEDGE = 41;
-
- public static final byte SESS_EXPIRED = 42;
-
- public static final byte SESS_COMMIT = 43;
-
- public static final byte SESS_ROLLBACK = 44;
-
- public static final byte SESS_QUEUEQUERY = 45;
-
- public static final byte SESS_QUEUEQUERY_RESP = 46;
-
- public static final byte SESS_BINDINGQUERY = 49;
-
- public static final byte SESS_BINDINGQUERY_RESP = 50;
-
- public static final byte SESS_XA_START = 51;
-
- public static final byte SESS_XA_END = 52;
-
- public static final byte SESS_XA_COMMIT = 53;
-
- public static final byte SESS_XA_PREPARE = 54;
-
- public static final byte SESS_XA_RESP = 55;
-
- public static final byte SESS_XA_ROLLBACK = 56;
-
- public static final byte SESS_XA_JOIN = 57;
-
- public static final byte SESS_XA_SUSPEND = 58;
-
- public static final byte SESS_XA_RESUME = 59;
-
- public static final byte SESS_XA_FORGET = 60;
-
- public static final byte SESS_XA_INDOUBT_XIDS = 61;
-
- public static final byte SESS_XA_INDOUBT_XIDS_RESP = 62;
-
- public static final byte SESS_XA_SET_TIMEOUT = 63;
-
- public static final byte SESS_XA_SET_TIMEOUT_RESP = 64;
-
- public static final byte SESS_XA_GET_TIMEOUT = 65;
-
- public static final byte SESS_XA_GET_TIMEOUT_RESP = 66;
-
- public static final byte SESS_START = 67;
-
- public static final byte SESS_STOP = 68;
-
- public static final byte SESS_CLOSE = 69;
-
- public static final byte SESS_FLOWTOKEN = 70;
-
- public static final byte SESS_SEND = 71;
-
- public static final byte SESS_SEND_LARGE = 72;
-
- public static final byte SESS_SEND_CONTINUATION = 73;
-
- public static final byte SESS_CONSUMER_CLOSE = 74;
-
- public static final byte SESS_RECEIVE_MSG = 75;
-
- public static final byte SESS_RECEIVE_LARGE_MSG = 76;
-
- public static final byte SESS_RECEIVE_CONTINUATION = 77;
-
- public static final byte SESS_FORCE_CONSUMER_DELIVERY = 78;
-
- public static final byte SESS_PRODUCER_REQUEST_CREDITS = 79;
-
- public static final byte SESS_PRODUCER_CREDITS = 80;
-
- // Replication
-
- public static final byte REPLICATION_RESPONSE = 90;
-
- public static final byte REPLICATION_APPEND = 91;
-
- public static final byte REPLICATION_APPEND_TX = 92;
-
- public static final byte REPLICATION_DELETE = 93;
-
- public static final byte REPLICATION_DELETE_TX = 94;
-
- public static final byte REPLICATION_PREPARE = 95;
-
- public static final byte REPLICATION_COMMIT_ROLLBACK = 96;
-
- public static final byte REPLICATION_PAGE_WRITE = 97;
-
- public static final byte REPLICATION_PAGE_EVENT = 98;
-
- public static final byte REPLICATION_LARGE_MESSAGE_BEGIN = 99;
-
- public static final byte REPLICATION_LARGE_MESSAGE_END = 100;
-
- public static final byte REPLICATION_LARGE_MESSAGE_WRITE = 101;
-
- public static final byte REPLICATION_COMPARE_DATA = 102;
-
- public static final byte REPLICATION_SYNC = 103;
-
- // Static --------------------------------------------------------
-
- public PacketImpl(final byte type)
- {
- this.type = type;
- }
-
- // Public --------------------------------------------------------
-
- public byte getType()
- {
- return type;
- }
-
- public long getChannelID()
- {
- return channelID;
- }
-
- public void setChannelID(final long channelID)
- {
- this.channelID = channelID;
- }
-
- public HornetQBuffer encode(final RemotingConnection connection)
- {
- HornetQBuffer buffer = connection.createBuffer(PacketImpl.INITIAL_PACKET_SIZE);
-
- // The standard header fields
-
- buffer.writeInt(0); // The length gets filled in at the end
- buffer.writeByte(type);
- buffer.writeLong(channelID);
-
- encodeRest(buffer);
-
- size = buffer.writerIndex();
-
- // The length doesn't include the actual length byte
- int len = size - DataConstants.SIZE_INT;
-
- buffer.setInt(0, len);
-
- return buffer;
- }
-
- public void decode(final HornetQBuffer buffer)
- {
- channelID = buffer.readLong();
-
- decodeRest(buffer);
-
- size = buffer.readerIndex();
- }
-
- public int getPacketSize()
- {
- if (size == -1)
- {
- throw new IllegalStateException("Packet hasn't been encoded/decoded yet");
- }
-
- return size;
- }
-
- public boolean isResponse()
- {
- return false;
- }
-
- public void encodeRest(final HornetQBuffer buffer)
- {
- }
-
- public void decodeRest(final HornetQBuffer buffer)
- {
- }
-
- public boolean isRequiresConfirmations()
- {
- return true;
- }
-
- public boolean isAsyncExec()
- {
- return false;
- }
-
- @Override
- public String toString()
- {
- return getParentString() + "]";
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof PacketImpl == false)
- {
- return false;
- }
-
- PacketImpl r = (PacketImpl)other;
-
- return r.type == type && r.channelID == channelID;
- }
-
- // Package protected ---------------------------------------------
-
- protected String getParentString()
- {
- return "PACKET[type=" + type + ", channelID=" + channelID + "]";
- }
-
- // Protected -----------------------------------------------------
-
- protected int stringEncodeSize(final String str)
- {
- return DataConstants.SIZE_INT + str.length() * 2;
- }
-
- protected int nullableStringEncodeSize(final String str)
- {
- return DataConstants.SIZE_BOOLEAN + (str != null ? stringEncodeSize(str) : 0);
- }
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,311 @@
+/*
+ * 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.protocol.core.impl;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class PacketImpl implements Packet
+{
+ // Constants -------------------------------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(PacketImpl.class);
+
+ // The minimal size for all the packets, Common data for all the packets (look at PacketImpl.encode)
+ public static final int PACKET_HEADERS_SIZE = DataConstants.SIZE_INT + DataConstants.SIZE_BYTE +
+ DataConstants.SIZE_LONG;
+
+ private static final int INITIAL_PACKET_SIZE = 1500;
+
+ protected long channelID;
+
+ protected final byte type;
+
+ protected int size = -1;
+
+ // The packet types
+ // -----------------------------------------------------------------------------------
+
+ public static final byte PING = 10;
+
+ public static final byte DISCONNECT = 11;
+
+ // Miscellaneous
+ public static final byte EXCEPTION = 20;
+
+ public static final byte NULL_RESPONSE = 21;
+
+ public static final byte PACKETS_CONFIRMED = 22;
+
+ // Server
+ public static final byte CREATESESSION = 30;
+
+ public static final byte CREATESESSION_RESP = 31;
+
+ public static final byte REATTACH_SESSION = 32;
+
+ public static final byte REATTACH_SESSION_RESP = 33;
+
+ public static final byte CREATE_QUEUE = 34;
+
+ public static final byte DELETE_QUEUE = 35;
+
+ public static final byte CREATE_REPLICATION = 36;
+
+ // Session
+ public static final byte SESS_CREATECONSUMER = 40;
+
+ public static final byte SESS_ACKNOWLEDGE = 41;
+
+ public static final byte SESS_EXPIRED = 42;
+
+ public static final byte SESS_COMMIT = 43;
+
+ public static final byte SESS_ROLLBACK = 44;
+
+ public static final byte SESS_QUEUEQUERY = 45;
+
+ public static final byte SESS_QUEUEQUERY_RESP = 46;
+
+ public static final byte SESS_BINDINGQUERY = 49;
+
+ public static final byte SESS_BINDINGQUERY_RESP = 50;
+
+ public static final byte SESS_XA_START = 51;
+
+ public static final byte SESS_XA_END = 52;
+
+ public static final byte SESS_XA_COMMIT = 53;
+
+ public static final byte SESS_XA_PREPARE = 54;
+
+ public static final byte SESS_XA_RESP = 55;
+
+ public static final byte SESS_XA_ROLLBACK = 56;
+
+ public static final byte SESS_XA_JOIN = 57;
+
+ public static final byte SESS_XA_SUSPEND = 58;
+
+ public static final byte SESS_XA_RESUME = 59;
+
+ public static final byte SESS_XA_FORGET = 60;
+
+ public static final byte SESS_XA_INDOUBT_XIDS = 61;
+
+ public static final byte SESS_XA_INDOUBT_XIDS_RESP = 62;
+
+ public static final byte SESS_XA_SET_TIMEOUT = 63;
+
+ public static final byte SESS_XA_SET_TIMEOUT_RESP = 64;
+
+ public static final byte SESS_XA_GET_TIMEOUT = 65;
+
+ public static final byte SESS_XA_GET_TIMEOUT_RESP = 66;
+
+ public static final byte SESS_START = 67;
+
+ public static final byte SESS_STOP = 68;
+
+ public static final byte SESS_CLOSE = 69;
+
+ public static final byte SESS_FLOWTOKEN = 70;
+
+ public static final byte SESS_SEND = 71;
+
+ public static final byte SESS_SEND_LARGE = 72;
+
+ public static final byte SESS_SEND_CONTINUATION = 73;
+
+ public static final byte SESS_CONSUMER_CLOSE = 74;
+
+ public static final byte SESS_RECEIVE_MSG = 75;
+
+ public static final byte SESS_RECEIVE_LARGE_MSG = 76;
+
+ public static final byte SESS_RECEIVE_CONTINUATION = 77;
+
+ public static final byte SESS_FORCE_CONSUMER_DELIVERY = 78;
+
+ public static final byte SESS_PRODUCER_REQUEST_CREDITS = 79;
+
+ public static final byte SESS_PRODUCER_CREDITS = 80;
+
+ // Replication
+
+ public static final byte REPLICATION_RESPONSE = 90;
+
+ public static final byte REPLICATION_APPEND = 91;
+
+ public static final byte REPLICATION_APPEND_TX = 92;
+
+ public static final byte REPLICATION_DELETE = 93;
+
+ public static final byte REPLICATION_DELETE_TX = 94;
+
+ public static final byte REPLICATION_PREPARE = 95;
+
+ public static final byte REPLICATION_COMMIT_ROLLBACK = 96;
+
+ public static final byte REPLICATION_PAGE_WRITE = 97;
+
+ public static final byte REPLICATION_PAGE_EVENT = 98;
+
+ public static final byte REPLICATION_LARGE_MESSAGE_BEGIN = 99;
+
+ public static final byte REPLICATION_LARGE_MESSAGE_END = 100;
+
+ public static final byte REPLICATION_LARGE_MESSAGE_WRITE = 101;
+
+ public static final byte REPLICATION_COMPARE_DATA = 102;
+
+ public static final byte REPLICATION_SYNC = 103;
+
+ // Static --------------------------------------------------------
+
+ public PacketImpl(final byte type)
+ {
+ this.type = type;
+ }
+
+ // Public --------------------------------------------------------
+
+ public byte getType()
+ {
+ return type;
+ }
+
+ public long getChannelID()
+ {
+ return channelID;
+ }
+
+ public void setChannelID(final long channelID)
+ {
+ this.channelID = channelID;
+ }
+
+ public HornetQBuffer encode(final RemotingConnection connection)
+ {
+ HornetQBuffer buffer = connection.createBuffer(PacketImpl.INITIAL_PACKET_SIZE);
+
+ // The standard header fields
+
+ buffer.writeInt(0); // The length gets filled in at the end
+ buffer.writeByte(type);
+ buffer.writeLong(channelID);
+
+ encodeRest(buffer);
+
+ size = buffer.writerIndex();
+
+ // The length doesn't include the actual length byte
+ int len = size - DataConstants.SIZE_INT;
+
+ buffer.setInt(0, len);
+
+ return buffer;
+ }
+
+ public void decode(final HornetQBuffer buffer)
+ {
+ channelID = buffer.readLong();
+
+ decodeRest(buffer);
+
+ size = buffer.readerIndex();
+ }
+
+ public int getPacketSize()
+ {
+ if (size == -1)
+ {
+ throw new IllegalStateException("Packet hasn't been encoded/decoded yet");
+ }
+
+ return size;
+ }
+
+ public boolean isResponse()
+ {
+ return false;
+ }
+
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ }
+
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ }
+
+ public boolean isRequiresConfirmations()
+ {
+ return true;
+ }
+
+ public boolean isAsyncExec()
+ {
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + "]";
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof PacketImpl == false)
+ {
+ return false;
+ }
+
+ PacketImpl r = (PacketImpl)other;
+
+ return r.type == type && r.channelID == channelID;
+ }
+
+ // Package protected ---------------------------------------------
+
+ protected String getParentString()
+ {
+ return "PACKET[type=" + type + ", channelID=" + channelID + "]";
+ }
+
+ // Protected -----------------------------------------------------
+
+ protected int stringEncodeSize(final String str)
+ {
+ return DataConstants.SIZE_INT + str.length() * 2;
+ }
+
+ protected int nullableStringEncodeSize(final String str)
+ {
+ return DataConstants.SIZE_BOOLEAN + (str != null ? stringEncodeSize(str) : 0);
+ }
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,511 +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.protocol.core.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.Executor;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.spi.core.remoting.Connection;
-import org.hornetq.utils.SimpleIDGenerator;
-
-/**
- * @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @version <tt>$Revision$</tt> $Id$
- */
-public class RemotingConnectionImpl extends AbstractBufferHandler implements CoreRemotingConnection
-{
- // Constants
- // ------------------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(RemotingConnectionImpl.class);
-
- // Static
- // ---------------------------------------------------------------------------------------
-
- // Attributes
- // -----------------------------------------------------------------------------------
-
- private final Connection transportConnection;
-
- private final Map<Long, Channel> channels = new ConcurrentHashMap<Long, Channel>();
-
- private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
-
- private final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>();
-
- private final long blockingCallTimeout;
-
- private final List<Interceptor> interceptors;
-
- private volatile boolean destroyed;
-
- private final boolean client;
-
- // Channels 0-9 are reserved for the system
- // 0 is for pinging
- // 1 is for session creation and attachment
- // 2 is for replication
- private volatile SimpleIDGenerator idGenerator = new SimpleIDGenerator(10);
-
- private boolean idGeneratorSynced = false;
-
- private final Object transferLock = new Object();
-
- private final Object failLock = new Object();
-
- private final PacketDecoder decoder = new PacketDecoder();
-
- private volatile boolean dataReceived;
-
- private final Executor executor;
-
- private volatile boolean executing;
-
- // Constructors
- // ---------------------------------------------------------------------------------
-
- /*
- * Create a client side connection
- */
- public RemotingConnectionImpl(final Connection transportConnection,
- final long blockingCallTimeout,
- final List<Interceptor> interceptors)
- {
- this(transportConnection, blockingCallTimeout, interceptors, true, null);
- }
-
- /*
- * Create a server side connection
- */
- public RemotingConnectionImpl(final Connection transportConnection,
- final List<Interceptor> interceptors,
- final Executor executor)
-
- {
- this(transportConnection, -1, interceptors, false, executor);
- }
-
- private RemotingConnectionImpl(final Connection transportConnection,
- final long blockingCallTimeout,
- final List<Interceptor> interceptors,
- final boolean client,
- final Executor executor)
-
- {
- this.transportConnection = transportConnection;
-
- this.blockingCallTimeout = blockingCallTimeout;
-
- this.interceptors = interceptors;
-
- this.client = client;
-
- this.executor = executor;
- }
-
- // RemotingConnection implementation
- // ------------------------------------------------------------
-
- public Connection getTransportConnection()
- {
- return transportConnection;
- }
-
- public List<FailureListener> getFailureListeners()
- {
- return new ArrayList<FailureListener>(failureListeners);
- }
-
- public void setFailureListeners(final List<FailureListener> listeners)
- {
- failureListeners.clear();
-
- failureListeners.addAll(listeners);
- }
-
- public Object getID()
- {
- return transportConnection.getID();
- }
-
- public String getRemoteAddress()
- {
- return transportConnection.getRemoteAddress();
- }
-
- public synchronized Channel getChannel(final long channelID, final int confWindowSize)
- {
- Channel channel = channels.get(channelID);
-
- if (channel == null)
- {
- channel = new ChannelImpl(this, channelID, confWindowSize);
-
- channels.put(channelID, channel);
- }
-
- return channel;
- }
-
- public synchronized boolean removeChannel(final long channelID)
- {
- return channels.remove(channelID) != null;
- }
-
- public synchronized void putChannel(final long channelID, final Channel channel)
- {
- channels.put(channelID, channel);
- }
-
- public void addFailureListener(final FailureListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("FailureListener cannot be null");
- }
-
- failureListeners.add(listener);
- }
-
- public boolean removeFailureListener(final FailureListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("FailureListener cannot be null");
- }
-
- return failureListeners.remove(listener);
- }
-
- public void addCloseListener(final CloseListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("CloseListener cannot be null");
- }
-
- closeListeners.add(listener);
- }
-
- public boolean removeCloseListener(final CloseListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("CloseListener cannot be null");
- }
-
- return closeListeners.remove(listener);
- }
-
- public HornetQBuffer createBuffer(final int size)
- {
- return transportConnection.createBuffer(size);
- }
-
- /*
- * This can be called concurrently by more than one thread so needs to be locked
- */
- public void fail(final HornetQException me)
- {
- synchronized (failLock)
- {
- if (destroyed)
- {
- return;
- }
-
- destroyed = true;
- }
-
- RemotingConnectionImpl.log.warn("Connection failure has been detected: " + me.getMessage() +
- " [code=" +
- me.getCode() +
- "]");
-
- // Then call the listeners
- callFailureListeners(me);
-
- callClosingListeners();
-
- internalClose();
-
- for (Channel channel : channels.values())
- {
- channel.returnBlocking();
- }
- }
-
- public void destroy()
- {
- synchronized (failLock)
- {
- if (destroyed)
- {
- return;
- }
-
- destroyed = true;
- }
-
- internalClose();
-
- callClosingListeners();
- }
-
- public void disconnect()
- {
- Channel channel0 = getChannel(0, -1);
-
- // And we remove all channels from the connection, this ensures no more packets will be processed after this
- // method is
- // complete
-
- Set<Channel> allChannels = new HashSet<Channel>(channels.values());
-
- removeAllChannels();
-
- // Now we are 100% sure that no more packets will be processed we can flush then send the disconnect
-
- for (Channel channel: allChannels)
- {
- channel.flushConfirmations();
- }
-
- channel0.sendAndFlush(new PacketImpl(PacketImpl.DISCONNECT));
- }
-
- public long generateChannelID()
- {
- return idGenerator.generateID();
- }
-
- public synchronized void syncIDGeneratorSequence(final long id)
- {
- if (!idGeneratorSynced)
- {
- idGenerator = new SimpleIDGenerator(id);
-
- idGeneratorSynced = true;
- }
- }
-
- public long getIDGeneratorSequence()
- {
- return idGenerator.getCurrentID();
- }
-
- public Object getTransferLock()
- {
- return transferLock;
- }
-
- public boolean isClient()
- {
- return client;
- }
-
- public boolean isDestroyed()
- {
- return destroyed;
- }
-
- public long getBlockingCallTimeout()
- {
- return blockingCallTimeout;
- }
-
- public boolean checkDataReceived()
- {
- boolean res = dataReceived;
-
- dataReceived = false;
-
- return res;
- }
-
- //We flush any confirmations on the connection - this prevents idle bridges for example
- //sitting there with many unacked messages
- public void flush()
- {
- synchronized (transferLock)
- {
- for (Channel channel : channels.values())
- {
- channel.flushConfirmations();
- }
- }
- }
-
- // Buffer Handler implementation
- // ----------------------------------------------------
-
- public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
- {
- final Packet packet = decoder.decode(buffer);
-
- if (packet.isAsyncExec() && executor != null)
- {
- executing = true;
-
- executor.execute(new Runnable()
- {
- public void run()
- {
- try
- {
- doBufferReceived(packet);
- }
- catch (Throwable t)
- {
- RemotingConnectionImpl.log.error("Unexpected error", t);
- }
-
- executing = false;
- }
- });
- }
- else
- {
- //To prevent out of order execution if interleaving sync and async operations on same connection
- while (executing)
- {
- Thread.yield();
- }
-
- // Pings must always be handled out of band so we can send pings back to the client quickly
- // otherwise they would get in the queue with everything else which might give an intolerable delay
- doBufferReceived(packet);
- }
-
- dataReceived = true;
- }
-
- private void doBufferReceived(final Packet packet)
- {
- if (interceptors != null)
- {
- for (final Interceptor interceptor : interceptors)
- {
- try
- {
- boolean callNext = interceptor.intercept(packet, this);
-
- if (!callNext)
- {
- return;
- }
- }
- catch (final Throwable e)
- {
- RemotingConnectionImpl.log.warn("Failure in calling interceptor: " + interceptor, e);
- }
- }
- }
-
- synchronized (transferLock)
- {
- final Channel channel = channels.get(packet.getChannelID());
-
- if (channel != null)
- {
- channel.handlePacket(packet);
- }
- }
- }
-
- // Package protected
- // ----------------------------------------------------------------------------
-
- // Protected
- // ------------------------------------------------------------------------------------
-
- // Private
- // --------------------------------------------------------------------------------------
-
- private void removeAllChannels()
- {
- // We get the transfer lock first - this ensures no packets are being processed AND
- // it's guaranteed no more packets will be processed once this method is complete
- synchronized (transferLock)
- {
- channels.clear();
- }
- }
- private void callFailureListeners(final HornetQException me)
- {
- final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
-
- for (final FailureListener listener : listenersClone)
- {
- try
- {
- listener.connectionFailed(me);
- }
- catch (final Throwable t)
- {
- // Failure of one listener to execute shouldn't prevent others
- // from
- // executing
- RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
- }
- }
- }
-
- private void callClosingListeners()
- {
- final List<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners);
-
- for (final CloseListener listener : listenersClone)
- {
- try
- {
- listener.connectionClosed();
- }
- catch (final Throwable t)
- {
- // Failure of one listener to execute shouldn't prevent others
- // from
- // executing
- RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
- }
- }
- }
-
- private void internalClose()
- {
- // We close the underlying transport connection
- transportConnection.close();
-
- for (Channel channel : channels.values())
- {
- channel.close();
- }
- }
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,511 @@
+/*
+ * 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.protocol.core.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executor;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.remoting.CloseListener;
+import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.remoting.Connection;
+import org.hornetq.utils.SimpleIDGenerator;
+
+/**
+ * @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ * @version <tt>$Revision$</tt> $Id$
+ */
+public class RemotingConnectionImpl extends AbstractBufferHandler implements CoreRemotingConnection
+{
+ // Constants
+ // ------------------------------------------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(RemotingConnectionImpl.class);
+
+ // Static
+ // ---------------------------------------------------------------------------------------
+
+ // Attributes
+ // -----------------------------------------------------------------------------------
+
+ private final Connection transportConnection;
+
+ private final Map<Long, Channel> channels = new ConcurrentHashMap<Long, Channel>();
+
+ private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
+
+ private final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>();
+
+ private final long blockingCallTimeout;
+
+ private final List<Interceptor> interceptors;
+
+ private volatile boolean destroyed;
+
+ private final boolean client;
+
+ // Channels 0-9 are reserved for the system
+ // 0 is for pinging
+ // 1 is for session creation and attachment
+ // 2 is for replication
+ private volatile SimpleIDGenerator idGenerator = new SimpleIDGenerator(10);
+
+ private boolean idGeneratorSynced = false;
+
+ private final Object transferLock = new Object();
+
+ private final Object failLock = new Object();
+
+ private final PacketDecoder decoder = new PacketDecoder();
+
+ private volatile boolean dataReceived;
+
+ private final Executor executor;
+
+ private volatile boolean executing;
+
+ // Constructors
+ // ---------------------------------------------------------------------------------
+
+ /*
+ * Create a client side connection
+ */
+ public RemotingConnectionImpl(final Connection transportConnection,
+ final long blockingCallTimeout,
+ final List<Interceptor> interceptors)
+ {
+ this(transportConnection, blockingCallTimeout, interceptors, true, null);
+ }
+
+ /*
+ * Create a server side connection
+ */
+ public RemotingConnectionImpl(final Connection transportConnection,
+ final List<Interceptor> interceptors,
+ final Executor executor)
+
+ {
+ this(transportConnection, -1, interceptors, false, executor);
+ }
+
+ private RemotingConnectionImpl(final Connection transportConnection,
+ final long blockingCallTimeout,
+ final List<Interceptor> interceptors,
+ final boolean client,
+ final Executor executor)
+
+ {
+ this.transportConnection = transportConnection;
+
+ this.blockingCallTimeout = blockingCallTimeout;
+
+ this.interceptors = interceptors;
+
+ this.client = client;
+
+ this.executor = executor;
+ }
+
+ // RemotingConnection implementation
+ // ------------------------------------------------------------
+
+ public Connection getTransportConnection()
+ {
+ return transportConnection;
+ }
+
+ public List<FailureListener> getFailureListeners()
+ {
+ return new ArrayList<FailureListener>(failureListeners);
+ }
+
+ public void setFailureListeners(final List<FailureListener> listeners)
+ {
+ failureListeners.clear();
+
+ failureListeners.addAll(listeners);
+ }
+
+ public Object getID()
+ {
+ return transportConnection.getID();
+ }
+
+ public String getRemoteAddress()
+ {
+ return transportConnection.getRemoteAddress();
+ }
+
+ public synchronized Channel getChannel(final long channelID, final int confWindowSize)
+ {
+ Channel channel = channels.get(channelID);
+
+ if (channel == null)
+ {
+ channel = new ChannelImpl(this, channelID, confWindowSize);
+
+ channels.put(channelID, channel);
+ }
+
+ return channel;
+ }
+
+ public synchronized boolean removeChannel(final long channelID)
+ {
+ return channels.remove(channelID) != null;
+ }
+
+ public synchronized void putChannel(final long channelID, final Channel channel)
+ {
+ channels.put(channelID, channel);
+ }
+
+ public void addFailureListener(final FailureListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalStateException("FailureListener cannot be null");
+ }
+
+ failureListeners.add(listener);
+ }
+
+ public boolean removeFailureListener(final FailureListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalStateException("FailureListener cannot be null");
+ }
+
+ return failureListeners.remove(listener);
+ }
+
+ public void addCloseListener(final CloseListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalStateException("CloseListener cannot be null");
+ }
+
+ closeListeners.add(listener);
+ }
+
+ public boolean removeCloseListener(final CloseListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalStateException("CloseListener cannot be null");
+ }
+
+ return closeListeners.remove(listener);
+ }
+
+ public HornetQBuffer createBuffer(final int size)
+ {
+ return transportConnection.createBuffer(size);
+ }
+
+ /*
+ * This can be called concurrently by more than one thread so needs to be locked
+ */
+ public void fail(final HornetQException me)
+ {
+ synchronized (failLock)
+ {
+ if (destroyed)
+ {
+ return;
+ }
+
+ destroyed = true;
+ }
+
+ RemotingConnectionImpl.log.warn("Connection failure has been detected: " + me.getMessage() +
+ " [code=" +
+ me.getCode() +
+ "]");
+
+ // Then call the listeners
+ callFailureListeners(me);
+
+ callClosingListeners();
+
+ internalClose();
+
+ for (Channel channel : channels.values())
+ {
+ channel.returnBlocking();
+ }
+ }
+
+ public void destroy()
+ {
+ synchronized (failLock)
+ {
+ if (destroyed)
+ {
+ return;
+ }
+
+ destroyed = true;
+ }
+
+ internalClose();
+
+ callClosingListeners();
+ }
+
+ public void disconnect()
+ {
+ Channel channel0 = getChannel(0, -1);
+
+ // And we remove all channels from the connection, this ensures no more packets will be processed after this
+ // method is
+ // complete
+
+ Set<Channel> allChannels = new HashSet<Channel>(channels.values());
+
+ removeAllChannels();
+
+ // Now we are 100% sure that no more packets will be processed we can flush then send the disconnect
+
+ for (Channel channel: allChannels)
+ {
+ channel.flushConfirmations();
+ }
+
+ channel0.sendAndFlush(new PacketImpl(PacketImpl.DISCONNECT));
+ }
+
+ public long generateChannelID()
+ {
+ return idGenerator.generateID();
+ }
+
+ public synchronized void syncIDGeneratorSequence(final long id)
+ {
+ if (!idGeneratorSynced)
+ {
+ idGenerator = new SimpleIDGenerator(id);
+
+ idGeneratorSynced = true;
+ }
+ }
+
+ public long getIDGeneratorSequence()
+ {
+ return idGenerator.getCurrentID();
+ }
+
+ public Object getTransferLock()
+ {
+ return transferLock;
+ }
+
+ public boolean isClient()
+ {
+ return client;
+ }
+
+ public boolean isDestroyed()
+ {
+ return destroyed;
+ }
+
+ public long getBlockingCallTimeout()
+ {
+ return blockingCallTimeout;
+ }
+
+ public boolean checkDataReceived()
+ {
+ boolean res = dataReceived;
+
+ dataReceived = false;
+
+ return res;
+ }
+
+ //We flush any confirmations on the connection - this prevents idle bridges for example
+ //sitting there with many unacked messages
+ public void flush()
+ {
+ synchronized (transferLock)
+ {
+ for (Channel channel : channels.values())
+ {
+ channel.flushConfirmations();
+ }
+ }
+ }
+
+ // Buffer Handler implementation
+ // ----------------------------------------------------
+
+ public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
+ {
+ final Packet packet = decoder.decode(buffer);
+
+ if (packet.isAsyncExec() && executor != null)
+ {
+ executing = true;
+
+ executor.execute(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ doBufferReceived(packet);
+ }
+ catch (Throwable t)
+ {
+ RemotingConnectionImpl.log.error("Unexpected error", t);
+ }
+
+ executing = false;
+ }
+ });
+ }
+ else
+ {
+ //To prevent out of order execution if interleaving sync and async operations on same connection
+ while (executing)
+ {
+ Thread.yield();
+ }
+
+ // Pings must always be handled out of band so we can send pings back to the client quickly
+ // otherwise they would get in the queue with everything else which might give an intolerable delay
+ doBufferReceived(packet);
+ }
+
+ dataReceived = true;
+ }
+
+ private void doBufferReceived(final Packet packet)
+ {
+ if (interceptors != null)
+ {
+ for (final Interceptor interceptor : interceptors)
+ {
+ try
+ {
+ boolean callNext = interceptor.intercept(packet, this);
+
+ if (!callNext)
+ {
+ return;
+ }
+ }
+ catch (final Throwable e)
+ {
+ RemotingConnectionImpl.log.warn("Failure in calling interceptor: " + interceptor, e);
+ }
+ }
+ }
+
+ synchronized (transferLock)
+ {
+ final Channel channel = channels.get(packet.getChannelID());
+
+ if (channel != null)
+ {
+ channel.handlePacket(packet);
+ }
+ }
+ }
+
+ // Package protected
+ // ----------------------------------------------------------------------------
+
+ // Protected
+ // ------------------------------------------------------------------------------------
+
+ // Private
+ // --------------------------------------------------------------------------------------
+
+ private void removeAllChannels()
+ {
+ // We get the transfer lock first - this ensures no packets are being processed AND
+ // it's guaranteed no more packets will be processed once this method is complete
+ synchronized (transferLock)
+ {
+ channels.clear();
+ }
+ }
+ private void callFailureListeners(final HornetQException me)
+ {
+ final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
+
+ for (final FailureListener listener : listenersClone)
+ {
+ try
+ {
+ listener.connectionFailed(me);
+ }
+ catch (final Throwable t)
+ {
+ // Failure of one listener to execute shouldn't prevent others
+ // from
+ // executing
+ RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
+ }
+ }
+ }
+
+ private void callClosingListeners()
+ {
+ final List<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners);
+
+ for (final CloseListener listener : listenersClone)
+ {
+ try
+ {
+ listener.connectionClosed();
+ }
+ catch (final Throwable t)
+ {
+ // Failure of one listener to execute shouldn't prevent others
+ // from
+ // executing
+ RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
+ }
+ }
+ }
+
+ private void internalClose()
+ {
+ // We close the underlying transport connection
+ transportConnection.close();
+
+ for (Channel channel : channels.values())
+ {
+ channel.close();
+ }
+ }
+}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat)
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,163 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
-
- * @version <tt>$Revision$</tt>
- */
-public class CreateQueueMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(CreateQueueMessage.class);
-
- // Attributes ----------------------------------------------------
-
- private SimpleString address;
-
- private SimpleString queueName;
-
- private SimpleString filterString;
-
- private boolean durable;
-
- private boolean temporary;
-
- private boolean requiresResponse;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public CreateQueueMessage(final SimpleString address,
- final SimpleString queueName,
- final SimpleString filterString,
- final boolean durable,
- final boolean temporary,
- final boolean requiresResponse)
- {
- super(PacketImpl.CREATE_QUEUE);
-
- this.address = address;
- this.queueName = queueName;
- this.filterString = filterString;
- this.durable = durable;
- this.temporary = temporary;
- this.requiresResponse = requiresResponse;
- }
-
- public CreateQueueMessage()
- {
- super(PacketImpl.CREATE_QUEUE);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public String toString()
- {
- StringBuffer buff = new StringBuffer(getParentString());
- buff.append(", address=" + address);
- buff.append(", queueName=" + queueName);
- buff.append(", filterString=" + filterString);
- buff.append(", durable=" + durable);
- buff.append(", temporary=" + temporary);
- buff.append("]");
- return buff.toString();
- }
-
- public SimpleString getAddress()
- {
- return address;
- }
-
- public SimpleString getQueueName()
- {
- return queueName;
- }
-
- public SimpleString getFilterString()
- {
- return filterString;
- }
-
- public boolean isDurable()
- {
- return durable;
- }
-
- public boolean isTemporary()
- {
- return temporary;
- }
-
- public boolean isRequiresResponse()
- {
- return requiresResponse;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeSimpleString(address);
- buffer.writeSimpleString(queueName);
- buffer.writeNullableSimpleString(filterString);
- buffer.writeBoolean(durable);
- buffer.writeBoolean(temporary);
- buffer.writeBoolean(requiresResponse);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- address = buffer.readSimpleString();
- queueName = buffer.readSimpleString();
- filterString = buffer.readNullableSimpleString();
- durable = buffer.readBoolean();
- temporary = buffer.readBoolean();
- requiresResponse = buffer.readBoolean();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof CreateQueueMessage == false)
- {
- return false;
- }
-
- CreateQueueMessage r = (CreateQueueMessage)other;
-
- return super.equals(other) && r.address.equals(address) &&
- r.queueName.equals(queueName) &&
- (r.filterString == null ? filterString == null : r.filterString.equals(filterString)) &&
- r.durable == durable &&
- r.temporary == temporary;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,163 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+
+ * @version <tt>$Revision$</tt>
+ */
+public class CreateQueueMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(CreateQueueMessage.class);
+
+ // Attributes ----------------------------------------------------
+
+ private SimpleString address;
+
+ private SimpleString queueName;
+
+ private SimpleString filterString;
+
+ private boolean durable;
+
+ private boolean temporary;
+
+ private boolean requiresResponse;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public CreateQueueMessage(final SimpleString address,
+ final SimpleString queueName,
+ final SimpleString filterString,
+ final boolean durable,
+ final boolean temporary,
+ final boolean requiresResponse)
+ {
+ super(PacketImpl.CREATE_QUEUE);
+
+ this.address = address;
+ this.queueName = queueName;
+ this.filterString = filterString;
+ this.durable = durable;
+ this.temporary = temporary;
+ this.requiresResponse = requiresResponse;
+ }
+
+ public CreateQueueMessage()
+ {
+ super(PacketImpl.CREATE_QUEUE);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buff = new StringBuffer(getParentString());
+ buff.append(", address=" + address);
+ buff.append(", queueName=" + queueName);
+ buff.append(", filterString=" + filterString);
+ buff.append(", durable=" + durable);
+ buff.append(", temporary=" + temporary);
+ buff.append("]");
+ return buff.toString();
+ }
+
+ public SimpleString getAddress()
+ {
+ return address;
+ }
+
+ public SimpleString getQueueName()
+ {
+ return queueName;
+ }
+
+ public SimpleString getFilterString()
+ {
+ return filterString;
+ }
+
+ public boolean isDurable()
+ {
+ return durable;
+ }
+
+ public boolean isTemporary()
+ {
+ return temporary;
+ }
+
+ public boolean isRequiresResponse()
+ {
+ return requiresResponse;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeSimpleString(address);
+ buffer.writeSimpleString(queueName);
+ buffer.writeNullableSimpleString(filterString);
+ buffer.writeBoolean(durable);
+ buffer.writeBoolean(temporary);
+ buffer.writeBoolean(requiresResponse);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ address = buffer.readSimpleString();
+ queueName = buffer.readSimpleString();
+ filterString = buffer.readNullableSimpleString();
+ durable = buffer.readBoolean();
+ temporary = buffer.readBoolean();
+ requiresResponse = buffer.readBoolean();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof CreateQueueMessage == false)
+ {
+ return false;
+ }
+
+ CreateQueueMessage r = (CreateQueueMessage)other;
+
+ return super.equals(other) && r.address.equals(address) &&
+ r.queueName.equals(queueName) &&
+ (r.filterString == null ? filterString == null : r.filterString.equals(filterString)) &&
+ r.durable == durable &&
+ r.temporary == temporary;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,75 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Clebert Suconic</a>
- */
-public class CreateReplicationSessionMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long sessionChannelID;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public CreateReplicationSessionMessage(final long sessionChannelID)
- {
- super(PacketImpl.CREATE_REPLICATION);
-
- this.sessionChannelID = sessionChannelID;
- }
-
- public CreateReplicationSessionMessage()
- {
- super(PacketImpl.CREATE_REPLICATION);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(sessionChannelID);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- sessionChannelID = buffer.readLong();
- }
-
- /**
- * @return the sessionChannelID
- */
- public long getSessionChannelID()
- {
- return sessionChannelID;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,75 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Clebert Suconic</a>
+ */
+public class CreateReplicationSessionMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long sessionChannelID;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public CreateReplicationSessionMessage(final long sessionChannelID)
+ {
+ super(PacketImpl.CREATE_REPLICATION);
+
+ this.sessionChannelID = sessionChannelID;
+ }
+
+ public CreateReplicationSessionMessage()
+ {
+ super(PacketImpl.CREATE_REPLICATION);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(sessionChannelID);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ sessionChannelID = buffer.readLong();
+ }
+
+ /**
+ * @return the sessionChannelID
+ */
+ public long getSessionChannelID()
+ {
+ return sessionChannelID;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,223 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>.
- *
- * @version <tt>$Revision$</tt>
- */
-public class CreateSessionMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private String name;
-
- private long sessionChannelID;
-
- private int version;
-
- private String username;
-
- private String password;
-
- private int minLargeMessageSize;
-
- private boolean xa;
-
- private boolean autoCommitSends;
-
- private boolean autoCommitAcks;
-
- private boolean preAcknowledge;
-
- private int windowSize;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public CreateSessionMessage(final String name,
- final long sessionChannelID,
- final int version,
- final String username,
- final String password,
- final int minLargeMessageSize,
- final boolean xa,
- final boolean autoCommitSends,
- final boolean autoCommitAcks,
- final boolean preAcknowledge,
- final int windowSize)
- {
- super(PacketImpl.CREATESESSION);
-
- this.name = name;
-
- this.sessionChannelID = sessionChannelID;
-
- this.version = version;
-
- this.username = username;
-
- this.password = password;
-
- this.minLargeMessageSize = minLargeMessageSize;
-
- this.xa = xa;
-
- this.autoCommitSends = autoCommitSends;
-
- this.autoCommitAcks = autoCommitAcks;
-
- this.windowSize = windowSize;
-
- this.preAcknowledge = preAcknowledge;
- }
-
- public CreateSessionMessage()
- {
- super(PacketImpl.CREATESESSION);
- }
-
- // Public --------------------------------------------------------
-
- public String getName()
- {
- return name;
- }
-
- public long getSessionChannelID()
- {
- return sessionChannelID;
- }
-
- public int getVersion()
- {
- return version;
- }
-
- public String getUsername()
- {
- return username;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public boolean isXA()
- {
- return xa;
- }
-
- public boolean isAutoCommitSends()
- {
- return autoCommitSends;
- }
-
- public boolean isAutoCommitAcks()
- {
- return autoCommitAcks;
- }
-
- public boolean isPreAcknowledge()
- {
- return preAcknowledge;
- }
-
- public int getWindowSize()
- {
- return windowSize;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeString(name);
- buffer.writeLong(sessionChannelID);
- buffer.writeInt(version);
- buffer.writeNullableString(username);
- buffer.writeNullableString(password);
- buffer.writeInt(minLargeMessageSize);
- buffer.writeBoolean(xa);
- buffer.writeBoolean(autoCommitSends);
- buffer.writeBoolean(autoCommitAcks);
- buffer.writeInt(windowSize);
- buffer.writeBoolean(preAcknowledge);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- name = buffer.readString();
- sessionChannelID = buffer.readLong();
- version = buffer.readInt();
- username = buffer.readNullableString();
- password = buffer.readNullableString();
- minLargeMessageSize = buffer.readInt();
- xa = buffer.readBoolean();
- autoCommitSends = buffer.readBoolean();
- autoCommitAcks = buffer.readBoolean();
- windowSize = buffer.readInt();
- preAcknowledge = buffer.readBoolean();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof CreateSessionMessage == false)
- {
- return false;
- }
-
- CreateSessionMessage r = (CreateSessionMessage)other;
-
- boolean matches = super.equals(other) && name.equals(r.name) &&
- sessionChannelID == r.sessionChannelID &&
- version == r.version &&
- xa == r.xa &&
- autoCommitSends == r.autoCommitSends &&
- autoCommitAcks == r.autoCommitAcks &&
- (username == null ? r.username == null : username.equals(r.username)) &&
- (password == null ? r.password == null : password.equals(r.password));
-
- return matches;
- }
-
- @Override
- public final boolean isRequiresConfirmations()
- {
- return false;
- }
-
- public int getMinLargeMessageSize()
- {
- return minLargeMessageSize;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,223 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>.
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class CreateSessionMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private String name;
+
+ private long sessionChannelID;
+
+ private int version;
+
+ private String username;
+
+ private String password;
+
+ private int minLargeMessageSize;
+
+ private boolean xa;
+
+ private boolean autoCommitSends;
+
+ private boolean autoCommitAcks;
+
+ private boolean preAcknowledge;
+
+ private int windowSize;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public CreateSessionMessage(final String name,
+ final long sessionChannelID,
+ final int version,
+ final String username,
+ final String password,
+ final int minLargeMessageSize,
+ final boolean xa,
+ final boolean autoCommitSends,
+ final boolean autoCommitAcks,
+ final boolean preAcknowledge,
+ final int windowSize)
+ {
+ super(PacketImpl.CREATESESSION);
+
+ this.name = name;
+
+ this.sessionChannelID = sessionChannelID;
+
+ this.version = version;
+
+ this.username = username;
+
+ this.password = password;
+
+ this.minLargeMessageSize = minLargeMessageSize;
+
+ this.xa = xa;
+
+ this.autoCommitSends = autoCommitSends;
+
+ this.autoCommitAcks = autoCommitAcks;
+
+ this.windowSize = windowSize;
+
+ this.preAcknowledge = preAcknowledge;
+ }
+
+ public CreateSessionMessage()
+ {
+ super(PacketImpl.CREATESESSION);
+ }
+
+ // Public --------------------------------------------------------
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public long getSessionChannelID()
+ {
+ return sessionChannelID;
+ }
+
+ public int getVersion()
+ {
+ return version;
+ }
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public boolean isXA()
+ {
+ return xa;
+ }
+
+ public boolean isAutoCommitSends()
+ {
+ return autoCommitSends;
+ }
+
+ public boolean isAutoCommitAcks()
+ {
+ return autoCommitAcks;
+ }
+
+ public boolean isPreAcknowledge()
+ {
+ return preAcknowledge;
+ }
+
+ public int getWindowSize()
+ {
+ return windowSize;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeString(name);
+ buffer.writeLong(sessionChannelID);
+ buffer.writeInt(version);
+ buffer.writeNullableString(username);
+ buffer.writeNullableString(password);
+ buffer.writeInt(minLargeMessageSize);
+ buffer.writeBoolean(xa);
+ buffer.writeBoolean(autoCommitSends);
+ buffer.writeBoolean(autoCommitAcks);
+ buffer.writeInt(windowSize);
+ buffer.writeBoolean(preAcknowledge);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ name = buffer.readString();
+ sessionChannelID = buffer.readLong();
+ version = buffer.readInt();
+ username = buffer.readNullableString();
+ password = buffer.readNullableString();
+ minLargeMessageSize = buffer.readInt();
+ xa = buffer.readBoolean();
+ autoCommitSends = buffer.readBoolean();
+ autoCommitAcks = buffer.readBoolean();
+ windowSize = buffer.readInt();
+ preAcknowledge = buffer.readBoolean();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof CreateSessionMessage == false)
+ {
+ return false;
+ }
+
+ CreateSessionMessage r = (CreateSessionMessage)other;
+
+ boolean matches = super.equals(other) && name.equals(r.name) &&
+ sessionChannelID == r.sessionChannelID &&
+ version == r.version &&
+ xa == r.xa &&
+ autoCommitSends == r.autoCommitSends &&
+ autoCommitAcks == r.autoCommitAcks &&
+ (username == null ? r.username == null : username.equals(r.username)) &&
+ (password == null ? r.password == null : password.equals(r.password));
+
+ return matches;
+ }
+
+ @Override
+ public final boolean isRequiresConfirmations()
+ {
+ return false;
+ }
+
+ public int getMinLargeMessageSize()
+ {
+ return minLargeMessageSize;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,102 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>.
- *
- * @version <tt>$Revision$</tt>
- */
-public class CreateSessionResponseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private int serverVersion;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public CreateSessionResponseMessage(final int serverVersion)
- {
- super(PacketImpl.CREATESESSION_RESP);
-
- this.serverVersion = serverVersion;
- }
-
- public CreateSessionResponseMessage()
- {
- super(PacketImpl.CREATESESSION_RESP);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- public int getServerVersion()
- {
- return serverVersion;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(serverVersion);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- serverVersion = buffer.readInt();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof CreateSessionResponseMessage == false)
- {
- return false;
- }
-
- CreateSessionResponseMessage r = (CreateSessionResponseMessage)other;
-
- boolean matches = super.equals(other) && serverVersion == r.serverVersion;
-
- return matches;
- }
-
- @Override
- public final boolean isRequiresConfirmations()
- {
- return false;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,102 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>.
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class CreateSessionResponseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private int serverVersion;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public CreateSessionResponseMessage(final int serverVersion)
+ {
+ super(PacketImpl.CREATESESSION_RESP);
+
+ this.serverVersion = serverVersion;
+ }
+
+ public CreateSessionResponseMessage()
+ {
+ super(PacketImpl.CREATESESSION_RESP);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ public int getServerVersion()
+ {
+ return serverVersion;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(serverVersion);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ serverVersion = buffer.readInt();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof CreateSessionResponseMessage == false)
+ {
+ return false;
+ }
+
+ CreateSessionResponseMessage r = (CreateSessionResponseMessage)other;
+
+ boolean matches = super.equals(other) && serverVersion == r.serverVersion;
+
+ return matches;
+ }
+
+ @Override
+ public final boolean isRequiresConfirmations()
+ {
+ return false;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,109 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class HornetQExceptionMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(HornetQExceptionMessage.class);
-
- // Attributes ----------------------------------------------------
-
- private HornetQException exception;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public HornetQExceptionMessage(final HornetQException exception)
- {
- super(PacketImpl.EXCEPTION);
-
- this.exception = exception;
- }
-
- public HornetQExceptionMessage()
- {
- super(PacketImpl.EXCEPTION);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- public HornetQException getException()
- {
- return exception;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(exception.getCode());
- buffer.writeNullableString(exception.getMessage());
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- int code = buffer.readInt();
- String msg = buffer.readNullableString();
-
- exception = new HornetQException(code, msg);
- }
-
- @Override
- public String toString()
- {
- return getParentString() + ", exception= " + exception + "]";
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof HornetQExceptionMessage == false)
- {
- return false;
- }
-
- HornetQExceptionMessage r = (HornetQExceptionMessage)other;
-
- return super.equals(other) && exception.equals(r.exception);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,109 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class HornetQExceptionMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(HornetQExceptionMessage.class);
+
+ // Attributes ----------------------------------------------------
+
+ private HornetQException exception;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public HornetQExceptionMessage(final HornetQException exception)
+ {
+ super(PacketImpl.EXCEPTION);
+
+ this.exception = exception;
+ }
+
+ public HornetQExceptionMessage()
+ {
+ super(PacketImpl.EXCEPTION);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ public HornetQException getException()
+ {
+ return exception;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(exception.getCode());
+ buffer.writeNullableString(exception.getMessage());
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ int code = buffer.readInt();
+ String msg = buffer.readNullableString();
+
+ exception = new HornetQException(code, msg);
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + ", exception= " + exception + "]";
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof HornetQExceptionMessage == false)
+ {
+ return false;
+ }
+
+ HornetQExceptionMessage r = (HornetQExceptionMessage)other;
+
+ return super.equals(other) && exception.equals(r.exception);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.Message;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A MessagePacket
- *
- * @author Tim Fox
- *
- *
- */
-public abstract class MessagePacket extends PacketImpl
-{
- private static final Logger log = Logger.getLogger(MessagePacket.class);
-
- protected MessageInternal message;
-
- public MessagePacket(final byte type, final MessageInternal message)
- {
- super(type);
-
- this.message = message;
- }
-
- public Message getMessage()
- {
- return message;
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,46 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.Message;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.message.impl.MessageInternal;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A MessagePacket
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public abstract class MessagePacket extends PacketImpl
+{
+ private static final Logger log = Logger.getLogger(MessagePacket.class);
+
+ protected MessageInternal message;
+
+ public MessagePacket(final byte type, final MessageInternal message)
+ {
+ super(type);
+
+ this.message = message;
+ }
+
+ public Message getMessage()
+ {
+ return message;
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,52 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- */
-public class NullResponseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public NullResponseMessage()
- {
- super(PacketImpl.NULL_RESPONSE);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,52 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class NullResponseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public NullResponseMessage()
+ {
+ super(PacketImpl.NULL_RESPONSE);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,101 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- *
- * A PacketsConfirmedMessage
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class PacketsConfirmedMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private int commandID;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public PacketsConfirmedMessage(final int commandID)
- {
- super(PacketImpl.PACKETS_CONFIRMED);
-
- this.commandID = commandID;
- }
-
- public PacketsConfirmedMessage()
- {
- super(PacketImpl.PACKETS_CONFIRMED);
- }
-
- // Public --------------------------------------------------------
-
- public int getCommandID()
- {
- return commandID;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(commandID);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- commandID = buffer.readInt();
- }
-
- @Override
- public String toString()
- {
- return getParentString() + ", commandID=" + commandID + "]";
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof PacketsConfirmedMessage == false)
- {
- return false;
- }
-
- PacketsConfirmedMessage r = (PacketsConfirmedMessage)other;
-
- return super.equals(other) && commandID == r.commandID;
- }
-
- @Override
- public final boolean isRequiresConfirmations()
- {
- return false;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,101 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ *
+ * A PacketsConfirmedMessage
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class PacketsConfirmedMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private int commandID;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public PacketsConfirmedMessage(final int commandID)
+ {
+ super(PacketImpl.PACKETS_CONFIRMED);
+
+ this.commandID = commandID;
+ }
+
+ public PacketsConfirmedMessage()
+ {
+ super(PacketImpl.PACKETS_CONFIRMED);
+ }
+
+ // Public --------------------------------------------------------
+
+ public int getCommandID()
+ {
+ return commandID;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(commandID);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ commandID = buffer.readInt();
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + ", commandID=" + commandID + "]";
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof PacketsConfirmedMessage == false)
+ {
+ return false;
+ }
+
+ PacketsConfirmedMessage r = (PacketsConfirmedMessage)other;
+
+ return super.equals(other) && commandID == r.commandID;
+ }
+
+ @Override
+ public final boolean isRequiresConfirmations()
+ {
+ return false;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,104 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- *
- * A Ping
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class Ping extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long connectionTTL;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public Ping(final long connectionTTL)
- {
- super(PacketImpl.PING);
-
- this.connectionTTL = connectionTTL;
- }
-
- public Ping()
- {
- super(PacketImpl.PING);
- }
-
- // Public --------------------------------------------------------
-
- public long getConnectionTTL()
- {
- return connectionTTL;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(connectionTTL);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- connectionTTL = buffer.readLong();
- }
-
- @Override
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getParentString());
- buf.append(", connectionTTL=" + connectionTTL);
- buf.append("]");
- return buf.toString();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof Ping == false)
- {
- return false;
- }
-
- Ping r = (Ping)other;
-
- return super.equals(other) && connectionTTL == r.connectionTTL;
- }
-
- @Override
- public final boolean isRequiresConfirmations()
- {
- return false;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,104 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ *
+ * A Ping
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class Ping extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long connectionTTL;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public Ping(final long connectionTTL)
+ {
+ super(PacketImpl.PING);
+
+ this.connectionTTL = connectionTTL;
+ }
+
+ public Ping()
+ {
+ super(PacketImpl.PING);
+ }
+
+ // Public --------------------------------------------------------
+
+ public long getConnectionTTL()
+ {
+ return connectionTTL;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(connectionTTL);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ connectionTTL = buffer.readLong();
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer(getParentString());
+ buf.append(", connectionTTL=" + connectionTTL);
+ buf.append("]");
+ return buf.toString();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof Ping == false)
+ {
+ return false;
+ }
+
+ Ping r = (Ping)other;
+
+ return super.equals(other) && connectionTTL == r.connectionTTL;
+ }
+
+ @Override
+ public final boolean isRequiresConfirmations()
+ {
+ return false;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,106 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- *
- * A ReattachSessionMessage
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class ReattachSessionMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private String name;
-
- private int lastConfirmedCommandID;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReattachSessionMessage(final String name, final int lastConfirmedCommandID)
- {
- super(PacketImpl.REATTACH_SESSION);
-
- this.name = name;
-
- this.lastConfirmedCommandID = lastConfirmedCommandID;
- }
-
- public ReattachSessionMessage()
- {
- super(PacketImpl.REATTACH_SESSION);
- }
-
- // Public --------------------------------------------------------
-
- public String getName()
- {
- return name;
- }
-
- public int getLastConfirmedCommandID()
- {
- return lastConfirmedCommandID;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeString(name);
- buffer.writeInt(lastConfirmedCommandID);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- name = buffer.readString();
- lastConfirmedCommandID = buffer.readInt();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof ReattachSessionMessage == false)
- {
- return false;
- }
-
- ReattachSessionMessage r = (ReattachSessionMessage)other;
-
- return super.equals(other) && name.equals(r.name);
- }
-
- @Override
- public final boolean isRequiresConfirmations()
- {
- return false;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,106 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ *
+ * A ReattachSessionMessage
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class ReattachSessionMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private String name;
+
+ private int lastConfirmedCommandID;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReattachSessionMessage(final String name, final int lastConfirmedCommandID)
+ {
+ super(PacketImpl.REATTACH_SESSION);
+
+ this.name = name;
+
+ this.lastConfirmedCommandID = lastConfirmedCommandID;
+ }
+
+ public ReattachSessionMessage()
+ {
+ super(PacketImpl.REATTACH_SESSION);
+ }
+
+ // Public --------------------------------------------------------
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public int getLastConfirmedCommandID()
+ {
+ return lastConfirmedCommandID;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeString(name);
+ buffer.writeInt(lastConfirmedCommandID);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ name = buffer.readString();
+ lastConfirmedCommandID = buffer.readInt();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof ReattachSessionMessage == false)
+ {
+ return false;
+ }
+
+ ReattachSessionMessage r = (ReattachSessionMessage)other;
+
+ return super.equals(other) && name.equals(r.name);
+ }
+
+ @Override
+ public final boolean isRequiresConfirmations()
+ {
+ return false;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,112 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- *
- * A ReattachSessionResponseMessage
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class ReattachSessionResponseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private int lastConfirmedCommandID;
-
- private boolean reattached;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReattachSessionResponseMessage(final int lastConfirmedCommandID, final boolean reattached)
- {
- super(PacketImpl.REATTACH_SESSION_RESP);
-
- this.lastConfirmedCommandID = lastConfirmedCommandID;
-
- this.reattached = reattached;
- }
-
- public ReattachSessionResponseMessage()
- {
- super(PacketImpl.REATTACH_SESSION_RESP);
- }
-
- // Public --------------------------------------------------------
-
- public int getLastConfirmedCommandID()
- {
- return lastConfirmedCommandID;
- }
-
- public boolean isReattached()
- {
- return reattached;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(lastConfirmedCommandID);
- buffer.writeBoolean(reattached);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- lastConfirmedCommandID = buffer.readInt();
- reattached = buffer.readBoolean();
- }
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof ReattachSessionResponseMessage == false)
- {
- return false;
- }
-
- ReattachSessionResponseMessage r = (ReattachSessionResponseMessage)other;
-
- return super.equals(other) && lastConfirmedCommandID == r.lastConfirmedCommandID;
- }
-
- @Override
- public final boolean isRequiresConfirmations()
- {
- return false;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,112 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ *
+ * A ReattachSessionResponseMessage
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class ReattachSessionResponseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private int lastConfirmedCommandID;
+
+ private boolean reattached;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReattachSessionResponseMessage(final int lastConfirmedCommandID, final boolean reattached)
+ {
+ super(PacketImpl.REATTACH_SESSION_RESP);
+
+ this.lastConfirmedCommandID = lastConfirmedCommandID;
+
+ this.reattached = reattached;
+ }
+
+ public ReattachSessionResponseMessage()
+ {
+ super(PacketImpl.REATTACH_SESSION_RESP);
+ }
+
+ // Public --------------------------------------------------------
+
+ public int getLastConfirmedCommandID()
+ {
+ return lastConfirmedCommandID;
+ }
+
+ public boolean isReattached()
+ {
+ return reattached;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(lastConfirmedCommandID);
+ buffer.writeBoolean(reattached);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ lastConfirmedCommandID = buffer.readInt();
+ reattached = buffer.readBoolean();
+ }
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof ReattachSessionResponseMessage == false)
+ {
+ return false;
+ }
+
+ ReattachSessionResponseMessage r = (ReattachSessionResponseMessage)other;
+
+ return super.equals(other) && lastConfirmedCommandID == r.lastConfirmedCommandID;
+ }
+
+ @Override
+ public final boolean isRequiresConfirmations()
+ {
+ return false;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,143 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationAddMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationAddMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(ReplicationAddMessage.class);
-
- // Attributes ----------------------------------------------------
-
- private long id;
-
- /** 0 - Bindings, 1 - MessagesJournal */
- private byte journalID;
-
- private boolean isUpdate;
-
- private byte recordType;
-
- private EncodingSupport encodingData;
-
- private byte[] recordData;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationAddMessage()
- {
- super(PacketImpl.REPLICATION_APPEND);
- }
-
- public ReplicationAddMessage(final byte journalID,
- final boolean isUpdate,
- final long id,
- final byte recordType,
- final EncodingSupport encodingData)
- {
- this();
- this.journalID = journalID;
- this.isUpdate = isUpdate;
- this.id = id;
- this.recordType = recordType;
- this.encodingData = encodingData;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeByte(journalID);
- buffer.writeBoolean(isUpdate);
- buffer.writeLong(id);
- buffer.writeByte(recordType);
- buffer.writeInt(encodingData.getEncodeSize());
- encodingData.encode(buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- journalID = buffer.readByte();
- isUpdate = buffer.readBoolean();
- id = buffer.readLong();
- recordType = buffer.readByte();
- int size = buffer.readInt();
- recordData = new byte[size];
- buffer.readBytes(recordData);
- }
-
- /**
- * @return the id
- */
- public long getId()
- {
- return id;
- }
-
- /**
- * @return the journalID
- */
- public byte getJournalID()
- {
- return journalID;
- }
-
- public boolean isUpdate()
- {
- return isUpdate;
- }
-
- /**
- * @return the recordType
- */
- public byte getRecordType()
- {
- return recordType;
- }
-
- /**
- * @return the recordData
- */
- public byte[] getRecordData()
- {
- return recordData;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,143 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.journal.EncodingSupport;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationAddMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationAddMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(ReplicationAddMessage.class);
+
+ // Attributes ----------------------------------------------------
+
+ private long id;
+
+ /** 0 - Bindings, 1 - MessagesJournal */
+ private byte journalID;
+
+ private boolean isUpdate;
+
+ private byte recordType;
+
+ private EncodingSupport encodingData;
+
+ private byte[] recordData;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationAddMessage()
+ {
+ super(PacketImpl.REPLICATION_APPEND);
+ }
+
+ public ReplicationAddMessage(final byte journalID,
+ final boolean isUpdate,
+ final long id,
+ final byte recordType,
+ final EncodingSupport encodingData)
+ {
+ this();
+ this.journalID = journalID;
+ this.isUpdate = isUpdate;
+ this.id = id;
+ this.recordType = recordType;
+ this.encodingData = encodingData;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeByte(journalID);
+ buffer.writeBoolean(isUpdate);
+ buffer.writeLong(id);
+ buffer.writeByte(recordType);
+ buffer.writeInt(encodingData.getEncodeSize());
+ encodingData.encode(buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ journalID = buffer.readByte();
+ isUpdate = buffer.readBoolean();
+ id = buffer.readLong();
+ recordType = buffer.readByte();
+ int size = buffer.readInt();
+ recordData = new byte[size];
+ buffer.readBytes(recordData);
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId()
+ {
+ return id;
+ }
+
+ /**
+ * @return the journalID
+ */
+ public byte getJournalID()
+ {
+ return journalID;
+ }
+
+ public boolean isUpdate()
+ {
+ return isUpdate;
+ }
+
+ /**
+ * @return the recordType
+ */
+ public byte getRecordType()
+ {
+ return recordType;
+ }
+
+ /**
+ * @return the recordData
+ */
+ public byte[] getRecordData()
+ {
+ return recordData;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,151 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationAddMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationAddTXMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long txId;
-
- private long id;
-
- /** 0 - Bindings, 1 - MessagesJournal */
- private byte journalID;
-
- private boolean isUpdate;
-
- private byte recordType;
-
- private EncodingSupport encodingData;
-
- private byte[] recordData;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationAddTXMessage()
- {
- super(PacketImpl.REPLICATION_APPEND_TX);
- }
-
- public ReplicationAddTXMessage(final byte journalID,
- final boolean isUpdate,
- final long txId,
- final long id,
- final byte recordType,
- final EncodingSupport encodingData)
- {
- this();
- this.journalID = journalID;
- this.isUpdate = isUpdate;
- this.txId = txId;
- this.id = id;
- this.recordType = recordType;
- this.encodingData = encodingData;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeByte(journalID);
- buffer.writeBoolean(isUpdate);
- buffer.writeLong(txId);
- buffer.writeLong(id);
- buffer.writeByte(recordType);
- buffer.writeInt(encodingData.getEncodeSize());
- encodingData.encode(buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- journalID = buffer.readByte();
- isUpdate = buffer.readBoolean();
- txId = buffer.readLong();
- id = buffer.readLong();
- recordType = buffer.readByte();
- int size = buffer.readInt();
- recordData = new byte[size];
- buffer.readBytes(recordData);
- }
-
- /**
- * @return the id
- */
- public long getId()
- {
- return id;
- }
-
- public long getTxId()
- {
- return txId;
- }
-
- /**
- * @return the journalID
- */
- public byte getJournalID()
- {
- return journalID;
- }
-
- public boolean isUpdate()
- {
- return isUpdate;
- }
-
- /**
- * @return the recordType
- */
- public byte getRecordType()
- {
- return recordType;
- }
-
- /**
- * @return the recordData
- */
- public byte[] getRecordData()
- {
- return recordData;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,151 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.journal.EncodingSupport;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationAddMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationAddTXMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long txId;
+
+ private long id;
+
+ /** 0 - Bindings, 1 - MessagesJournal */
+ private byte journalID;
+
+ private boolean isUpdate;
+
+ private byte recordType;
+
+ private EncodingSupport encodingData;
+
+ private byte[] recordData;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationAddTXMessage()
+ {
+ super(PacketImpl.REPLICATION_APPEND_TX);
+ }
+
+ public ReplicationAddTXMessage(final byte journalID,
+ final boolean isUpdate,
+ final long txId,
+ final long id,
+ final byte recordType,
+ final EncodingSupport encodingData)
+ {
+ this();
+ this.journalID = journalID;
+ this.isUpdate = isUpdate;
+ this.txId = txId;
+ this.id = id;
+ this.recordType = recordType;
+ this.encodingData = encodingData;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeByte(journalID);
+ buffer.writeBoolean(isUpdate);
+ buffer.writeLong(txId);
+ buffer.writeLong(id);
+ buffer.writeByte(recordType);
+ buffer.writeInt(encodingData.getEncodeSize());
+ encodingData.encode(buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ journalID = buffer.readByte();
+ isUpdate = buffer.readBoolean();
+ txId = buffer.readLong();
+ id = buffer.readLong();
+ recordType = buffer.readByte();
+ int size = buffer.readInt();
+ recordData = new byte[size];
+ buffer.readBytes(recordData);
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId()
+ {
+ return id;
+ }
+
+ public long getTxId()
+ {
+ return txId;
+ }
+
+ /**
+ * @return the journalID
+ */
+ public byte getJournalID()
+ {
+ return journalID;
+ }
+
+ public boolean isUpdate()
+ {
+ return isUpdate;
+ }
+
+ /**
+ * @return the recordType
+ */
+ public byte getRecordType()
+ {
+ return recordType;
+ }
+
+ /**
+ * @return the recordData
+ */
+ public byte[] getRecordData()
+ {
+ return recordData;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,101 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationAddMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationCommitMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- /** 0 - Bindings, 1 - MessagesJournal */
- private byte journalID;
-
- private boolean rollback;
-
- private long txId;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationCommitMessage()
- {
- super(PacketImpl.REPLICATION_COMMIT_ROLLBACK);
- }
-
- public ReplicationCommitMessage(final byte journalID, final boolean rollback, final long txId)
- {
- this();
- this.journalID = journalID;
- this.rollback = rollback;
- this.txId = txId;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeByte(journalID);
- buffer.writeBoolean(rollback);
- buffer.writeLong(txId);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- journalID = buffer.readByte();
- rollback = buffer.readBoolean();
- txId = buffer.readLong();
- }
-
- public boolean isRollback()
- {
- return rollback;
- }
-
- public long getTxId()
- {
- return txId;
- }
-
- /**
- * @return the journalID
- */
- public byte getJournalID()
- {
- return journalID;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,101 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationAddMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationCommitMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ /** 0 - Bindings, 1 - MessagesJournal */
+ private byte journalID;
+
+ private boolean rollback;
+
+ private long txId;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationCommitMessage()
+ {
+ super(PacketImpl.REPLICATION_COMMIT_ROLLBACK);
+ }
+
+ public ReplicationCommitMessage(final byte journalID, final boolean rollback, final long txId)
+ {
+ this();
+ this.journalID = journalID;
+ this.rollback = rollback;
+ this.txId = txId;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeByte(journalID);
+ buffer.writeBoolean(rollback);
+ buffer.writeLong(txId);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ journalID = buffer.readByte();
+ rollback = buffer.readBoolean();
+ txId = buffer.readLong();
+ }
+
+ public boolean isRollback()
+ {
+ return rollback;
+ }
+
+ public long getTxId()
+ {
+ return txId;
+ }
+
+ /**
+ * @return the journalID
+ */
+ public byte getJournalID()
+ {
+ return journalID;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,93 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.journal.JournalLoadInformation;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * Message used to compare if the Journals between the live and
- * backup nodes are equivalent and can be used over replication.
- * The backup journal needs to be an exact copy of the live node before it starts.
- * @author <a href="mailto:tim.fox@jboss.com">Clebert Suconic</a>
- */
-public class ReplicationCompareDataMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private JournalLoadInformation[] journalInformation;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationCompareDataMessage(final JournalLoadInformation[] journalInformation)
- {
- super(PacketImpl.REPLICATION_COMPARE_DATA);
-
- this.journalInformation = journalInformation;
- }
-
- public ReplicationCompareDataMessage()
- {
- super(PacketImpl.REPLICATION_COMPARE_DATA);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(journalInformation.length);
- for (JournalLoadInformation info : journalInformation)
- {
- buffer.writeInt(info.getNumberOfRecords());
- buffer.writeLong(info.getMaxID());
- }
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- int numberOfJournals = buffer.readInt();
-
- journalInformation = new JournalLoadInformation[numberOfJournals];
-
- for (int i = 0; i < numberOfJournals; i++)
- {
- journalInformation[i] = new JournalLoadInformation();
- journalInformation[i].setNumberOfRecords(buffer.readInt());
- journalInformation[i].setMaxID(buffer.readLong());
- }
- }
-
- /**
- * @return the journalInformation
- */
- public JournalLoadInformation[] getJournalInformation()
- {
- return journalInformation;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,93 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.journal.JournalLoadInformation;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * Message used to compare if the Journals between the live and
+ * backup nodes are equivalent and can be used over replication.
+ * The backup journal needs to be an exact copy of the live node before it starts.
+ * @author <a href="mailto:tim.fox@jboss.com">Clebert Suconic</a>
+ */
+public class ReplicationCompareDataMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private JournalLoadInformation[] journalInformation;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationCompareDataMessage(final JournalLoadInformation[] journalInformation)
+ {
+ super(PacketImpl.REPLICATION_COMPARE_DATA);
+
+ this.journalInformation = journalInformation;
+ }
+
+ public ReplicationCompareDataMessage()
+ {
+ super(PacketImpl.REPLICATION_COMPARE_DATA);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(journalInformation.length);
+ for (JournalLoadInformation info : journalInformation)
+ {
+ buffer.writeInt(info.getNumberOfRecords());
+ buffer.writeLong(info.getMaxID());
+ }
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ int numberOfJournals = buffer.readInt();
+
+ journalInformation = new JournalLoadInformation[numberOfJournals];
+
+ for (int i = 0; i < numberOfJournals; i++)
+ {
+ journalInformation[i] = new JournalLoadInformation();
+ journalInformation[i].setNumberOfRecords(buffer.readInt());
+ journalInformation[i].setMaxID(buffer.readLong());
+ }
+ }
+
+ /**
+ * @return the journalInformation
+ */
+ public JournalLoadInformation[] getJournalInformation()
+ {
+ return journalInformation;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,94 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationAddMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationDeleteMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long id;
-
- /** 0 - Bindings, 1 - MessagesJournal */
- private byte journalID;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationDeleteMessage()
- {
- super(PacketImpl.REPLICATION_DELETE);
- }
-
- public ReplicationDeleteMessage(final byte journalID, final long id)
- {
- this();
- this.journalID = journalID;
- this.id = id;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeByte(journalID);
- buffer.writeLong(id);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- journalID = buffer.readByte();
- id = buffer.readLong();
- }
-
- /**
- * @return the id
- */
- public long getId()
- {
- return id;
- }
-
- /**
- * @return the journalID
- */
- public byte getJournalID()
- {
- return journalID;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,94 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationAddMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationDeleteMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long id;
+
+ /** 0 - Bindings, 1 - MessagesJournal */
+ private byte journalID;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationDeleteMessage()
+ {
+ super(PacketImpl.REPLICATION_DELETE);
+ }
+
+ public ReplicationDeleteMessage(final byte journalID, final long id)
+ {
+ this();
+ this.journalID = journalID;
+ this.id = id;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeByte(journalID);
+ buffer.writeLong(id);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ journalID = buffer.readByte();
+ id = buffer.readLong();
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId()
+ {
+ return id;
+ }
+
+ /**
+ * @return the journalID
+ */
+ public byte getJournalID()
+ {
+ return journalID;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,126 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationAddMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationDeleteTXMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long txId;
-
- private long id;
-
- /** 0 - Bindings, 1 - MessagesJournal */
- private byte journalID;
-
- private EncodingSupport encodingData;
-
- private byte[] recordData;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationDeleteTXMessage()
- {
- super(PacketImpl.REPLICATION_DELETE_TX);
- }
-
- public ReplicationDeleteTXMessage(final byte journalID,
- final long txId,
- final long id,
- final EncodingSupport encodingData)
- {
- this();
- this.journalID = journalID;
- this.txId = txId;
- this.id = id;
- this.encodingData = encodingData;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeByte(journalID);
- buffer.writeLong(txId);
- buffer.writeLong(id);
- buffer.writeInt(encodingData.getEncodeSize());
- encodingData.encode(buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- journalID = buffer.readByte();
- txId = buffer.readLong();
- id = buffer.readLong();
- int size = buffer.readInt();
- recordData = new byte[size];
- buffer.readBytes(recordData);
- }
-
- /**
- * @return the id
- */
- public long getId()
- {
- return id;
- }
-
- public long getTxId()
- {
- return txId;
- }
-
- /**
- * @return the journalID
- */
- public byte getJournalID()
- {
- return journalID;
- }
-
- /**
- * @return the recordData
- */
- public byte[] getRecordData()
- {
- return recordData;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,126 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.journal.EncodingSupport;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationAddMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationDeleteTXMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long txId;
+
+ private long id;
+
+ /** 0 - Bindings, 1 - MessagesJournal */
+ private byte journalID;
+
+ private EncodingSupport encodingData;
+
+ private byte[] recordData;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationDeleteTXMessage()
+ {
+ super(PacketImpl.REPLICATION_DELETE_TX);
+ }
+
+ public ReplicationDeleteTXMessage(final byte journalID,
+ final long txId,
+ final long id,
+ final EncodingSupport encodingData)
+ {
+ this();
+ this.journalID = journalID;
+ this.txId = txId;
+ this.id = id;
+ this.encodingData = encodingData;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeByte(journalID);
+ buffer.writeLong(txId);
+ buffer.writeLong(id);
+ buffer.writeInt(encodingData.getEncodeSize());
+ encodingData.encode(buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ journalID = buffer.readByte();
+ txId = buffer.readLong();
+ id = buffer.readLong();
+ int size = buffer.readInt();
+ recordData = new byte[size];
+ buffer.readBytes(recordData);
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId()
+ {
+ return id;
+ }
+
+ public long getTxId()
+ {
+ return txId;
+ }
+
+ /**
+ * @return the journalID
+ */
+ public byte getJournalID()
+ {
+ return journalID;
+ }
+
+ /**
+ * @return the recordData
+ */
+ public byte[] getRecordData()
+ {
+ return recordData;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,80 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationLargeMessageBeingMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationLargeMessageBeingMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- long messageId;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationLargeMessageBeingMessage(final long messageId)
- {
- this();
- this.messageId = messageId;
- }
-
- public ReplicationLargeMessageBeingMessage()
- {
- super(PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(messageId);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- messageId = buffer.readLong();
- }
-
- /**
- * @return the messageId
- */
- public long getMessageId()
- {
- return messageId;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,80 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationLargeMessageBeingMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationLargeMessageBeingMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ long messageId;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationLargeMessageBeingMessage(final long messageId)
+ {
+ this();
+ this.messageId = messageId;
+ }
+
+ public ReplicationLargeMessageBeingMessage()
+ {
+ super(PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(messageId);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ messageId = buffer.readLong();
+ }
+
+ /**
+ * @return the messageId
+ */
+ public long getMessageId()
+ {
+ return messageId;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,100 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationLargeMessageWriteMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationLargeMessageWriteMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long messageId;
-
- private byte body[];
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
- public ReplicationLargeMessageWriteMessage()
- {
- super(PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE);
- }
-
- /**
- * @param messageId
- * @param body
- */
- public ReplicationLargeMessageWriteMessage(final long messageId, final byte[] body)
- {
- this();
-
- this.messageId = messageId;
- this.body = body;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(messageId);
- buffer.writeInt(body.length);
- buffer.writeBytes(body);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- messageId = buffer.readLong();
- int size = buffer.readInt();
- body = new byte[size];
- buffer.readBytes(body);
- }
-
- /**
- * @return the messageId
- */
- public long getMessageId()
- {
- return messageId;
- }
-
- /**
- * @return the body
- */
- public byte[] getBody()
- {
- return body;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,100 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationLargeMessageWriteMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationLargeMessageWriteMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long messageId;
+
+ private byte body[];
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+ public ReplicationLargeMessageWriteMessage()
+ {
+ super(PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE);
+ }
+
+ /**
+ * @param messageId
+ * @param body
+ */
+ public ReplicationLargeMessageWriteMessage(final long messageId, final byte[] body)
+ {
+ this();
+
+ this.messageId = messageId;
+ this.body = body;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(messageId);
+ buffer.writeInt(body.length);
+ buffer.writeBytes(body);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ messageId = buffer.readLong();
+ int size = buffer.readInt();
+ body = new byte[size];
+ buffer.readBytes(body);
+ }
+
+ /**
+ * @return the messageId
+ */
+ public long getMessageId()
+ {
+ return messageId;
+ }
+
+ /**
+ * @return the body
+ */
+ public byte[] getBody()
+ {
+ return body;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,79 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationLargemessageEndMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationLargemessageEndMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- long messageId;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationLargemessageEndMessage()
- {
- super(PacketImpl.REPLICATION_LARGE_MESSAGE_END);
- }
-
- public ReplicationLargemessageEndMessage(final long messageId)
- {
- this();
- this.messageId = messageId;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(messageId);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- messageId = buffer.readLong();
- }
-
- /**
- * @return the messageId
- */
- public long getMessageId()
- {
- return messageId;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,79 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationLargemessageEndMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationLargemessageEndMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ long messageId;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationLargemessageEndMessage()
+ {
+ super(PacketImpl.REPLICATION_LARGE_MESSAGE_END);
+ }
+
+ public ReplicationLargemessageEndMessage(final long messageId)
+ {
+ this();
+ this.messageId = messageId;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(messageId);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ messageId = buffer.readLong();
+ }
+
+ /**
+ * @return the messageId
+ */
+ public long getMessageId()
+ {
+ return messageId;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,110 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationPageWrite
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationPageEventMessage extends PacketImpl
-{
-
- private int pageNumber;
-
- private SimpleString storeName;
-
- /**
- * True = delete page, False = close page
- */
- private boolean isDelete;
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationPageEventMessage()
- {
- super(PacketImpl.REPLICATION_PAGE_EVENT);
- }
-
- public ReplicationPageEventMessage(final SimpleString storeName, final int pageNumber, final boolean isDelete)
- {
- this();
- this.pageNumber = pageNumber;
- this.isDelete = isDelete;
- this.storeName = storeName;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeSimpleString(storeName);
- buffer.writeInt(pageNumber);
- buffer.writeBoolean(isDelete);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- storeName = buffer.readSimpleString();
- pageNumber = buffer.readInt();
- isDelete = buffer.readBoolean();
- }
-
- /**
- * @return the pageNumber
- */
- public int getPageNumber()
- {
- return pageNumber;
- }
-
- /**
- * @return the storeName
- */
- public SimpleString getStoreName()
- {
- return storeName;
- }
-
- /**
- * @return the isDelete
- */
- public boolean isDelete()
- {
- return isDelete;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,110 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationPageWrite
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationPageEventMessage extends PacketImpl
+{
+
+ private int pageNumber;
+
+ private SimpleString storeName;
+
+ /**
+ * True = delete page, False = close page
+ */
+ private boolean isDelete;
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationPageEventMessage()
+ {
+ super(PacketImpl.REPLICATION_PAGE_EVENT);
+ }
+
+ public ReplicationPageEventMessage(final SimpleString storeName, final int pageNumber, final boolean isDelete)
+ {
+ this();
+ this.pageNumber = pageNumber;
+ this.isDelete = isDelete;
+ this.storeName = storeName;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeSimpleString(storeName);
+ buffer.writeInt(pageNumber);
+ buffer.writeBoolean(isDelete);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ storeName = buffer.readSimpleString();
+ pageNumber = buffer.readInt();
+ isDelete = buffer.readBoolean();
+ }
+
+ /**
+ * @return the pageNumber
+ */
+ public int getPageNumber()
+ {
+ return pageNumber;
+ }
+
+ /**
+ * @return the storeName
+ */
+ public SimpleString getStoreName()
+ {
+ return storeName;
+ }
+
+ /**
+ * @return the isDelete
+ */
+ public boolean isDelete()
+ {
+ return isDelete;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,96 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.paging.PagedMessage;
-import org.hornetq.core.paging.impl.PagedMessageImpl;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationPageWrite
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationPageWriteMessage extends PacketImpl
-{
-
- int pageNumber;
-
- PagedMessage pagedMessage;
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationPageWriteMessage()
- {
- super(PacketImpl.REPLICATION_PAGE_WRITE);
- }
-
- public ReplicationPageWriteMessage(final PagedMessage pagedMessage, final int pageNumber)
- {
- this();
- this.pageNumber = pageNumber;
- this.pagedMessage = pagedMessage;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(pageNumber);
- pagedMessage.encode(buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- pageNumber = buffer.readInt();
- pagedMessage = new PagedMessageImpl();
- pagedMessage.decode(buffer);
- }
-
- /**
- * @return the pageNumber
- */
- public int getPageNumber()
- {
- return pageNumber;
- }
-
- /**
- * @return the pagedMessage
- */
- public PagedMessage getPagedMessage()
- {
- return pagedMessage;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,96 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.paging.PagedMessage;
+import org.hornetq.core.paging.impl.PagedMessageImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationPageWrite
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationPageWriteMessage extends PacketImpl
+{
+
+ int pageNumber;
+
+ PagedMessage pagedMessage;
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationPageWriteMessage()
+ {
+ super(PacketImpl.REPLICATION_PAGE_WRITE);
+ }
+
+ public ReplicationPageWriteMessage(final PagedMessage pagedMessage, final int pageNumber)
+ {
+ this();
+ this.pageNumber = pageNumber;
+ this.pagedMessage = pagedMessage;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(pageNumber);
+ pagedMessage.encode(buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ pageNumber = buffer.readInt();
+ pagedMessage = new PagedMessageImpl();
+ pagedMessage.decode(buffer);
+ }
+
+ /**
+ * @return the pageNumber
+ */
+ public int getPageNumber()
+ {
+ return pageNumber;
+ }
+
+ /**
+ * @return the pagedMessage
+ */
+ public PagedMessage getPagedMessage()
+ {
+ return pagedMessage;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,110 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A ReplicationAddMessage
- *
- * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- *
- */
-public class ReplicationPrepareMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long txId;
-
- /** 0 - Bindings, 1 - MessagesJournal */
- private byte journalID;
-
- private EncodingSupport encodingData;
-
- private byte[] recordData;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationPrepareMessage()
- {
- super(PacketImpl.REPLICATION_PREPARE);
- }
-
- public ReplicationPrepareMessage(final byte journalID, final long txId, final EncodingSupport encodingData)
- {
- this();
- this.journalID = journalID;
- this.txId = txId;
- this.encodingData = encodingData;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeByte(journalID);
- buffer.writeLong(txId);
- buffer.writeInt(encodingData.getEncodeSize());
- encodingData.encode(buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- journalID = buffer.readByte();
- txId = buffer.readLong();
- int size = buffer.readInt();
- recordData = new byte[size];
- buffer.readBytes(recordData);
- }
-
- public long getTxId()
- {
- return txId;
- }
-
- /**
- * @return the journalID
- */
- public byte getJournalID()
- {
- return journalID;
- }
-
- /**
- * @return the recordData
- */
- public byte[] getRecordData()
- {
- return recordData;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,110 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.journal.EncodingSupport;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A ReplicationAddMessage
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicationPrepareMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long txId;
+
+ /** 0 - Bindings, 1 - MessagesJournal */
+ private byte journalID;
+
+ private EncodingSupport encodingData;
+
+ private byte[] recordData;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationPrepareMessage()
+ {
+ super(PacketImpl.REPLICATION_PREPARE);
+ }
+
+ public ReplicationPrepareMessage(final byte journalID, final long txId, final EncodingSupport encodingData)
+ {
+ this();
+ this.journalID = journalID;
+ this.txId = txId;
+ this.encodingData = encodingData;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeByte(journalID);
+ buffer.writeLong(txId);
+ buffer.writeInt(encodingData.getEncodeSize());
+ encodingData.encode(buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ journalID = buffer.readByte();
+ txId = buffer.readLong();
+ int size = buffer.readInt();
+ recordData = new byte[size];
+ buffer.readBytes(recordData);
+ }
+
+ public long getTxId()
+ {
+ return txId;
+ }
+
+ /**
+ * @return the journalID
+ */
+ public byte getJournalID()
+ {
+ return journalID;
+ }
+
+ /**
+ * @return the recordData
+ */
+ public byte[] getRecordData()
+ {
+ return recordData;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -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.protocol.core.impl.wireformat;
-
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- */
-public class ReplicationResponseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationResponseMessage()
- {
- super(PacketImpl.REPLICATION_RESPONSE);
- }
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,46 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class ReplicationResponseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationResponseMessage()
+ {
+ super(PacketImpl.REPLICATION_RESPONSE);
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,96 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A RollbackMessage
- *
- * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- * Created Feb 18, 2009 2:11:17 PM
- *
- *
- */
-public class RollbackMessage extends PacketImpl
-{
-
- public RollbackMessage()
- {
- super(PacketImpl.SESS_ROLLBACK);
- }
-
- public RollbackMessage(final boolean considerLastMessageAsDelivered)
- {
- super(PacketImpl.SESS_ROLLBACK);
-
- this.considerLastMessageAsDelivered = considerLastMessageAsDelivered;
- }
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private boolean considerLastMessageAsDelivered;
-
- /**
- * @return the considerLastMessageAsDelivered
- */
- public boolean isConsiderLastMessageAsDelivered()
- {
- return considerLastMessageAsDelivered;
- }
-
- /**
- * @param isLastMessageAsDelivered the considerLastMessageAsDelivered to set
- */
- public void setConsiderLastMessageAsDelivered(final boolean isLastMessageAsDelivered)
- {
- considerLastMessageAsDelivered = isLastMessageAsDelivered;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeBoolean(considerLastMessageAsDelivered);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- considerLastMessageAsDelivered = buffer.readBoolean();
- }
-
- public boolean isAsyncExec()
- {
- return true;
- }
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,96 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A RollbackMessage
+ *
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ * Created Feb 18, 2009 2:11:17 PM
+ *
+ *
+ */
+public class RollbackMessage extends PacketImpl
+{
+
+ public RollbackMessage()
+ {
+ super(PacketImpl.SESS_ROLLBACK);
+ }
+
+ public RollbackMessage(final boolean considerLastMessageAsDelivered)
+ {
+ super(PacketImpl.SESS_ROLLBACK);
+
+ this.considerLastMessageAsDelivered = considerLastMessageAsDelivered;
+ }
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private boolean considerLastMessageAsDelivered;
+
+ /**
+ * @return the considerLastMessageAsDelivered
+ */
+ public boolean isConsiderLastMessageAsDelivered()
+ {
+ return considerLastMessageAsDelivered;
+ }
+
+ /**
+ * @param isLastMessageAsDelivered the considerLastMessageAsDelivered to set
+ */
+ public void setConsiderLastMessageAsDelivered(final boolean isLastMessageAsDelivered)
+ {
+ considerLastMessageAsDelivered = isLastMessageAsDelivered;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeBoolean(considerLastMessageAsDelivered);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ considerLastMessageAsDelivered = buffer.readBoolean();
+ }
+
+ public boolean isAsyncExec()
+ {
+ return true;
+ }
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,113 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- */
-public class SessionAcknowledgeMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long consumerID;
-
- private long messageID;
-
- private boolean requiresResponse;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionAcknowledgeMessage(final long consumerID, final long messageID, final boolean requiresResponse)
- {
- super(PacketImpl.SESS_ACKNOWLEDGE);
-
- this.consumerID = consumerID;
-
- this.messageID = messageID;
-
- this.requiresResponse = requiresResponse;
- }
-
- public SessionAcknowledgeMessage()
- {
- super(PacketImpl.SESS_ACKNOWLEDGE);
- }
-
- // Public --------------------------------------------------------
-
- public long getConsumerID()
- {
- return consumerID;
- }
-
- public long getMessageID()
- {
- return messageID;
- }
-
- public boolean isRequiresResponse()
- {
- return requiresResponse;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(consumerID);
-
- buffer.writeLong(messageID);
-
- buffer.writeBoolean(requiresResponse);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- consumerID = buffer.readLong();
-
- messageID = buffer.readLong();
-
- requiresResponse = buffer.readBoolean();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionAcknowledgeMessage == false)
- {
- return false;
- }
-
- SessionAcknowledgeMessage r = (SessionAcknowledgeMessage)other;
-
- return super.equals(other) && consumerID == r.consumerID &&
- messageID == r.messageID &&
- requiresResponse == r.requiresResponse;
- }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,113 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionAcknowledgeMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long consumerID;
+
+ private long messageID;
+
+ private boolean requiresResponse;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionAcknowledgeMessage(final long consumerID, final long messageID, final boolean requiresResponse)
+ {
+ super(PacketImpl.SESS_ACKNOWLEDGE);
+
+ this.consumerID = consumerID;
+
+ this.messageID = messageID;
+
+ this.requiresResponse = requiresResponse;
+ }
+
+ public SessionAcknowledgeMessage()
+ {
+ super(PacketImpl.SESS_ACKNOWLEDGE);
+ }
+
+ // Public --------------------------------------------------------
+
+ public long getConsumerID()
+ {
+ return consumerID;
+ }
+
+ public long getMessageID()
+ {
+ return messageID;
+ }
+
+ public boolean isRequiresResponse()
+ {
+ return requiresResponse;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(consumerID);
+
+ buffer.writeLong(messageID);
+
+ buffer.writeBoolean(requiresResponse);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ consumerID = buffer.readLong();
+
+ messageID = buffer.readLong();
+
+ requiresResponse = buffer.readBoolean();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionAcknowledgeMessage == false)
+ {
+ return false;
+ }
+
+ SessionAcknowledgeMessage r = (SessionAcknowledgeMessage)other;
+
+ return super.equals(other) && consumerID == r.consumerID &&
+ messageID == r.messageID &&
+ requiresResponse == r.requiresResponse;
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,73 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- *
- * A SessionQueueQueryMessage
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class SessionBindingQueryMessage extends PacketImpl
-{
- private SimpleString address;
-
- public SessionBindingQueryMessage(final SimpleString address)
- {
- super(PacketImpl.SESS_BINDINGQUERY);
-
- this.address = address;
- }
-
- public SessionBindingQueryMessage()
- {
- super(PacketImpl.SESS_BINDINGQUERY);
- }
-
- public SimpleString getAddress()
- {
- return address;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeSimpleString(address);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- address = buffer.readSimpleString();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionBindingQueryMessage == false)
- {
- return false;
- }
-
- SessionBindingQueryMessage r = (SessionBindingQueryMessage)other;
-
- return super.equals(other) && address.equals(r.address);
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,73 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ *
+ * A SessionQueueQueryMessage
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionBindingQueryMessage extends PacketImpl
+{
+ private SimpleString address;
+
+ public SessionBindingQueryMessage(final SimpleString address)
+ {
+ super(PacketImpl.SESS_BINDINGQUERY);
+
+ this.address = address;
+ }
+
+ public SessionBindingQueryMessage()
+ {
+ super(PacketImpl.SESS_BINDINGQUERY);
+ }
+
+ public SimpleString getAddress()
+ {
+ return address;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeSimpleString(address);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ address = buffer.readSimpleString();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionBindingQueryMessage == false)
+ {
+ return false;
+ }
+
+ SessionBindingQueryMessage r = (SessionBindingQueryMessage)other;
+
+ return super.equals(other) && address.equals(r.address);
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,124 +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.protocol.core.impl.wireformat;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- *
- * A SessionBindingQueryResponseMessage
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class SessionBindingQueryResponseMessage extends PacketImpl
-{
- private boolean exists;
-
- private List<SimpleString> queueNames;
-
- public SessionBindingQueryResponseMessage(final boolean exists, final List<SimpleString> queueNames)
- {
- super(PacketImpl.SESS_BINDINGQUERY_RESP);
-
- this.exists = exists;
-
- this.queueNames = queueNames;
- }
-
- public SessionBindingQueryResponseMessage()
- {
- super(PacketImpl.SESS_BINDINGQUERY_RESP);
- }
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- public boolean isExists()
- {
- return exists;
- }
-
- public List<SimpleString> getQueueNames()
- {
- return queueNames;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeBoolean(exists);
- buffer.writeInt(queueNames.size());
- for (SimpleString queueName : queueNames)
- {
- buffer.writeSimpleString(queueName);
- }
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- exists = buffer.readBoolean();
- int numQueues = buffer.readInt();
- queueNames = new ArrayList<SimpleString>(numQueues);
- for (int i = 0; i < numQueues; i++)
- {
- queueNames.add(buffer.readSimpleString());
- }
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionBindingQueryResponseMessage == false)
- {
- return false;
- }
-
- SessionBindingQueryResponseMessage r = (SessionBindingQueryResponseMessage)other;
-
- if (super.equals(other) && exists == r.exists)
- {
- if (queueNames.size() == r.queueNames.size())
- {
- for (int i = 0; i < queueNames.size(); i++)
- {
- if (!queueNames.get(i).equals(r.queueNames.get(i)))
- {
- return false;
- }
- }
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
-
- return true;
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,124 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ *
+ * A SessionBindingQueryResponseMessage
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionBindingQueryResponseMessage extends PacketImpl
+{
+ private boolean exists;
+
+ private List<SimpleString> queueNames;
+
+ public SessionBindingQueryResponseMessage(final boolean exists, final List<SimpleString> queueNames)
+ {
+ super(PacketImpl.SESS_BINDINGQUERY_RESP);
+
+ this.exists = exists;
+
+ this.queueNames = queueNames;
+ }
+
+ public SessionBindingQueryResponseMessage()
+ {
+ super(PacketImpl.SESS_BINDINGQUERY_RESP);
+ }
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ public boolean isExists()
+ {
+ return exists;
+ }
+
+ public List<SimpleString> getQueueNames()
+ {
+ return queueNames;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeBoolean(exists);
+ buffer.writeInt(queueNames.size());
+ for (SimpleString queueName : queueNames)
+ {
+ buffer.writeSimpleString(queueName);
+ }
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ exists = buffer.readBoolean();
+ int numQueues = buffer.readInt();
+ queueNames = new ArrayList<SimpleString>(numQueues);
+ for (int i = 0; i < numQueues; i++)
+ {
+ queueNames.add(buffer.readSimpleString());
+ }
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionBindingQueryResponseMessage == false)
+ {
+ return false;
+ }
+
+ SessionBindingQueryResponseMessage r = (SessionBindingQueryResponseMessage)other;
+
+ if (super.equals(other) && exists == r.exists)
+ {
+ if (queueNames.size() == r.queueNames.size())
+ {
+ for (int i = 0; i < queueNames.size(); i++)
+ {
+ if (!queueNames.get(i).equals(r.queueNames.get(i)))
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,63 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- */
-public class SessionCloseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionCloseMessage()
- {
- super(PacketImpl.SESS_CLOSE);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionCloseMessage == false)
- {
- return false;
- }
-
- return super.equals(other);
- }
-
- @Override
- public boolean isAsyncExec()
- {
- return true;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,63 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionCloseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionCloseMessage()
+ {
+ super(PacketImpl.SESS_CLOSE);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionCloseMessage == false)
+ {
+ return false;
+ }
+
+ return super.equals(other);
+ }
+
+ @Override
+ public boolean isAsyncExec()
+ {
+ return true;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,59 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A SessionCommitMessage
- *
- * @author tim
- *
- *
- */
-public class SessionCommitMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- /**
- * @param type
- */
- public SessionCommitMessage()
- {
- super(PacketImpl.SESS_COMMIT);
- }
-
- public boolean isAsyncExec()
- {
- return true;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,59 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A SessionCommitMessage
+ *
+ * @author tim
+ *
+ *
+ */
+public class SessionCommitMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ /**
+ * @param type
+ */
+ public SessionCommitMessage()
+ {
+ super(PacketImpl.SESS_COMMIT);
+ }
+
+ public boolean isAsyncExec()
+ {
+ return true;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,92 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionConsumerCloseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long consumerID;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionConsumerCloseMessage(final long objectID)
- {
- super(PacketImpl.SESS_CONSUMER_CLOSE);
-
- consumerID = objectID;
- }
-
- public SessionConsumerCloseMessage()
- {
- super(PacketImpl.SESS_CONSUMER_CLOSE);
- }
-
- // Public --------------------------------------------------------
-
- public long getConsumerID()
- {
- return consumerID;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(consumerID);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- consumerID = buffer.readLong();
- }
-
- @Override
- public String toString()
- {
- return getParentString() + ", consumerID=" + consumerID + "]";
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionConsumerCloseMessage == false)
- {
- return false;
- }
-
- SessionConsumerCloseMessage r = (SessionConsumerCloseMessage)other;
-
- return super.equals(other) && consumerID == r.consumerID;
- }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,92 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionConsumerCloseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long consumerID;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionConsumerCloseMessage(final long objectID)
+ {
+ super(PacketImpl.SESS_CONSUMER_CLOSE);
+
+ consumerID = objectID;
+ }
+
+ public SessionConsumerCloseMessage()
+ {
+ super(PacketImpl.SESS_CONSUMER_CLOSE);
+ }
+
+ // Public --------------------------------------------------------
+
+ public long getConsumerID()
+ {
+ return consumerID;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(consumerID);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ consumerID = buffer.readLong();
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + ", consumerID=" + consumerID + "]";
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionConsumerCloseMessage == false)
+ {
+ return false;
+ }
+
+ SessionConsumerCloseMessage r = (SessionConsumerCloseMessage)other;
+
+ return super.equals(other) && consumerID == r.consumerID;
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,104 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>.
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionConsumerFlowCreditMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long consumerID;
-
- private int credits;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionConsumerFlowCreditMessage(final long consumerID, final int credits)
- {
- super(PacketImpl.SESS_FLOWTOKEN);
-
- this.consumerID = consumerID;
-
- this.credits = credits;
- }
-
- public SessionConsumerFlowCreditMessage()
- {
- super(PacketImpl.SESS_FLOWTOKEN);
- }
-
- // Public --------------------------------------------------------
-
- public long getConsumerID()
- {
- return consumerID;
- }
-
- public int getCredits()
- {
- return credits;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(consumerID);
- buffer.writeInt(credits);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- consumerID = buffer.readLong();
- credits = buffer.readInt();
- }
-
- @Override
- public String toString()
- {
- return getParentString() + ", consumerID=" + consumerID + ", credits=" + credits + "]";
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionConsumerFlowCreditMessage == false)
- {
- return false;
- }
-
- SessionConsumerFlowCreditMessage r = (SessionConsumerFlowCreditMessage)other;
-
- return super.equals(other) && credits == r.credits && consumerID == r.consumerID;
- }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,104 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>.
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionConsumerFlowCreditMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long consumerID;
+
+ private int credits;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionConsumerFlowCreditMessage(final long consumerID, final int credits)
+ {
+ super(PacketImpl.SESS_FLOWTOKEN);
+
+ this.consumerID = consumerID;
+
+ this.credits = credits;
+ }
+
+ public SessionConsumerFlowCreditMessage()
+ {
+ super(PacketImpl.SESS_FLOWTOKEN);
+ }
+
+ // Public --------------------------------------------------------
+
+ public long getConsumerID()
+ {
+ return consumerID;
+ }
+
+ public int getCredits()
+ {
+ return credits;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(consumerID);
+ buffer.writeInt(credits);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ consumerID = buffer.readLong();
+ credits = buffer.readInt();
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + ", consumerID=" + consumerID + ", credits=" + credits + "]";
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionConsumerFlowCreditMessage == false)
+ {
+ return false;
+ }
+
+ SessionConsumerFlowCreditMessage r = (SessionConsumerFlowCreditMessage)other;
+
+ return super.equals(other) && credits == r.credits && consumerID == r.consumerID;
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,102 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.DataConstants;
-
-/**
- * A SessionContinuationMessage
- *
- * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- * Created Dec 5, 2008 10:08:40 AM
- *
- *
- */
-public abstract class SessionContinuationMessage extends PacketImpl
-{
-
- // Constants -----------------------------------------------------
-
- public static final int SESSION_CONTINUATION_BASE_SIZE = PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT +
- DataConstants.SIZE_BOOLEAN;
-
- // Attributes ----------------------------------------------------
-
- protected byte[] body;
-
- protected boolean continues;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionContinuationMessage(final byte type, final byte[] body, final boolean continues)
- {
- super(type);
- this.body = body;
- this.continues = continues;
- }
-
- public SessionContinuationMessage(final byte type)
- {
- super(type);
- }
-
- // Public --------------------------------------------------------
-
- /**
- * @return the body
- */
- public byte[] getBody()
- {
- return body;
- }
-
- /**
- * @return the continues
- */
- public boolean isContinues()
- {
- return continues;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(body.length);
- buffer.writeBytes(body);
- buffer.writeBoolean(continues);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- int size = buffer.readInt();
- body = new byte[size];
- buffer.readBytes(body);
- continues = buffer.readBoolean();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,102 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * A SessionContinuationMessage
+ *
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ * Created Dec 5, 2008 10:08:40 AM
+ *
+ *
+ */
+public abstract class SessionContinuationMessage extends PacketImpl
+{
+
+ // Constants -----------------------------------------------------
+
+ public static final int SESSION_CONTINUATION_BASE_SIZE = PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT +
+ DataConstants.SIZE_BOOLEAN;
+
+ // Attributes ----------------------------------------------------
+
+ protected byte[] body;
+
+ protected boolean continues;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionContinuationMessage(final byte type, final byte[] body, final boolean continues)
+ {
+ super(type);
+ this.body = body;
+ this.continues = continues;
+ }
+
+ public SessionContinuationMessage(final byte type)
+ {
+ super(type);
+ }
+
+ // Public --------------------------------------------------------
+
+ /**
+ * @return the body
+ */
+ public byte[] getBody()
+ {
+ return body;
+ }
+
+ /**
+ * @return the continues
+ */
+ public boolean isContinues()
+ {
+ return continues;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(body.length);
+ buffer.writeBytes(body);
+ buffer.writeBoolean(continues);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ int size = buffer.readInt();
+ body = new byte[size];
+ buffer.readBytes(body);
+ continues = buffer.readBoolean();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,143 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionCreateConsumerMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long id;
-
- private SimpleString queueName;
-
- private SimpleString filterString;
-
- private boolean browseOnly;
-
- private boolean requiresResponse;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionCreateConsumerMessage(final long id,
- final SimpleString queueName,
- final SimpleString filterString,
- final boolean browseOnly,
- final boolean requiresResponse)
- {
- super(PacketImpl.SESS_CREATECONSUMER);
-
- this.id = id;
- this.queueName = queueName;
- this.filterString = filterString;
- this.browseOnly = browseOnly;
- this.requiresResponse = requiresResponse;
- }
-
- public SessionCreateConsumerMessage()
- {
- super(PacketImpl.SESS_CREATECONSUMER);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public String toString()
- {
- StringBuffer buff = new StringBuffer(getParentString());
- buff.append(", queueName=" + queueName);
- buff.append(", filterString=" + filterString);
- buff.append("]");
- return buff.toString();
- }
-
- public long getID()
- {
- return id;
- }
-
- public SimpleString getQueueName()
- {
- return queueName;
- }
-
- public SimpleString getFilterString()
- {
- return filterString;
- }
-
- public boolean isBrowseOnly()
- {
- return browseOnly;
- }
-
- public boolean isRequiresResponse()
- {
- return requiresResponse;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(id);
- buffer.writeSimpleString(queueName);
- buffer.writeNullableSimpleString(filterString);
- buffer.writeBoolean(browseOnly);
- buffer.writeBoolean(requiresResponse);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- id = buffer.readLong();
- queueName = buffer.readSimpleString();
- filterString = buffer.readNullableSimpleString();
- browseOnly = buffer.readBoolean();
- requiresResponse = buffer.readBoolean();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionCreateConsumerMessage == false)
- {
- return false;
- }
-
- SessionCreateConsumerMessage r = (SessionCreateConsumerMessage)other;
-
- return super.equals(other) && queueName.equals(r.queueName) && filterString == null ? r.filterString == null
- : filterString.equals(r.filterString);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,143 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionCreateConsumerMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long id;
+
+ private SimpleString queueName;
+
+ private SimpleString filterString;
+
+ private boolean browseOnly;
+
+ private boolean requiresResponse;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionCreateConsumerMessage(final long id,
+ final SimpleString queueName,
+ final SimpleString filterString,
+ final boolean browseOnly,
+ final boolean requiresResponse)
+ {
+ super(PacketImpl.SESS_CREATECONSUMER);
+
+ this.id = id;
+ this.queueName = queueName;
+ this.filterString = filterString;
+ this.browseOnly = browseOnly;
+ this.requiresResponse = requiresResponse;
+ }
+
+ public SessionCreateConsumerMessage()
+ {
+ super(PacketImpl.SESS_CREATECONSUMER);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buff = new StringBuffer(getParentString());
+ buff.append(", queueName=" + queueName);
+ buff.append(", filterString=" + filterString);
+ buff.append("]");
+ return buff.toString();
+ }
+
+ public long getID()
+ {
+ return id;
+ }
+
+ public SimpleString getQueueName()
+ {
+ return queueName;
+ }
+
+ public SimpleString getFilterString()
+ {
+ return filterString;
+ }
+
+ public boolean isBrowseOnly()
+ {
+ return browseOnly;
+ }
+
+ public boolean isRequiresResponse()
+ {
+ return requiresResponse;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(id);
+ buffer.writeSimpleString(queueName);
+ buffer.writeNullableSimpleString(filterString);
+ buffer.writeBoolean(browseOnly);
+ buffer.writeBoolean(requiresResponse);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ id = buffer.readLong();
+ queueName = buffer.readSimpleString();
+ filterString = buffer.readNullableSimpleString();
+ browseOnly = buffer.readBoolean();
+ requiresResponse = buffer.readBoolean();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionCreateConsumerMessage == false)
+ {
+ return false;
+ }
+
+ SessionCreateConsumerMessage r = (SessionCreateConsumerMessage)other;
+
+ return super.equals(other) && queueName.equals(r.queueName) && filterString == null ? r.filterString == null
+ : filterString.equals(r.filterString);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,97 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
-
- * @version <tt>$Revision$</tt>
- */
-public class SessionDeleteQueueMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private SimpleString queueName;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionDeleteQueueMessage(final SimpleString queueName)
- {
- super(PacketImpl.DELETE_QUEUE);
-
- this.queueName = queueName;
- }
-
- public SessionDeleteQueueMessage()
- {
- super(PacketImpl.DELETE_QUEUE);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public String toString()
- {
- StringBuffer buff = new StringBuffer(getParentString());
- buff.append(", queueName=" + queueName);
- buff.append("]");
- return buff.toString();
- }
-
- public SimpleString getQueueName()
- {
- return queueName;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeSimpleString(queueName);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- queueName = buffer.readSimpleString();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionDeleteQueueMessage == false)
- {
- return false;
- }
-
- SessionDeleteQueueMessage r = (SessionDeleteQueueMessage)other;
-
- return super.equals(other) && r.queueName.equals(queueName);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,97 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionDeleteQueueMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private SimpleString queueName;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionDeleteQueueMessage(final SimpleString queueName)
+ {
+ super(PacketImpl.DELETE_QUEUE);
+
+ this.queueName = queueName;
+ }
+
+ public SessionDeleteQueueMessage()
+ {
+ super(PacketImpl.DELETE_QUEUE);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buff = new StringBuffer(getParentString());
+ buff.append(", queueName=" + queueName);
+ buff.append("]");
+ return buff.toString();
+ }
+
+ public SimpleString getQueueName()
+ {
+ return queueName;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeSimpleString(queueName);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ queueName = buffer.readSimpleString();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionDeleteQueueMessage == false)
+ {
+ return false;
+ }
+
+ SessionDeleteQueueMessage r = (SessionDeleteQueueMessage)other;
+
+ return super.equals(other) && r.queueName.equals(queueName);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,98 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- */
-public class SessionExpiredMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long consumerID;
-
- private long messageID;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionExpiredMessage(final long consumerID, final long messageID)
- {
- super(PacketImpl.SESS_EXPIRED);
-
- this.consumerID = consumerID;
-
- this.messageID = messageID;
- }
-
- public SessionExpiredMessage()
- {
- super(PacketImpl.SESS_EXPIRED);
- }
-
- // Public --------------------------------------------------------
-
- public long getConsumerID()
- {
- return consumerID;
- }
-
- public long getMessageID()
- {
- return messageID;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(consumerID);
-
- buffer.writeLong(messageID);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- consumerID = buffer.readLong();
-
- messageID = buffer.readLong();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionExpiredMessage == false)
- {
- return false;
- }
-
- SessionExpiredMessage r = (SessionExpiredMessage)other;
-
- return super.equals(other) && consumerID == r.consumerID && messageID == r.messageID;
- }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,98 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionExpiredMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long consumerID;
+
+ private long messageID;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionExpiredMessage(final long consumerID, final long messageID)
+ {
+ super(PacketImpl.SESS_EXPIRED);
+
+ this.consumerID = consumerID;
+
+ this.messageID = messageID;
+ }
+
+ public SessionExpiredMessage()
+ {
+ super(PacketImpl.SESS_EXPIRED);
+ }
+
+ // Public --------------------------------------------------------
+
+ public long getConsumerID()
+ {
+ return consumerID;
+ }
+
+ public long getMessageID()
+ {
+ return messageID;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(consumerID);
+
+ buffer.writeLong(messageID);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ consumerID = buffer.readLong();
+
+ messageID = buffer.readLong();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionExpiredMessage == false)
+ {
+ return false;
+ }
+
+ SessionExpiredMessage r = (SessionExpiredMessage)other;
+
+ return super.equals(other) && consumerID == r.consumerID && messageID == r.messageID;
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,109 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- *
- * A SessionConsumerForceDelivery
- *
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
- */
-public class SessionForceConsumerDelivery extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private long consumerID;
-
- private long sequence;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionForceConsumerDelivery(final long consumerID, final long sequence)
- {
- super(PacketImpl.SESS_FORCE_CONSUMER_DELIVERY);
-
- this.consumerID = consumerID;
- this.sequence = sequence;
- }
-
- public SessionForceConsumerDelivery()
- {
- super(PacketImpl.SESS_FORCE_CONSUMER_DELIVERY);
- }
-
- // Public --------------------------------------------------------
-
- public long getConsumerID()
- {
- return consumerID;
- }
-
- public long getSequence()
- {
- return sequence;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(consumerID);
- buffer.writeLong(sequence);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- consumerID = buffer.readLong();
- sequence = buffer.readLong();
- }
-
- @Override
- public String toString()
- {
- StringBuffer buf = new StringBuffer(getParentString());
- buf.append(", consumerID=" + consumerID);
- buf.append(", sequence=" + sequence);
- buf.append("]");
- return buf.toString();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionForceConsumerDelivery == false)
- {
- return false;
- }
-
- SessionForceConsumerDelivery r = (SessionForceConsumerDelivery)other;
-
- return super.equals(other) && consumerID == r.consumerID && sequence == r.sequence;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,109 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ *
+ * A SessionConsumerForceDelivery
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class SessionForceConsumerDelivery extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long consumerID;
+
+ private long sequence;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionForceConsumerDelivery(final long consumerID, final long sequence)
+ {
+ super(PacketImpl.SESS_FORCE_CONSUMER_DELIVERY);
+
+ this.consumerID = consumerID;
+ this.sequence = sequence;
+ }
+
+ public SessionForceConsumerDelivery()
+ {
+ super(PacketImpl.SESS_FORCE_CONSUMER_DELIVERY);
+ }
+
+ // Public --------------------------------------------------------
+
+ public long getConsumerID()
+ {
+ return consumerID;
+ }
+
+ public long getSequence()
+ {
+ return sequence;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(consumerID);
+ buffer.writeLong(sequence);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ consumerID = buffer.readLong();
+ sequence = buffer.readLong();
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer(getParentString());
+ buf.append(", consumerID=" + consumerID);
+ buf.append(", sequence=" + sequence);
+ buf.append("]");
+ return buf.toString();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionForceConsumerDelivery == false)
+ {
+ return false;
+ }
+
+ SessionForceConsumerDelivery r = (SessionForceConsumerDelivery)other;
+
+ return super.equals(other) && consumerID == r.consumerID && sequence == r.sequence;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,96 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class SessionProducerCreditsMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private int credits;
-
- private SimpleString address;
-
- private int offset;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionProducerCreditsMessage(final int credits, final SimpleString address, final int offset)
- {
- super(PacketImpl.SESS_PRODUCER_CREDITS);
-
- this.credits = credits;
-
- this.address = address;
-
- this.offset = offset;
- }
-
- public SessionProducerCreditsMessage()
- {
- super(PacketImpl.SESS_PRODUCER_CREDITS);
- }
-
- // Public --------------------------------------------------------
-
- public int getCredits()
- {
- return credits;
- }
-
- public SimpleString getAddress()
- {
- return address;
- }
-
- public int getOffset()
- {
- return offset;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(credits);
- buffer.writeSimpleString(address);
- buffer.writeInt(offset);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- credits = buffer.readInt();
- address = buffer.readSimpleString();
- offset = buffer.readInt();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,96 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionProducerCreditsMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private int credits;
+
+ private SimpleString address;
+
+ private int offset;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionProducerCreditsMessage(final int credits, final SimpleString address, final int offset)
+ {
+ super(PacketImpl.SESS_PRODUCER_CREDITS);
+
+ this.credits = credits;
+
+ this.address = address;
+
+ this.offset = offset;
+ }
+
+ public SessionProducerCreditsMessage()
+ {
+ super(PacketImpl.SESS_PRODUCER_CREDITS);
+ }
+
+ // Public --------------------------------------------------------
+
+ public int getCredits()
+ {
+ return credits;
+ }
+
+ public SimpleString getAddress()
+ {
+ return address;
+ }
+
+ public int getOffset()
+ {
+ return offset;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(credits);
+ buffer.writeSimpleString(address);
+ buffer.writeInt(offset);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ credits = buffer.readInt();
+ address = buffer.readSimpleString();
+ offset = buffer.readInt();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,73 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- *
- * A SessionQueueQueryMessage
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class SessionQueueQueryMessage extends PacketImpl
-{
- private SimpleString queueName;
-
- public SessionQueueQueryMessage(final SimpleString queueName)
- {
- super(PacketImpl.SESS_QUEUEQUERY);
-
- this.queueName = queueName;
- }
-
- public SessionQueueQueryMessage()
- {
- super(PacketImpl.SESS_QUEUEQUERY);
- }
-
- public SimpleString getQueueName()
- {
- return queueName;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeSimpleString(queueName);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- queueName = buffer.readSimpleString();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionQueueQueryMessage == false)
- {
- return false;
- }
-
- SessionQueueQueryMessage r = (SessionQueueQueryMessage)other;
-
- return super.equals(other) && r.queueName.equals(queueName);
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,73 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ *
+ * A SessionQueueQueryMessage
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionQueueQueryMessage extends PacketImpl
+{
+ private SimpleString queueName;
+
+ public SessionQueueQueryMessage(final SimpleString queueName)
+ {
+ super(PacketImpl.SESS_QUEUEQUERY);
+
+ this.queueName = queueName;
+ }
+
+ public SessionQueueQueryMessage()
+ {
+ super(PacketImpl.SESS_QUEUEQUERY);
+ }
+
+ public SimpleString getQueueName()
+ {
+ return queueName;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeSimpleString(queueName);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ queueName = buffer.readSimpleString();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionQueueQueryMessage == false)
+ {
+ return false;
+ }
+
+ SessionQueueQueryMessage r = (SessionQueueQueryMessage)other;
+
+ return super.equals(other) && r.queueName.equals(queueName);
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,176 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.core.server.QueueQueryResult;
-
-/**
- *
- * A SessionQueueQueryResponseMessage
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class SessionQueueQueryResponseMessage extends PacketImpl
-{
- private SimpleString name;
-
- private boolean exists;
-
- private boolean durable;
-
- private int consumerCount;
-
- private int messageCount;
-
- private SimpleString filterString;
-
- private SimpleString address;
-
- private boolean temporary;
-
- public SessionQueueQueryResponseMessage(final QueueQueryResult result)
- {
- this(result.getName(), result.getAddress(), result.isDurable(), result.isTemporary(),
- result.getFilterString(), result.getConsumerCount(), result.getMessageCount(), result.isExists());
- }
-
- public SessionQueueQueryResponseMessage()
- {
- this(null, null, false, false, null, 0, 0, false);
- }
-
- private SessionQueueQueryResponseMessage(final SimpleString name,
- final SimpleString address,
- final boolean durable,
- final boolean temporary,
- final SimpleString filterString,
- final int consumerCount,
- final int messageCount,
- final boolean exists)
- {
- super(PacketImpl.SESS_QUEUEQUERY_RESP);
-
- this.durable = durable;
-
- this.temporary = temporary;
-
- this.consumerCount = consumerCount;
-
- this.messageCount = messageCount;
-
- this.filterString = filterString;
-
- this.address = address;
-
- this.name = name;
-
- this.exists = exists;
- }
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- public boolean isExists()
- {
- return exists;
- }
-
- public boolean isDurable()
- {
- return durable;
- }
-
- public int getConsumerCount()
- {
- return consumerCount;
- }
-
- public int getMessageCount()
- {
- return messageCount;
- }
-
- public SimpleString getFilterString()
- {
- return filterString;
- }
-
- public SimpleString getAddress()
- {
- return address;
- }
-
- public SimpleString getName()
- {
- return name;
- }
-
- public boolean isTemporary()
- {
- return temporary;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeBoolean(exists);
- buffer.writeBoolean(durable);
- buffer.writeBoolean(temporary);
- buffer.writeInt(consumerCount);
- buffer.writeInt(messageCount);
- buffer.writeNullableSimpleString(filterString);
- buffer.writeNullableSimpleString(address);
- buffer.writeNullableSimpleString(name);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- exists = buffer.readBoolean();
- durable = buffer.readBoolean();
- temporary = buffer.readBoolean();
- consumerCount = buffer.readInt();
- messageCount = buffer.readInt();
- filterString = buffer.readNullableSimpleString();
- address = buffer.readNullableSimpleString();
- name = buffer.readNullableSimpleString();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionQueueQueryResponseMessage == false)
- {
- return false;
- }
-
- SessionQueueQueryResponseMessage r = (SessionQueueQueryResponseMessage)other;
-
- return super.equals(other) && exists == r.exists &&
- durable == r.durable &&
- consumerCount == r.consumerCount &&
- messageCount == r.messageCount &&
- filterString == null ? r.filterString == null
- : filterString.equals(r.filterString) && address == null ? r.address == null
- : address.equals(r.address);
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,176 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.server.QueueQueryResult;
+
+/**
+ *
+ * A SessionQueueQueryResponseMessage
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionQueueQueryResponseMessage extends PacketImpl
+{
+ private SimpleString name;
+
+ private boolean exists;
+
+ private boolean durable;
+
+ private int consumerCount;
+
+ private int messageCount;
+
+ private SimpleString filterString;
+
+ private SimpleString address;
+
+ private boolean temporary;
+
+ public SessionQueueQueryResponseMessage(final QueueQueryResult result)
+ {
+ this(result.getName(), result.getAddress(), result.isDurable(), result.isTemporary(),
+ result.getFilterString(), result.getConsumerCount(), result.getMessageCount(), result.isExists());
+ }
+
+ public SessionQueueQueryResponseMessage()
+ {
+ this(null, null, false, false, null, 0, 0, false);
+ }
+
+ private SessionQueueQueryResponseMessage(final SimpleString name,
+ final SimpleString address,
+ final boolean durable,
+ final boolean temporary,
+ final SimpleString filterString,
+ final int consumerCount,
+ final int messageCount,
+ final boolean exists)
+ {
+ super(PacketImpl.SESS_QUEUEQUERY_RESP);
+
+ this.durable = durable;
+
+ this.temporary = temporary;
+
+ this.consumerCount = consumerCount;
+
+ this.messageCount = messageCount;
+
+ this.filterString = filterString;
+
+ this.address = address;
+
+ this.name = name;
+
+ this.exists = exists;
+ }
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ public boolean isExists()
+ {
+ return exists;
+ }
+
+ public boolean isDurable()
+ {
+ return durable;
+ }
+
+ public int getConsumerCount()
+ {
+ return consumerCount;
+ }
+
+ public int getMessageCount()
+ {
+ return messageCount;
+ }
+
+ public SimpleString getFilterString()
+ {
+ return filterString;
+ }
+
+ public SimpleString getAddress()
+ {
+ return address;
+ }
+
+ public SimpleString getName()
+ {
+ return name;
+ }
+
+ public boolean isTemporary()
+ {
+ return temporary;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeBoolean(exists);
+ buffer.writeBoolean(durable);
+ buffer.writeBoolean(temporary);
+ buffer.writeInt(consumerCount);
+ buffer.writeInt(messageCount);
+ buffer.writeNullableSimpleString(filterString);
+ buffer.writeNullableSimpleString(address);
+ buffer.writeNullableSimpleString(name);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ exists = buffer.readBoolean();
+ durable = buffer.readBoolean();
+ temporary = buffer.readBoolean();
+ consumerCount = buffer.readInt();
+ messageCount = buffer.readInt();
+ filterString = buffer.readNullableSimpleString();
+ address = buffer.readNullableSimpleString();
+ name = buffer.readNullableSimpleString();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionQueueQueryResponseMessage == false)
+ {
+ return false;
+ }
+
+ SessionQueueQueryResponseMessage r = (SessionQueueQueryResponseMessage)other;
+
+ return super.equals(other) && exists == r.exists &&
+ durable == r.durable &&
+ consumerCount == r.consumerCount &&
+ messageCount == r.messageCount &&
+ filterString == null ? r.filterString == null
+ : filterString.equals(r.filterString) && address == null ? r.address == null
+ : address.equals(r.address);
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,96 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.DataConstants;
-
-/**
- * A SessionSendContinuationMessage
- *
- * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- * Created Dec 4, 2008 12:25:14 PM
- *
- *
- */
-public class SessionReceiveContinuationMessage extends SessionContinuationMessage
-{
-
- // Constants -----------------------------------------------------
-
- public static final int SESSION_RECEIVE_CONTINUATION_BASE_SIZE = SessionContinuationMessage.SESSION_CONTINUATION_BASE_SIZE + DataConstants.SIZE_LONG;
-
- // Attributes ----------------------------------------------------
-
- private long consumerID;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionReceiveContinuationMessage()
- {
- super(PacketImpl.SESS_RECEIVE_CONTINUATION);
- }
-
- /**
- * @param consumerID
- * @param body
- * @param continues
- * @param requiresResponse
- */
- public SessionReceiveContinuationMessage(final long consumerID,
- final byte[] body,
- final boolean continues,
- final boolean requiresResponse)
- {
- super(PacketImpl.SESS_RECEIVE_CONTINUATION, body, continues);
- this.consumerID = consumerID;
- }
-
- /**
- * @return the consumerID
- */
- public long getConsumerID()
- {
- return consumerID;
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- super.encodeRest(buffer);
- buffer.writeLong(consumerID);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- super.decodeRest(buffer);
- consumerID = buffer.readLong();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,96 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * A SessionSendContinuationMessage
+ *
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ * Created Dec 4, 2008 12:25:14 PM
+ *
+ *
+ */
+public class SessionReceiveContinuationMessage extends SessionContinuationMessage
+{
+
+ // Constants -----------------------------------------------------
+
+ public static final int SESSION_RECEIVE_CONTINUATION_BASE_SIZE = SessionContinuationMessage.SESSION_CONTINUATION_BASE_SIZE + DataConstants.SIZE_LONG;
+
+ // Attributes ----------------------------------------------------
+
+ private long consumerID;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionReceiveContinuationMessage()
+ {
+ super(PacketImpl.SESS_RECEIVE_CONTINUATION);
+ }
+
+ /**
+ * @param consumerID
+ * @param body
+ * @param continues
+ * @param requiresResponse
+ */
+ public SessionReceiveContinuationMessage(final long consumerID,
+ final byte[] body,
+ final boolean continues,
+ final boolean requiresResponse)
+ {
+ super(PacketImpl.SESS_RECEIVE_CONTINUATION, body, continues);
+ this.consumerID = consumerID;
+ }
+
+ /**
+ * @return the consumerID
+ */
+ public long getConsumerID()
+ {
+ return consumerID;
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ super.encodeRest(buffer);
+ buffer.writeLong(consumerID);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ super.decodeRest(buffer);
+ consumerID = buffer.readLong();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,102 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A SessionReceiveLargeMessage
- *
- * @author Clebert Suconic
- *
- *
- */
-public class SessionReceiveLargeMessage extends PacketImpl
-{
- private byte[] largeMessageHeader;
-
- /** Since we receive the message before the entire message was received, */
- private long largeMessageSize;
-
- private long consumerID;
-
- private int deliveryCount;
-
- public SessionReceiveLargeMessage()
- {
- super(PacketImpl.SESS_RECEIVE_LARGE_MSG);
- }
-
- public SessionReceiveLargeMessage(final long consumerID,
- final byte[] largeMessageHeader,
- final long largeMessageSize,
- final int deliveryCount)
- {
- super(PacketImpl.SESS_RECEIVE_LARGE_MSG);
-
- this.consumerID = consumerID;
-
- this.largeMessageHeader = largeMessageHeader;
-
- this.deliveryCount = deliveryCount;
-
- this.largeMessageSize = largeMessageSize;
- }
-
- public byte[] getLargeMessageHeader()
- {
- return largeMessageHeader;
- }
-
- public long getConsumerID()
- {
- return consumerID;
- }
-
- public int getDeliveryCount()
- {
- return deliveryCount;
- }
-
- /**
- * @return the largeMessageSize
- */
- public long getLargeMessageSize()
- {
- return largeMessageSize;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeLong(consumerID);
- buffer.writeInt(deliveryCount);
- buffer.writeLong(largeMessageSize);
- buffer.writeInt(largeMessageHeader.length);
- buffer.writeBytes(largeMessageHeader);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- consumerID = buffer.readLong();
- deliveryCount = buffer.readInt();
- largeMessageSize = buffer.readLong();
- int size = buffer.readInt();
- largeMessageHeader = new byte[size];
- buffer.readBytes(largeMessageHeader);
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,102 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A SessionReceiveLargeMessage
+ *
+ * @author Clebert Suconic
+ *
+ *
+ */
+public class SessionReceiveLargeMessage extends PacketImpl
+{
+ private byte[] largeMessageHeader;
+
+ /** Since we receive the message before the entire message was received, */
+ private long largeMessageSize;
+
+ private long consumerID;
+
+ private int deliveryCount;
+
+ public SessionReceiveLargeMessage()
+ {
+ super(PacketImpl.SESS_RECEIVE_LARGE_MSG);
+ }
+
+ public SessionReceiveLargeMessage(final long consumerID,
+ final byte[] largeMessageHeader,
+ final long largeMessageSize,
+ final int deliveryCount)
+ {
+ super(PacketImpl.SESS_RECEIVE_LARGE_MSG);
+
+ this.consumerID = consumerID;
+
+ this.largeMessageHeader = largeMessageHeader;
+
+ this.deliveryCount = deliveryCount;
+
+ this.largeMessageSize = largeMessageSize;
+ }
+
+ public byte[] getLargeMessageHeader()
+ {
+ return largeMessageHeader;
+ }
+
+ public long getConsumerID()
+ {
+ return consumerID;
+ }
+
+ public int getDeliveryCount()
+ {
+ return deliveryCount;
+ }
+
+ /**
+ * @return the largeMessageSize
+ */
+ public long getLargeMessageSize()
+ {
+ return largeMessageSize;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeLong(consumerID);
+ buffer.writeInt(deliveryCount);
+ buffer.writeLong(largeMessageSize);
+ buffer.writeInt(largeMessageHeader.length);
+ buffer.writeBytes(largeMessageHeader);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ consumerID = buffer.readLong();
+ deliveryCount = buffer.readInt();
+ largeMessageSize = buffer.readLong();
+ int size = buffer.readInt();
+ largeMessageHeader = new byte[size];
+ buffer.readBytes(largeMessageHeader);
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,120 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.client.impl.ClientMessageImpl;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.spi.core.protocol.RemotingConnection;
-import org.hornetq.utils.DataConstants;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class SessionReceiveMessage extends MessagePacket
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(SessionReceiveMessage.class);
-
- // Attributes ----------------------------------------------------
-
- private long consumerID;
-
- private int deliveryCount;
-
- public SessionReceiveMessage(final long consumerID, final MessageInternal message, final int deliveryCount)
- {
- super(PacketImpl.SESS_RECEIVE_MSG, message);
-
- this.consumerID = consumerID;
-
- this.deliveryCount = deliveryCount;
- }
-
- public SessionReceiveMessage()
- {
- super(PacketImpl.SESS_RECEIVE_MSG, new ClientMessageImpl());
- }
-
- // Public --------------------------------------------------------
-
- public long getConsumerID()
- {
- return consumerID;
- }
-
- public int getDeliveryCount()
- {
- return deliveryCount;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- @Override
- public HornetQBuffer encode(final RemotingConnection connection)
- {
- HornetQBuffer buffer = message.getEncodedBuffer();
-
- // Sanity check
- if (buffer.writerIndex() != message.getEndOfMessagePosition())
- {
- throw new IllegalStateException("Wrong encode position");
- }
-
- buffer.writeLong(consumerID);
- buffer.writeInt(deliveryCount);
-
- size = buffer.writerIndex();
-
- // Write standard headers
-
- int len = size - DataConstants.SIZE_INT;
- buffer.setInt(0, len);
- buffer.setByte(DataConstants.SIZE_INT, type);
- buffer.setLong(DataConstants.SIZE_INT + DataConstants.SIZE_BYTE, channelID);
-
- // Position reader for reading by Netty
- buffer.setIndex(0, size);
-
- return buffer;
- }
-
- @Override
- public void decode(final HornetQBuffer buffer)
- {
- channelID = buffer.readLong();
-
- message.decodeFromBuffer(buffer);
-
- consumerID = buffer.readLong();
-
- deliveryCount = buffer.readInt();
-
- size = buffer.readerIndex();
-
- // Need to position buffer for reading
-
- buffer.setIndex(PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT, message.getEndOfBodyPosition());
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,120 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.client.impl.ClientMessageImpl;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.message.impl.MessageInternal;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionReceiveMessage extends MessagePacket
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(SessionReceiveMessage.class);
+
+ // Attributes ----------------------------------------------------
+
+ private long consumerID;
+
+ private int deliveryCount;
+
+ public SessionReceiveMessage(final long consumerID, final MessageInternal message, final int deliveryCount)
+ {
+ super(PacketImpl.SESS_RECEIVE_MSG, message);
+
+ this.consumerID = consumerID;
+
+ this.deliveryCount = deliveryCount;
+ }
+
+ public SessionReceiveMessage()
+ {
+ super(PacketImpl.SESS_RECEIVE_MSG, new ClientMessageImpl());
+ }
+
+ // Public --------------------------------------------------------
+
+ public long getConsumerID()
+ {
+ return consumerID;
+ }
+
+ public int getDeliveryCount()
+ {
+ return deliveryCount;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ public HornetQBuffer encode(final RemotingConnection connection)
+ {
+ HornetQBuffer buffer = message.getEncodedBuffer();
+
+ // Sanity check
+ if (buffer.writerIndex() != message.getEndOfMessagePosition())
+ {
+ throw new IllegalStateException("Wrong encode position");
+ }
+
+ buffer.writeLong(consumerID);
+ buffer.writeInt(deliveryCount);
+
+ size = buffer.writerIndex();
+
+ // Write standard headers
+
+ int len = size - DataConstants.SIZE_INT;
+ buffer.setInt(0, len);
+ buffer.setByte(DataConstants.SIZE_INT, type);
+ buffer.setLong(DataConstants.SIZE_INT + DataConstants.SIZE_BYTE, channelID);
+
+ // Position reader for reading by Netty
+ buffer.setIndex(0, size);
+
+ return buffer;
+ }
+
+ @Override
+ public void decode(final HornetQBuffer buffer)
+ {
+ channelID = buffer.readLong();
+
+ message.decodeFromBuffer(buffer);
+
+ consumerID = buffer.readLong();
+
+ deliveryCount = buffer.readInt();
+
+ size = buffer.readerIndex();
+
+ // Need to position buffer for reading
+
+ buffer.setIndex(PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT, message.getEndOfBodyPosition());
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,90 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- */
-public class SessionRequestProducerCreditsMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private int credits;
-
- private SimpleString address;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionRequestProducerCreditsMessage(final int credits, final SimpleString address)
- {
- super(PacketImpl.SESS_PRODUCER_REQUEST_CREDITS);
-
- this.credits = credits;
-
- this.address = address;
- }
-
- public SessionRequestProducerCreditsMessage()
- {
- super(PacketImpl.SESS_PRODUCER_REQUEST_CREDITS);
- }
-
- // Public --------------------------------------------------------
-
- public int getCredits()
- {
- return credits;
- }
-
- public SimpleString getAddress()
- {
- return address;
- }
-
- // public boolean isRequiresConfirmations()
- // {
- // return false;
- // }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(credits);
- buffer.writeSimpleString(address);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- credits = buffer.readInt();
- address = buffer.readSimpleString();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,90 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ */
+public class SessionRequestProducerCreditsMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private int credits;
+
+ private SimpleString address;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionRequestProducerCreditsMessage(final int credits, final SimpleString address)
+ {
+ super(PacketImpl.SESS_PRODUCER_REQUEST_CREDITS);
+
+ this.credits = credits;
+
+ this.address = address;
+ }
+
+ public SessionRequestProducerCreditsMessage()
+ {
+ super(PacketImpl.SESS_PRODUCER_REQUEST_CREDITS);
+ }
+
+ // Public --------------------------------------------------------
+
+ public int getCredits()
+ {
+ return credits;
+ }
+
+ public SimpleString getAddress()
+ {
+ return address;
+ }
+
+ // public boolean isRequiresConfirmations()
+ // {
+ // return false;
+ // }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(credits);
+ buffer.writeSimpleString(address);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ credits = buffer.readInt();
+ address = buffer.readSimpleString();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,89 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * A SessionSendContinuationMessage
- *
- * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
- * Created Dec 4, 2008 12:25:14 PM
- *
- *
- */
-public class SessionSendContinuationMessage extends SessionContinuationMessage
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private boolean requiresResponse;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionSendContinuationMessage()
- {
- super(PacketImpl.SESS_SEND_CONTINUATION);
- }
-
- /**
- * @param body
- * @param continues
- * @param requiresResponse
- */
- public SessionSendContinuationMessage(final byte[] body, final boolean continues, final boolean requiresResponse)
- {
- super(PacketImpl.SESS_SEND_CONTINUATION, body, continues);
- this.requiresResponse = requiresResponse;
- }
-
- // Public --------------------------------------------------------
-
- /**
- * @return the requiresResponse
- */
- public boolean isRequiresResponse()
- {
- return requiresResponse;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- super.encodeRest(buffer);
- buffer.writeBoolean(requiresResponse);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- super.decodeRest(buffer);
- requiresResponse = buffer.readBoolean();
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,89 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * A SessionSendContinuationMessage
+ *
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ * Created Dec 4, 2008 12:25:14 PM
+ *
+ *
+ */
+public class SessionSendContinuationMessage extends SessionContinuationMessage
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private boolean requiresResponse;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionSendContinuationMessage()
+ {
+ super(PacketImpl.SESS_SEND_CONTINUATION);
+ }
+
+ /**
+ * @param body
+ * @param continues
+ * @param requiresResponse
+ */
+ public SessionSendContinuationMessage(final byte[] body, final boolean continues, final boolean requiresResponse)
+ {
+ super(PacketImpl.SESS_SEND_CONTINUATION, body, continues);
+ this.requiresResponse = requiresResponse;
+ }
+
+ // Public --------------------------------------------------------
+
+ /**
+ * @return the requiresResponse
+ */
+ public boolean isRequiresResponse()
+ {
+ return requiresResponse;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ super.encodeRest(buffer);
+ buffer.writeBoolean(requiresResponse);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ super.decodeRest(buffer);
+ requiresResponse = buffer.readBoolean();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,82 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:csuconic@redhat.com">Clebert Suconic</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionSendLargeMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- /** Used only if largeMessage */
- private byte[] largeMessageHeader;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionSendLargeMessage(final byte[] largeMessageHeader)
- {
- super(PacketImpl.SESS_SEND_LARGE);
-
- this.largeMessageHeader = largeMessageHeader;
- }
-
- public SessionSendLargeMessage()
- {
- super(PacketImpl.SESS_SEND_LARGE);
- }
-
- // Public --------------------------------------------------------
-
- public byte[] getLargeMessageHeader()
- {
- return largeMessageHeader;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(largeMessageHeader.length);
- buffer.writeBytes(largeMessageHeader);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- int largeMessageLength = buffer.readInt();
-
- largeMessageHeader = new byte[largeMessageLength];
-
- buffer.readBytes(largeMessageHeader);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,82 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:csuconic@redhat.com">Clebert Suconic</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionSendLargeMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ /** Used only if largeMessage */
+ private byte[] largeMessageHeader;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionSendLargeMessage(final byte[] largeMessageHeader)
+ {
+ super(PacketImpl.SESS_SEND_LARGE);
+
+ this.largeMessageHeader = largeMessageHeader;
+ }
+
+ public SessionSendLargeMessage()
+ {
+ super(PacketImpl.SESS_SEND_LARGE);
+ }
+
+ // Public --------------------------------------------------------
+
+ public byte[] getLargeMessageHeader()
+ {
+ return largeMessageHeader;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(largeMessageHeader.length);
+ buffer.writeBytes(largeMessageHeader);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ int largeMessageLength = buffer.readInt();
+
+ largeMessageHeader = new byte[largeMessageLength];
+
+ buffer.readBytes(largeMessageHeader);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,115 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.Message;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.core.server.impl.ServerMessageImpl;
-import org.hornetq.spi.core.protocol.RemotingConnection;
-import org.hornetq.utils.DataConstants;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionSendMessage extends MessagePacket
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(SessionSendMessage.class);
-
- // Attributes ----------------------------------------------------
-
- private boolean requiresResponse;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionSendMessage(final MessageInternal message, final boolean requiresResponse)
- {
- super(PacketImpl.SESS_SEND, message);
-
- this.requiresResponse = requiresResponse;
- }
-
- public SessionSendMessage()
- {
- super(PacketImpl.SESS_SEND, new ServerMessageImpl());
- }
-
- // Public --------------------------------------------------------
-
- public boolean isRequiresResponse()
- {
- return requiresResponse;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- @Override
- public HornetQBuffer encode(final RemotingConnection connection)
- {
- HornetQBuffer buffer = message.getEncodedBuffer();
-
- // Sanity check
- if (buffer.writerIndex() != message.getEndOfMessagePosition())
- {
- throw new IllegalStateException("Wrong encode position");
- }
-
- buffer.writeBoolean(requiresResponse);
-
- size = buffer.writerIndex();
-
- // Write standard headers
-
- int len = size - DataConstants.SIZE_INT;
- buffer.setInt(0, len);
- buffer.setByte(DataConstants.SIZE_INT, type);
- buffer.setLong(DataConstants.SIZE_INT + DataConstants.SIZE_BYTE, channelID);
-
- // Position reader for reading by Netty
- buffer.readerIndex(0);
-
- message.resetCopied();
-
- return buffer;
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- // Buffer comes in after having read standard headers and positioned at Beginning of body part
-
- message.decodeFromBuffer(buffer);
-
- int ri = buffer.readerIndex();
-
- requiresResponse = buffer.readBoolean();
-
- buffer.readerIndex(ri);
-
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,115 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.Message;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.message.impl.MessageInternal;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.server.impl.ServerMessageImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionSendMessage extends MessagePacket
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(SessionSendMessage.class);
+
+ // Attributes ----------------------------------------------------
+
+ private boolean requiresResponse;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionSendMessage(final MessageInternal message, final boolean requiresResponse)
+ {
+ super(PacketImpl.SESS_SEND, message);
+
+ this.requiresResponse = requiresResponse;
+ }
+
+ public SessionSendMessage()
+ {
+ super(PacketImpl.SESS_SEND, new ServerMessageImpl());
+ }
+
+ // Public --------------------------------------------------------
+
+ public boolean isRequiresResponse()
+ {
+ return requiresResponse;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ public HornetQBuffer encode(final RemotingConnection connection)
+ {
+ HornetQBuffer buffer = message.getEncodedBuffer();
+
+ // Sanity check
+ if (buffer.writerIndex() != message.getEndOfMessagePosition())
+ {
+ throw new IllegalStateException("Wrong encode position");
+ }
+
+ buffer.writeBoolean(requiresResponse);
+
+ size = buffer.writerIndex();
+
+ // Write standard headers
+
+ int len = size - DataConstants.SIZE_INT;
+ buffer.setInt(0, len);
+ buffer.setByte(DataConstants.SIZE_INT, type);
+ buffer.setLong(DataConstants.SIZE_INT + DataConstants.SIZE_BYTE, channelID);
+
+ // Position reader for reading by Netty
+ buffer.readerIndex(0);
+
+ message.resetCopied();
+
+ return buffer;
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ // Buffer comes in after having read standard headers and positioned at Beginning of body part
+
+ message.decodeFromBuffer(buffer);
+
+ int ri = buffer.readerIndex();
+
+ requiresResponse = buffer.readBoolean();
+
+ buffer.readerIndex(ri);
+
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,112 +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.protocol.core.impl.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.XidCodecSupport;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXACommitMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private boolean onePhase;
-
- private Xid xid;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXACommitMessage(final Xid xid, final boolean onePhase)
- {
- super(PacketImpl.SESS_XA_COMMIT);
-
- this.xid = xid;
- this.onePhase = onePhase;
- }
-
- public SessionXACommitMessage()
- {
- super(PacketImpl.SESS_XA_COMMIT);
- }
-
- // Public --------------------------------------------------------
-
- public Xid getXid()
- {
- return xid;
- }
-
- public boolean isOnePhase()
- {
- return onePhase;
- }
-
- @Override
- public boolean isAsyncExec()
- {
- return true;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- XidCodecSupport.encodeXid(xid, buffer);
- buffer.writeBoolean(onePhase);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- xid = XidCodecSupport.decodeXid(buffer);
- onePhase = buffer.readBoolean();
- }
-
- @Override
- public String toString()
- {
- return getParentString() + ", xid=" + xid + ", onePhase=" + onePhase + "]";
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXACommitMessage == false)
- {
- return false;
- }
-
- SessionXACommitMessage r = (SessionXACommitMessage)other;
-
- return super.equals(other) && xid.equals(r.xid) && onePhase == r.onePhase;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,112 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXACommitMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private boolean onePhase;
+
+ private Xid xid;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXACommitMessage(final Xid xid, final boolean onePhase)
+ {
+ super(PacketImpl.SESS_XA_COMMIT);
+
+ this.xid = xid;
+ this.onePhase = onePhase;
+ }
+
+ public SessionXACommitMessage()
+ {
+ super(PacketImpl.SESS_XA_COMMIT);
+ }
+
+ // Public --------------------------------------------------------
+
+ public Xid getXid()
+ {
+ return xid;
+ }
+
+ public boolean isOnePhase()
+ {
+ return onePhase;
+ }
+
+ @Override
+ public boolean isAsyncExec()
+ {
+ return true;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ XidCodecSupport.encodeXid(xid, buffer);
+ buffer.writeBoolean(onePhase);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ xid = XidCodecSupport.decodeXid(buffer);
+ onePhase = buffer.readBoolean();
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + ", xid=" + xid + ", onePhase=" + onePhase + "]";
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXACommitMessage == false)
+ {
+ return false;
+ }
+
+ SessionXACommitMessage r = (SessionXACommitMessage)other;
+
+ return super.equals(other) && xid.equals(r.xid) && onePhase == r.onePhase;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,107 +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.protocol.core.impl.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.XidCodecSupport;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXAEndMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private Xid xid;
-
- private boolean failed;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXAEndMessage(final Xid xid, final boolean failed)
- {
- super(PacketImpl.SESS_XA_END);
-
- this.xid = xid;
-
- this.failed = failed;
- }
-
- public SessionXAEndMessage()
- {
- super(PacketImpl.SESS_XA_END);
- }
-
- // Public --------------------------------------------------------
-
- public boolean isFailed()
- {
- return failed;
- }
-
- public Xid getXid()
- {
- return xid;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- XidCodecSupport.encodeXid(xid, buffer);
- buffer.writeBoolean(failed);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- xid = XidCodecSupport.decodeXid(buffer);
- failed = buffer.readBoolean();
- }
-
- @Override
- public String toString()
- {
- return getParentString() + ", xid=" + xid + ", failed=" + failed + "]";
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXAEndMessage == false)
- {
- return false;
- }
-
- SessionXAEndMessage r = (SessionXAEndMessage)other;
-
- return super.equals(other) && xid.equals(r.xid) && failed == r.failed;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,107 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAEndMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Xid xid;
+
+ private boolean failed;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXAEndMessage(final Xid xid, final boolean failed)
+ {
+ super(PacketImpl.SESS_XA_END);
+
+ this.xid = xid;
+
+ this.failed = failed;
+ }
+
+ public SessionXAEndMessage()
+ {
+ super(PacketImpl.SESS_XA_END);
+ }
+
+ // Public --------------------------------------------------------
+
+ public boolean isFailed()
+ {
+ return failed;
+ }
+
+ public Xid getXid()
+ {
+ return xid;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ XidCodecSupport.encodeXid(xid, buffer);
+ buffer.writeBoolean(failed);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ xid = XidCodecSupport.decodeXid(buffer);
+ failed = buffer.readBoolean();
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + ", xid=" + xid + ", failed=" + failed + "]";
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXAEndMessage == false)
+ {
+ return false;
+ }
+
+ SessionXAEndMessage r = (SessionXAEndMessage)other;
+
+ return super.equals(other) && xid.equals(r.xid) && failed == r.failed;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,90 +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.protocol.core.impl.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.XidCodecSupport;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXAForgetMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private Xid xid;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXAForgetMessage(final Xid xid)
- {
- super(PacketImpl.SESS_XA_FORGET);
-
- this.xid = xid;
- }
-
- public SessionXAForgetMessage()
- {
- super(PacketImpl.SESS_XA_FORGET);
- }
-
- // Public --------------------------------------------------------
-
- public Xid getXid()
- {
- return xid;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- XidCodecSupport.encodeXid(xid, buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- xid = XidCodecSupport.decodeXid(buffer);
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXAForgetMessage == false)
- {
- return false;
- }
-
- SessionXAForgetMessage r = (SessionXAForgetMessage)other;
-
- return super.equals(other) && xid.equals(r.xid);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,90 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAForgetMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Xid xid;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXAForgetMessage(final Xid xid)
+ {
+ super(PacketImpl.SESS_XA_FORGET);
+
+ this.xid = xid;
+ }
+
+ public SessionXAForgetMessage()
+ {
+ super(PacketImpl.SESS_XA_FORGET);
+ }
+
+ // Public --------------------------------------------------------
+
+ public Xid getXid()
+ {
+ return xid;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ XidCodecSupport.encodeXid(xid, buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ xid = XidCodecSupport.decodeXid(buffer);
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXAForgetMessage == false)
+ {
+ return false;
+ }
+
+ SessionXAForgetMessage r = (SessionXAForgetMessage)other;
+
+ return super.equals(other) && xid.equals(r.xid);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,128 +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.protocol.core.impl.wireformat;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.XidCodecSupport;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXAGetInDoubtXidsResponseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private List<Xid> xids;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXAGetInDoubtXidsResponseMessage(final List<Xid> xids)
- {
- super(PacketImpl.SESS_XA_INDOUBT_XIDS_RESP);
-
- this.xids = xids;
- }
-
- public SessionXAGetInDoubtXidsResponseMessage()
- {
- super(PacketImpl.SESS_XA_INDOUBT_XIDS_RESP);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- public List<Xid> getXids()
- {
- return xids;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(xids.size());
-
- for (Xid xid : xids)
- {
- XidCodecSupport.encodeXid(xid, buffer);
- }
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- int len = buffer.readInt();
- xids = new ArrayList<Xid>(len);
- for (int i = 0; i < len; i++)
- {
- Xid xid = XidCodecSupport.decodeXid(buffer);
-
- xids.add(xid);
- }
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXAGetInDoubtXidsResponseMessage == false)
- {
- return false;
- }
-
- SessionXAGetInDoubtXidsResponseMessage r = (SessionXAGetInDoubtXidsResponseMessage)other;
-
- if (super.equals(other))
- {
- if (xids.size() == r.xids.size())
- {
- for (int i = 0; i < xids.size(); i++)
- {
- if (!xids.get(i).equals(r.xids.get(i)))
- {
- return false;
- }
- }
- }
- }
- else
- {
- return false;
- }
- return true;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,128 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAGetInDoubtXidsResponseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private List<Xid> xids;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXAGetInDoubtXidsResponseMessage(final List<Xid> xids)
+ {
+ super(PacketImpl.SESS_XA_INDOUBT_XIDS_RESP);
+
+ this.xids = xids;
+ }
+
+ public SessionXAGetInDoubtXidsResponseMessage()
+ {
+ super(PacketImpl.SESS_XA_INDOUBT_XIDS_RESP);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ public List<Xid> getXids()
+ {
+ return xids;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(xids.size());
+
+ for (Xid xid : xids)
+ {
+ XidCodecSupport.encodeXid(xid, buffer);
+ }
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ int len = buffer.readInt();
+ xids = new ArrayList<Xid>(len);
+ for (int i = 0; i < len; i++)
+ {
+ Xid xid = XidCodecSupport.decodeXid(buffer);
+
+ xids.add(xid);
+ }
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXAGetInDoubtXidsResponseMessage == false)
+ {
+ return false;
+ }
+
+ SessionXAGetInDoubtXidsResponseMessage r = (SessionXAGetInDoubtXidsResponseMessage)other;
+
+ if (super.equals(other))
+ {
+ if (xids.size() == r.xids.size())
+ {
+ for (int i = 0; i < xids.size(); i++)
+ {
+ if (!xids.get(i).equals(r.xids.get(i)))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ return false;
+ }
+ return true;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,93 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXAGetTimeoutResponseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private int timeoutSeconds;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXAGetTimeoutResponseMessage(final int timeoutSeconds)
- {
- super(PacketImpl.SESS_XA_GET_TIMEOUT_RESP);
-
- this.timeoutSeconds = timeoutSeconds;
- }
-
- public SessionXAGetTimeoutResponseMessage()
- {
- super(PacketImpl.SESS_XA_GET_TIMEOUT_RESP);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- public int getTimeoutSeconds()
- {
- return timeoutSeconds;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(timeoutSeconds);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- timeoutSeconds = buffer.readInt();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXAGetTimeoutResponseMessage == false)
- {
- return false;
- }
-
- SessionXAGetTimeoutResponseMessage r = (SessionXAGetTimeoutResponseMessage)other;
-
- return super.equals(other) && timeoutSeconds == r.timeoutSeconds;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,93 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAGetTimeoutResponseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private int timeoutSeconds;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXAGetTimeoutResponseMessage(final int timeoutSeconds)
+ {
+ super(PacketImpl.SESS_XA_GET_TIMEOUT_RESP);
+
+ this.timeoutSeconds = timeoutSeconds;
+ }
+
+ public SessionXAGetTimeoutResponseMessage()
+ {
+ super(PacketImpl.SESS_XA_GET_TIMEOUT_RESP);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ public int getTimeoutSeconds()
+ {
+ return timeoutSeconds;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(timeoutSeconds);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ timeoutSeconds = buffer.readInt();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXAGetTimeoutResponseMessage == false)
+ {
+ return false;
+ }
+
+ SessionXAGetTimeoutResponseMessage r = (SessionXAGetTimeoutResponseMessage)other;
+
+ return super.equals(other) && timeoutSeconds == r.timeoutSeconds;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,90 +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.protocol.core.impl.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.XidCodecSupport;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXAJoinMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private Xid xid;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXAJoinMessage(final Xid xid)
- {
- super(PacketImpl.SESS_XA_JOIN);
-
- this.xid = xid;
- }
-
- public SessionXAJoinMessage()
- {
- super(PacketImpl.SESS_XA_JOIN);
- }
-
- // Public --------------------------------------------------------
-
- public Xid getXid()
- {
- return xid;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- XidCodecSupport.encodeXid(xid, buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- xid = XidCodecSupport.decodeXid(buffer);
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXAJoinMessage == false)
- {
- return false;
- }
-
- SessionXAJoinMessage r = (SessionXAJoinMessage)other;
-
- return super.equals(other) && xid.equals(r.xid);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,90 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAJoinMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Xid xid;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXAJoinMessage(final Xid xid)
+ {
+ super(PacketImpl.SESS_XA_JOIN);
+
+ this.xid = xid;
+ }
+
+ public SessionXAJoinMessage()
+ {
+ super(PacketImpl.SESS_XA_JOIN);
+ }
+
+ // Public --------------------------------------------------------
+
+ public Xid getXid()
+ {
+ return xid;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ XidCodecSupport.encodeXid(xid, buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ xid = XidCodecSupport.decodeXid(buffer);
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXAJoinMessage == false)
+ {
+ return false;
+ }
+
+ SessionXAJoinMessage r = (SessionXAJoinMessage)other;
+
+ return super.equals(other) && xid.equals(r.xid);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,95 +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.protocol.core.impl.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.XidCodecSupport;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXAPrepareMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private Xid xid;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXAPrepareMessage(final Xid xid)
- {
- super(PacketImpl.SESS_XA_PREPARE);
-
- this.xid = xid;
- }
-
- public SessionXAPrepareMessage()
- {
- super(PacketImpl.SESS_XA_PREPARE);
- }
-
- // Public --------------------------------------------------------
-
- public Xid getXid()
- {
- return xid;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- XidCodecSupport.encodeXid(xid, buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- xid = XidCodecSupport.decodeXid(buffer);
- }
-
- public boolean isAsyncExec()
- {
- return true;
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXAPrepareMessage == false)
- {
- return false;
- }
-
- SessionXAPrepareMessage r = (SessionXAPrepareMessage)other;
-
- return super.equals(other) && xid.equals(r.xid);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,95 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAPrepareMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Xid xid;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXAPrepareMessage(final Xid xid)
+ {
+ super(PacketImpl.SESS_XA_PREPARE);
+
+ this.xid = xid;
+ }
+
+ public SessionXAPrepareMessage()
+ {
+ super(PacketImpl.SESS_XA_PREPARE);
+ }
+
+ // Public --------------------------------------------------------
+
+ public Xid getXid()
+ {
+ return xid;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ XidCodecSupport.encodeXid(xid, buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ xid = XidCodecSupport.decodeXid(buffer);
+ }
+
+ public boolean isAsyncExec()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXAPrepareMessage == false)
+ {
+ return false;
+ }
+
+ SessionXAPrepareMessage r = (SessionXAPrepareMessage)other;
+
+ return super.equals(other) && xid.equals(r.xid);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,115 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXAResponseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private boolean error;
-
- private int responseCode;
-
- private String message;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXAResponseMessage(final boolean isError, final int responseCode, final String message)
- {
- super(PacketImpl.SESS_XA_RESP);
-
- error = isError;
-
- this.responseCode = responseCode;
-
- this.message = message;
- }
-
- public SessionXAResponseMessage()
- {
- super(PacketImpl.SESS_XA_RESP);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- public boolean isError()
- {
- return error;
- }
-
- public int getResponseCode()
- {
- return responseCode;
- }
-
- public String getMessage()
- {
- return message;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeBoolean(error);
- buffer.writeInt(responseCode);
- buffer.writeNullableString(message);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- error = buffer.readBoolean();
- responseCode = buffer.readInt();
- message = buffer.readNullableString();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXAResponseMessage == false)
- {
- return false;
- }
-
- SessionXAResponseMessage r = (SessionXAResponseMessage)other;
-
- return super.equals(other) && error == r.error && responseCode == r.responseCode && message.equals(r.message);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,115 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAResponseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private boolean error;
+
+ private int responseCode;
+
+ private String message;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXAResponseMessage(final boolean isError, final int responseCode, final String message)
+ {
+ super(PacketImpl.SESS_XA_RESP);
+
+ error = isError;
+
+ this.responseCode = responseCode;
+
+ this.message = message;
+ }
+
+ public SessionXAResponseMessage()
+ {
+ super(PacketImpl.SESS_XA_RESP);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ public boolean isError()
+ {
+ return error;
+ }
+
+ public int getResponseCode()
+ {
+ return responseCode;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeBoolean(error);
+ buffer.writeInt(responseCode);
+ buffer.writeNullableString(message);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ error = buffer.readBoolean();
+ responseCode = buffer.readInt();
+ message = buffer.readNullableString();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXAResponseMessage == false)
+ {
+ return false;
+ }
+
+ SessionXAResponseMessage r = (SessionXAResponseMessage)other;
+
+ return super.equals(other) && error == r.error && responseCode == r.responseCode && message.equals(r.message);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,90 +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.protocol.core.impl.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.XidCodecSupport;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXAResumeMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private Xid xid;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXAResumeMessage(final Xid xid)
- {
- super(PacketImpl.SESS_XA_RESUME);
-
- this.xid = xid;
- }
-
- public SessionXAResumeMessage()
- {
- super(PacketImpl.SESS_XA_RESUME);
- }
-
- // Public --------------------------------------------------------
-
- public Xid getXid()
- {
- return xid;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- XidCodecSupport.encodeXid(xid, buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- xid = XidCodecSupport.decodeXid(buffer);
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXAResumeMessage == false)
- {
- return false;
- }
-
- SessionXAResumeMessage r = (SessionXAResumeMessage)other;
-
- return super.equals(other) && xid.equals(r.xid);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,90 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAResumeMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Xid xid;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXAResumeMessage(final Xid xid)
+ {
+ super(PacketImpl.SESS_XA_RESUME);
+
+ this.xid = xid;
+ }
+
+ public SessionXAResumeMessage()
+ {
+ super(PacketImpl.SESS_XA_RESUME);
+ }
+
+ // Public --------------------------------------------------------
+
+ public Xid getXid()
+ {
+ return xid;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ XidCodecSupport.encodeXid(xid, buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ xid = XidCodecSupport.decodeXid(buffer);
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXAResumeMessage == false)
+ {
+ return false;
+ }
+
+ SessionXAResumeMessage r = (SessionXAResumeMessage)other;
+
+ return super.equals(other) && xid.equals(r.xid);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,96 +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.protocol.core.impl.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.XidCodecSupport;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXARollbackMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private Xid xid;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXARollbackMessage(final Xid xid)
- {
- super(PacketImpl.SESS_XA_ROLLBACK);
-
- this.xid = xid;
- }
-
- public SessionXARollbackMessage()
- {
- super(PacketImpl.SESS_XA_ROLLBACK);
- }
-
- // Public --------------------------------------------------------
-
- public Xid getXid()
- {
- return xid;
- }
-
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- XidCodecSupport.encodeXid(xid, buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- xid = XidCodecSupport.decodeXid(buffer);
- }
-
- public boolean isAsyncExec()
- {
- return true;
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXARollbackMessage == false)
- {
- return false;
- }
-
- SessionXARollbackMessage r = (SessionXARollbackMessage)other;
-
- return super.equals(other) && xid.equals(r.xid);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,96 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXARollbackMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Xid xid;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXARollbackMessage(final Xid xid)
+ {
+ super(PacketImpl.SESS_XA_ROLLBACK);
+
+ this.xid = xid;
+ }
+
+ public SessionXARollbackMessage()
+ {
+ super(PacketImpl.SESS_XA_ROLLBACK);
+ }
+
+ // Public --------------------------------------------------------
+
+ public Xid getXid()
+ {
+ return xid;
+ }
+
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ XidCodecSupport.encodeXid(xid, buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ xid = XidCodecSupport.decodeXid(buffer);
+ }
+
+ public boolean isAsyncExec()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXARollbackMessage == false)
+ {
+ return false;
+ }
+
+ SessionXARollbackMessage r = (SessionXARollbackMessage)other;
+
+ return super.equals(other) && xid.equals(r.xid);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,87 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXASetTimeoutMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private int timeoutSeconds;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXASetTimeoutMessage(final int timeoutSeconds)
- {
- super(PacketImpl.SESS_XA_SET_TIMEOUT);
-
- this.timeoutSeconds = timeoutSeconds;
- }
-
- public SessionXASetTimeoutMessage()
- {
- super(PacketImpl.SESS_XA_SET_TIMEOUT);
- }
-
- // Public --------------------------------------------------------
-
- public int getTimeoutSeconds()
- {
- return timeoutSeconds;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeInt(timeoutSeconds);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- timeoutSeconds = buffer.readInt();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXASetTimeoutMessage == false)
- {
- return false;
- }
-
- SessionXASetTimeoutMessage r = (SessionXASetTimeoutMessage)other;
-
- return super.equals(other) && timeoutSeconds == r.timeoutSeconds;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,87 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXASetTimeoutMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private int timeoutSeconds;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXASetTimeoutMessage(final int timeoutSeconds)
+ {
+ super(PacketImpl.SESS_XA_SET_TIMEOUT);
+
+ this.timeoutSeconds = timeoutSeconds;
+ }
+
+ public SessionXASetTimeoutMessage()
+ {
+ super(PacketImpl.SESS_XA_SET_TIMEOUT);
+ }
+
+ // Public --------------------------------------------------------
+
+ public int getTimeoutSeconds()
+ {
+ return timeoutSeconds;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeInt(timeoutSeconds);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ timeoutSeconds = buffer.readInt();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXASetTimeoutMessage == false)
+ {
+ return false;
+ }
+
+ SessionXASetTimeoutMessage r = (SessionXASetTimeoutMessage)other;
+
+ return super.equals(other) && timeoutSeconds == r.timeoutSeconds;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,93 +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.protocol.core.impl.wireformat;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXASetTimeoutResponseMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private boolean ok;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXASetTimeoutResponseMessage(final boolean ok)
- {
- super(PacketImpl.SESS_XA_SET_TIMEOUT_RESP);
-
- this.ok = ok;
- }
-
- public SessionXASetTimeoutResponseMessage()
- {
- super(PacketImpl.SESS_XA_SET_TIMEOUT_RESP);
- }
-
- // Public --------------------------------------------------------
-
- @Override
- public boolean isResponse()
- {
- return true;
- }
-
- public boolean isOK()
- {
- return ok;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- buffer.writeBoolean(ok);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- ok = buffer.readBoolean();
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXASetTimeoutResponseMessage == false)
- {
- return false;
- }
-
- SessionXASetTimeoutResponseMessage r = (SessionXASetTimeoutResponseMessage)other;
-
- return super.equals(other) && ok == r.ok;
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,93 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXASetTimeoutResponseMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private boolean ok;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXASetTimeoutResponseMessage(final boolean ok)
+ {
+ super(PacketImpl.SESS_XA_SET_TIMEOUT_RESP);
+
+ this.ok = ok;
+ }
+
+ public SessionXASetTimeoutResponseMessage()
+ {
+ super(PacketImpl.SESS_XA_SET_TIMEOUT_RESP);
+ }
+
+ // Public --------------------------------------------------------
+
+ @Override
+ public boolean isResponse()
+ {
+ return true;
+ }
+
+ public boolean isOK()
+ {
+ return ok;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ buffer.writeBoolean(ok);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ ok = buffer.readBoolean();
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXASetTimeoutResponseMessage == false)
+ {
+ return false;
+ }
+
+ SessionXASetTimeoutResponseMessage r = (SessionXASetTimeoutResponseMessage)other;
+
+ return super.equals(other) && ok == r.ok;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,90 +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.protocol.core.impl.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.impl.PacketImpl;
-import org.hornetq.utils.XidCodecSupport;
-
-/**
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class SessionXAStartMessage extends PacketImpl
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private Xid xid;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public SessionXAStartMessage(final Xid xid)
- {
- super(PacketImpl.SESS_XA_START);
-
- this.xid = xid;
- }
-
- public SessionXAStartMessage()
- {
- super(PacketImpl.SESS_XA_START);
- }
-
- // Public --------------------------------------------------------
-
- public Xid getXid()
- {
- return xid;
- }
-
- @Override
- public void encodeRest(final HornetQBuffer buffer)
- {
- XidCodecSupport.encodeXid(xid, buffer);
- }
-
- @Override
- public void decodeRest(final HornetQBuffer buffer)
- {
- xid = XidCodecSupport.decodeXid(buffer);
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof SessionXAStartMessage == false)
- {
- return false;
- }
-
- SessionXAStartMessage r = (SessionXAStartMessage)other;
-
- return super.equals(other) && xid.equals(r.xid);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,90 @@
+/*
+ * 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.protocol.core.impl.wireformat;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
+
+/**
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public class SessionXAStartMessage extends PacketImpl
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private Xid xid;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public SessionXAStartMessage(final Xid xid)
+ {
+ super(PacketImpl.SESS_XA_START);
+
+ this.xid = xid;
+ }
+
+ public SessionXAStartMessage()
+ {
+ super(PacketImpl.SESS_XA_START);
+ }
+
+ // Public --------------------------------------------------------
+
+ public Xid getXid()
+ {
+ return xid;
+ }
+
+ @Override
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ XidCodecSupport.encodeXid(xid, buffer);
+ }
+
+ @Override
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ xid = XidCodecSupport.decodeXid(buffer);
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof SessionXAStartMessage == false)
+ {
+ return false;
+ }
+
+ SessionXAStartMessage r = (SessionXAStartMessage)other;
+
+ return super.equals(other) && xid.equals(r.xid);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/CloseListener.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/CloseListener.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/CloseListener.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -13,9 +13,9 @@
package org.hornetq.core.remoting;
/**
- * CloseListeners can be registered with a {@link org.hornetq.core.remoting.RemotingConnection} to get notified when the connection is closed.
+ * CloseListeners can be registered with a {@link org.hornetq.spi.core.protocol.RemotingConnection} to get notified when the connection is closed.
* <p/>
- * {@link org.hornetq.core.remoting.RemotingConnection#addCloseListener(CloseListener)}
+ * {@link org.hornetq.spi.core.protocol.RemotingConnection#addCloseListener(CloseListener)}
*
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/ProtocolType.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/ProtocolType.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/ProtocolType.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,26 +0,0 @@
-/*
- * Copyright 2010 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;
-
-/**
- * A ProtocolType
- *
- * @author Tim Fox
- *
- *
- */
-public enum ProtocolType
-{
- CORE, STOMP, AMQP;
-}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/RemotingConnection.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/RemotingConnection.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/RemotingConnection.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,156 +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;
-
-import java.util.List;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.spi.core.remoting.BufferHandler;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A RemotingConnection is a connection between a client and a server.
- * <p/>
- * It allows multiple {@link org.hornetq.core.protocol.core.Channel}'s to be created and data multiplexed over them. It uses
- * and a {@link Connection} implementation and takes care of failures etc.
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- */
-public interface RemotingConnection extends BufferHandler
-{
- /**
- * returns the unique id of the Remoting Connection
- *
- * @return the id
- */
- Object getID();
-
- /**
- * returns a string representation of the remote address of this connection
- *
- * @return the remote address
- */
- String getRemoteAddress();
-
- /**
- * add a failure listener.
- * <p/>
- * The listener will be called in the event of connection failure.
- *
- * @param listener the listener
- */
- void addFailureListener(FailureListener listener);
-
- /**
- * remove the failure listener
- *
- * @param listener the lister to remove
- * @return true if removed
- */
- boolean removeFailureListener(FailureListener listener);
-
- /**
- * add a CloseListener.
- * <p/>
- * This will be called in the event of the connection being closed.
- *
- * @param listener the listener to add
- */
- void addCloseListener(CloseListener listener);
-
- /**
- * remove a Close Listener
- *
- * @param listener the listener to remove
- * @return true if removed
- */
- boolean removeCloseListener(CloseListener listener);
-
- /**
- * return all the failure listeners
- *
- * @return the listeners
- */
- List<FailureListener> getFailureListeners();
-
- /**
- * set the failure listeners.
- * <p/>
- * These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.
- *
- * @param listeners the listeners to add.
- */
- void setFailureListeners(List<FailureListener> listeners);
-
- /**
- * creates a new HornetQBuffer of the specified size.
- *
- * @param size the size of buffer required
- * @return the buffer
- */
- HornetQBuffer createBuffer(int size);
-
- /**
- * called when the underlying connection fails.
- *
- * @param me the exception that caused the failure
- */
- void fail(HornetQException me);
-
- /**
- * destroys this connection.
- */
- void destroy();
-
- /**
- * return the underlying Connection.
- *
- * @return the connection
- */
- Connection getTransportConnection();
-
- /**
- * returns whether or not the Remoting Connection is a client
- *
- * @return true if client, false if a server
- */
- boolean isClient();
-
- /**
- * returns true if this Remoting Connection has been destroyed.
- *
- * @return true if destroyed, otherwise false
- */
- boolean isDestroyed();
-
- /**
- * Disconnect the connection, closing all channels
- */
- void disconnect();
-
- /**
- * returns true if any data has been received since the last time this method was called.
- *
- * @return true if data has been received.
- */
- boolean checkDataReceived();
-
- /**
- * flush all outstanding data from the connection.
- */
- void flush();
-
-}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -21,10 +21,10 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.management.NotificationType;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.server.management.NotificationService;
import org.hornetq.integration.transports.netty.ServerHolder;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
@@ -60,6 +60,8 @@
private NotificationService notificationService;
+ private final ProtocolType protocol;
+
public InVMAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
final ServerHolder holder,
@@ -72,6 +74,11 @@
id = ConfigurationHelper.getIntProperty(TransportConstants.SERVER_ID_PROP_NAME, 0, configuration);
+ String protocolStr = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOL_PROP_NAME,
+ TransportConstants.DEFAULT_PROTOCOL,
+ configuration);
+ this.protocol = ProtocolType.valueOf(protocolStr);
+
executorFactory = new OrderedExecutorFactory(threadPool);
}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -18,8 +18,8 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketDecoder;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.core.protocol.core.impl.PacketDecoder;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -19,7 +19,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -16,6 +16,8 @@
import java.util.HashSet;
import java.util.Set;
+import org.hornetq.spi.core.protocol.ProtocolType;
+
/**
* A TransportConstants
*
@@ -26,6 +28,10 @@
{
public static final String SERVER_ID_PROP_NAME = "server-id";
+ public static final String PROTOCOL_PROP_NAME = "protocol";
+
+ public static final String DEFAULT_PROTOCOL = ProtocolType.CORE.toString();
+
public static final Set<String> ALLOWABLE_CONNECTOR_KEYS;
public static final Set<String> ALLOWABLE_ACCEPTOR_KEYS;
@@ -34,11 +40,13 @@
{
Set<String> allowableAcceptorKeys = new HashSet<String>();
allowableAcceptorKeys.add(TransportConstants.SERVER_ID_PROP_NAME);
+ allowableAcceptorKeys.add(TransportConstants.PROTOCOL_PROP_NAME);
ALLOWABLE_CONNECTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys);
Set<String> allowableConnectorKeys = new HashSet<String>();
allowableConnectorKeys.add(TransportConstants.SERVER_ID_PROP_NAME);
+ allowableConnectorKeys.add(TransportConstants.PROTOCOL_PROP_NAME);
ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableConnectorKeys);
}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,41 +0,0 @@
-/*
- * Copyright 2010 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.server;
-
-import org.hornetq.core.remoting.RemotingConnection;
-
-/**
- * A ConnectionEntry
- *
- * @author Tim Fox
- *
- *
- */
-public class ConnectionEntry
-{
- public final RemotingConnection connection;
-
- public volatile long lastCheck;
-
- public volatile long ttl;
-
- public ConnectionEntry(final RemotingConnection connection, final long lastCheck, final long ttl)
- {
- this.connection = connection;
-
- this.lastCheck = lastCheck;
-
- this.ttl = ttl;
- }
-}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/ProtocolManager.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/ProtocolManager.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/ProtocolManager.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,31 +0,0 @@
-/*
- * Copyright 2010 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.server;
-
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A ProtocolManager
- *
- * @author Tim Fox
- *
- *
- */
-public interface ProtocolManager
-{
- ConnectionEntry createConnectionEntry(Connection connection);
-
- void removeHandler(String name);
-
-}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/RemotingService.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/RemotingService.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/RemotingService.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -16,8 +16,8 @@
import java.util.Set;
import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HornetQComponent;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
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-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -28,15 +28,16 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.CoreProtocolManager;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.RemotingConnection;
-import org.hornetq.core.remoting.server.ConnectionEntry;
-import org.hornetq.core.remoting.server.ProtocolManager;
+import org.hornetq.core.protocol.aardvark.impl.AardvarkProtocolManagerFactory;
+import org.hornetq.core.protocol.core.impl.CoreProtocolManagerFactory;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.management.ManagementService;
import org.hornetq.integration.transports.netty.ServerHolder;
+import org.hornetq.spi.core.protocol.ConnectionEntry;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.ProtocolType;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.AcceptorFactory;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -70,7 +71,7 @@
private final Map<Object, ConnectionEntry> connections = new ConcurrentHashMap<Object, ConnectionEntry>();
- private final BufferHandler bufferHandler = new DelegatingBufferHandler();
+ //private final BufferHandler bufferHandler = new DelegatingBufferHandler();
private final Configuration config;
@@ -122,7 +123,8 @@
this.threadPool = threadPool;
this.scheduledThreadPool = scheduledThreadPool;
- this.protocolMap.put(ProtocolType.CORE, new CoreProtocolManager(server, interceptors));
+ this.protocolMap.put(ProtocolType.CORE, new CoreProtocolManagerFactory().createProtocolManager(server, interceptors));
+ this.protocolMap.put(ProtocolType.AARDVARK, new AardvarkProtocolManagerFactory().createProtocolManager(server, interceptors));
}
// RemotingService implementation -------------------------------
@@ -159,9 +161,15 @@
continue;
}
}
+
+ //TODO - allow protocol type to be configured from Configuration for each acceptor
+ ProtocolType protocol = hackProtocol;
+
+ ProtocolManager manager = protocolMap.get(protocol);
+
Acceptor acceptor = factory.createAcceptor(info.getParams(),
- bufferHandler,
+ new DelegatingBufferHandler(manager),
new ServerHolder()
{
public HornetQServer getServer()
@@ -214,6 +222,9 @@
started = true;
}
+
+ //FIXME - temp hack so we can choose AARDVARK as protocol
+ public static ProtocolType hackProtocol = ProtocolType.CORE;
public synchronized void freeze()
{
@@ -399,6 +410,13 @@
private final class DelegatingBufferHandler implements BufferHandler
{
+ private ProtocolManager manager;
+
+ DelegatingBufferHandler(final ProtocolManager manager)
+ {
+ this.manager = manager;
+ }
+
public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
{
ConnectionEntry conn = connections.get(connectionID);
@@ -408,6 +426,11 @@
conn.connection.bufferReceived(connectionID, buffer);
}
}
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ return manager.isReadyToHandle(buffer);
+ }
}
private final class FailureCheckAndFlushThread extends Thread
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -30,22 +30,22 @@
import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.protocol.core.Channel;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationResponseMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationResponseMessage;
import org.hornetq.core.replication.ReplicationEndpoint;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.LargeServerMessage;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -33,20 +33,20 @@
import org.hornetq.core.protocol.core.ChannelHandler;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPrepareMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
import org.hornetq.core.replication.ReplicationManager;
import org.hornetq.utils.ExecutorFactory;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/HornetQServer.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/HornetQServer.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/HornetQServer.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -24,7 +24,6 @@
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.replication.ReplicationEndpoint;
import org.hornetq.core.security.Role;
@@ -35,6 +34,8 @@
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.core.version.Version;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.protocol.SessionCallback;
import org.hornetq.spi.core.security.HornetQSecurityManager;
import org.hornetq.utils.ExecutorFactory;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/ServerSession.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/ServerSession.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/ServerSession.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -18,6 +18,7 @@
import javax.transaction.xa.Xid;
import org.hornetq.api.core.SimpleString;
+import org.hornetq.spi.core.protocol.SessionCallback;
/**
*
@@ -85,7 +86,7 @@
void deleteQueue(SimpleString name) throws Exception;
- void createConsumer(long consumerID, SimpleString name, SimpleString filterString, boolean browseOnly) throws Exception;
+ void createConsumer(long consumerID, SimpleString queueName, SimpleString filterString, boolean browseOnly) throws Exception;
QueueQueryResult executeQueueQuery(SimpleString name) throws Exception;
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/SessionCallback.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/SessionCallback.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/SessionCallback.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,36 +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.server;
-
-import org.hornetq.api.core.SimpleString;
-
-/**
- * A SessionCallback
- *
- * @author Tim Fox
- *
- *
- */
-public interface SessionCallback
-{
- void sendProducerCreditsMessage(int credits, SimpleString address, int offset);
-
- int sendMessage(ServerMessage message, long consumerID, int deliveryCount);
-
- int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount);
-
- int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse);
-
- void closed();
-}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/cluster/Bridge.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/cluster/Bridge.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/cluster/Bridge.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -14,11 +14,11 @@
package org.hornetq.core.server.cluster;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.Consumer;
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A Core Bridge
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -36,7 +36,6 @@
import org.hornetq.core.message.impl.MessageImpl;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.BindingType;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HandleStatus;
import org.hornetq.core.server.MessageReference;
import org.hornetq.core.server.Queue;
@@ -46,6 +45,7 @@
import org.hornetq.core.server.cluster.Transformer;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.Future;
import org.hornetq.utils.TypedProperties;
import org.hornetq.utils.UUID;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -69,7 +69,6 @@
import org.hornetq.core.postoffice.impl.LocalQueueBinding;
import org.hornetq.core.postoffice.impl.PostOfficeImpl;
import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
import org.hornetq.core.replication.ReplicationEndpoint;
@@ -87,7 +86,6 @@
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.QueueFactory;
import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.SessionCallback;
import org.hornetq.core.server.cluster.ClusterManager;
import org.hornetq.core.server.cluster.DivertConfiguration;
import org.hornetq.core.server.cluster.QueueConfiguration;
@@ -107,6 +105,8 @@
import org.hornetq.core.transaction.impl.ResourceManagerImpl;
import org.hornetq.core.version.Version;
import org.hornetq.spi.core.logging.LogDelegateFactory;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.protocol.SessionCallback;
import org.hornetq.spi.core.security.HornetQSecurityManager;
import org.hornetq.utils.ExecutorFactory;
import org.hornetq.utils.HornetQThreadFactory;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -39,11 +39,11 @@
import org.hornetq.core.server.ServerConsumer;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.SessionCallback;
import org.hornetq.core.server.management.ManagementService;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.transaction.Transaction;
import org.hornetq.core.transaction.impl.TransactionImpl;
+import org.hornetq.spi.core.protocol.SessionCallback;
import org.hornetq.utils.Future;
import org.hornetq.utils.TypedProperties;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -21,7 +21,6 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.impl.MessageImpl;
import org.hornetq.core.paging.PagingStore;
-import org.hornetq.core.protocol.core.PacketImpl;
import org.hornetq.core.server.MessageReference;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.ServerMessage;
@@ -313,7 +312,7 @@
{
// We first set the message id - this needs to be set on the buffer since this buffer will be re-used
- buffer.setLong(buffer.getInt(PacketImpl.PACKET_HEADERS_SIZE) + DataConstants.SIZE_INT, messageID);
+ buffer.setLong(buffer.getInt(MessageImpl.BUFFER_HEADER_SPACE) + DataConstants.SIZE_INT, messageID);
}
}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -44,7 +44,6 @@
import org.hornetq.core.postoffice.QueueBinding;
import org.hornetq.core.remoting.CloseListener;
import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.security.CheckType;
import org.hornetq.core.security.SecurityStore;
import org.hornetq.core.server.BindingQueryResult;
@@ -57,12 +56,13 @@
import org.hornetq.core.server.ServerConsumer;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.SessionCallback;
import org.hornetq.core.server.management.ManagementService;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.core.transaction.Transaction;
import org.hornetq.core.transaction.impl.TransactionImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.protocol.SessionCallback;
import org.hornetq.utils.TypedProperties;
/*
@@ -283,15 +283,15 @@
}
public void createConsumer(final long consumerID,
- final SimpleString name,
+ final SimpleString queueName,
final SimpleString filterString,
final boolean browseOnly) throws Exception
{
- Binding binding = postOffice.getBinding(name);
+ Binding binding = postOffice.getBinding(queueName);
if (binding == null || binding.getType() != BindingType.LOCAL_QUEUE)
{
- throw new HornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, "Queue " + name + " does not exist");
+ throw new HornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, "Queue " + queueName + " does not exist");
}
securityStore.check(binding.getAddress(), CheckType.CONSUME, this);
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompChannelHandler.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompChannelHandler.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompChannelHandler.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -26,7 +26,6 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.server.ServerSession;
@@ -36,6 +35,7 @@
import org.hornetq.integration.transports.netty.ServerHolder;
import org.hornetq.jms.client.HornetQBytesMessage;
import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
import org.hornetq.utils.UUIDGenerator;
import org.jboss.netty.channel.ChannelHandlerContext;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompSessionCallback.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompSessionCallback.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/protocol/stomp/StompSessionCallback.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -18,10 +18,10 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.ServerMessage;
-import org.hornetq.core.server.SessionCallback;
import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.protocol.SessionCallback;
/**
* A StompSessionCallback
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -16,6 +16,7 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.ssl.SslHandler;
@@ -44,10 +45,21 @@
// Public --------------------------------------------------------
- public static void addHornetQCodecFilter(final ChannelPipeline pipeline, final BufferHandler handler)
+ public static void addCodecFilter(final ProtocolType protocol, final ChannelPipeline pipeline, final BufferHandler handler)
{
assert pipeline != null;
- pipeline.addLast("decoder", new HornetQFrameDecoder2());
+
+ if (protocol == ProtocolType.CORE)
+ {
+ pipeline.addLast("decoder", new HornetQFrameDecoder2());
+ }
+ else
+ {
+
+ // FIXME
+ //Use the old frame decoder for other protocols
+ //pipeline.addLast("decoder", new HornetQFrameDecoder(handler));
+ }
}
public static void addSSLFilter(final ChannelPipeline pipeline, final SSLContext context, final boolean client) throws Exception
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -32,13 +32,13 @@
import org.hornetq.api.core.management.NotificationType;
import org.hornetq.core.buffers.impl.ChannelBufferWrapper;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.core.remoting.impl.ssl.SSLSupport;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.server.management.NotificationService;
import org.hornetq.integration.protocol.stomp.StompChannelHandler;
+import org.hornetq.integration.protocol.stomp.StompFrameDecoder;
import org.hornetq.integration.protocol.stomp.StompFrameDelimiter;
-import org.hornetq.integration.protocol.stomp.StompFrameDecoder;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
@@ -104,7 +104,7 @@
private final boolean useInvm;
- private final String protocol;
+ private final ProtocolType protocol;
private final String host;
@@ -133,6 +133,8 @@
private NotificationService notificationService;
private VirtualExecutorService bossExecutor;
+
+ private boolean paused;
private ServerHolder serverHolder;
@@ -148,7 +150,7 @@
this.serverHolder = serverHandler;
this.listener = listener;
-
+
sslEnabled = ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME,
TransportConstants.DEFAULT_SSL_ENABLED,
configuration);
@@ -185,9 +187,11 @@
useInvm = ConfigurationHelper.getBooleanProperty(TransportConstants.USE_INVM_PROP_NAME,
TransportConstants.DEFAULT_USE_INVM,
configuration);
- protocol = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOL_PROP_NAME,
+ String protocolStr = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOL_PROP_NAME,
TransportConstants.DEFAULT_PROTOCOL,
configuration);
+ protocol = ProtocolType.valueOf(protocolStr);
+
host = ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME,
TransportConstants.DEFAULT_HOST,
configuration);
@@ -291,7 +295,7 @@
pipeline.addLast("httpResponseEncoder", new HttpResponseEncoder());
pipeline.addLast("httphandler", new HttpAcceptorHandler(httpKeepAliveRunnable, httpResponseTime));
}
- if (protocol.equals(TransportConstants.STOMP_PROTOCOL))
+ if (protocol == ProtocolType.STOMP)
{
pipeline.addLast("delimiter", new StompFrameDelimiter());
pipeline.addLast("codec", new StompFrameDecoder());
@@ -302,10 +306,9 @@
}
else
{
- ChannelPipelineSupport.addHornetQCodecFilter(pipeline, handler);
+ ChannelPipelineSupport.addCodecFilter(ProtocolType.CORE, pipeline, handler);
pipeline.addLast("handler", new HornetQServerChannelHandler(channelGroup, handler, new Listener()));
}
-
return pipeline;
}
};
@@ -443,8 +446,6 @@
return channelFactory != null;
}
- private boolean paused;
-
public void pause()
{
if (paused)
@@ -477,7 +478,6 @@
bossExecutor.shutdown();
try
{
-
bossExecutor.awaitTermination(30, TimeUnit.SECONDS);
}
catch (InterruptedException e)
@@ -532,7 +532,7 @@
throw new IllegalArgumentException("Connection already exists with id " + connection.getID());
}
- listener.connectionCreated(connection, protocol);
+ listener.connectionCreated(connection, NettyAcceptor.this.protocol);
}
public void connectionDestroyed(final Object connectionID)
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -18,6 +18,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.AcceptorFactory;
import org.hornetq.spi.core.remoting.BufferHandler;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyConnection.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyConnection.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyConnection.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -16,7 +16,7 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.buffers.impl.ChannelBufferWrapper;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
import org.jboss.netty.buffer.ChannelBuffers;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -31,9 +31,9 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.buffers.impl.ChannelBufferWrapper;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketDecoder;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.core.protocol.core.impl.PacketDecoder;
import org.hornetq.core.remoting.impl.ssl.SSLSupport;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -315,7 +315,7 @@
pipeline.addLast("httpResponseDecoder", new HttpResponseDecoder());
pipeline.addLast("httphandler", new HttpHandler());
}
- ChannelPipelineSupport.addHornetQCodecFilter(pipeline, handler);
+ ChannelPipelineSupport.addCodecFilter(ProtocolType.CORE, pipeline, handler);
pipeline.addLast("handler", new HornetQClientChannelHandler(channelGroup, handler, new Listener()));
return pipeline;
}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ServerHolder.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ServerHolder.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/ServerHolder.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -13,8 +13,8 @@
package org.hornetq.integration.transports.netty;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A ServerHolder
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/TransportConstants.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/TransportConstants.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/integration/transports/netty/TransportConstants.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -16,6 +16,8 @@
import java.util.HashSet;
import java.util.Set;
+import org.hornetq.spi.core.protocol.ProtocolType;
+
/**
* A TransportConstants
*
@@ -77,12 +79,8 @@
public static final boolean DEFAULT_USE_SERVLET = false;
- public static final String HORNETQ_PROTOCOL = "hornetq";
+ public static final String DEFAULT_PROTOCOL = ProtocolType.CORE.toString();
- public static final String STOMP_PROTOCOL = "stomp";
-
- public static final String DEFAULT_PROTOCOL = HORNETQ_PROTOCOL;
-
public static final String DEFAULT_HOST = "localhost";
public static final int DEFAULT_PORT = 5445;
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol (from rev 8832, trunk/src/main/org/hornetq/spi/core/protocol)
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,40 +0,0 @@
-/*
- * Copyright 2010 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.spi.core.protocol;
-
-
-/**
- * A ConnectionEntry
- *
- * @author Tim Fox
- *
- *
- */
-public class ConnectionEntry
-{
- public final RemotingConnection connection;
-
- public volatile long lastCheck;
-
- public volatile long ttl;
-
- public ConnectionEntry(final RemotingConnection connection, final long lastCheck, final long ttl)
- {
- this.connection = connection;
-
- this.lastCheck = lastCheck;
-
- this.ttl = ttl;
- }
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java (from rev 8832, trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2010 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.spi.core.protocol;
+
+
+/**
+ * A ConnectionEntry
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class ConnectionEntry
+{
+ public final RemotingConnection connection;
+
+ public volatile long lastCheck;
+
+ public volatile long ttl;
+
+ public ConnectionEntry(final RemotingConnection connection, final long lastCheck, final long ttl)
+ {
+ this.connection = connection;
+
+ this.lastCheck = lastCheck;
+
+ this.ttl = ttl;
+ }
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,29 +0,0 @@
-/*
- * Copyright 2010 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.spi.core.protocol;
-
-import org.hornetq.spi.core.remoting.BufferHandler;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A ProtocolManager
- *
- * @author Tim Fox
- *
- *
- */
-public interface ProtocolManager extends BufferHandler
-{
- ConnectionEntry createConnectionEntry(Connection connection);
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java (from rev 8832, trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010 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.spi.core.protocol;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.spi.core.remoting.BufferHandler;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A ProtocolManager
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public interface ProtocolManager extends BufferHandler
+{
+ ConnectionEntry createConnectionEntry(Connection connection);
+
+ public void removeHandler(final String name);
+
+ public int isReadyToHandle(HornetQBuffer buffer);
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,31 +0,0 @@
-/*
- * Copyright 2010 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.spi.core.protocol;
-
-import java.util.List;
-
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.server.HornetQServer;
-
-/**
- * A ProtocolManagerFactory
- *
- * @author tim
- *
- *
- */
-public interface ProtocolManagerFactory
-{
- ProtocolManager createProtocolManager(HornetQServer server, List<Interceptor> interceptors);
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java (from rev 8832, trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2010 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.spi.core.protocol;
+
+import java.util.List;
+
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.server.HornetQServer;
+
+/**
+ * A ProtocolManagerFactory
+ *
+ * @author tim
+ *
+ *
+ */
+public interface ProtocolManagerFactory
+{
+ ProtocolManager createProtocolManager(HornetQServer server, List<Interceptor> interceptors);
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolType.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolType.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,26 +0,0 @@
-/*
- * Copyright 2010 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.spi.core.protocol;
-
-/**
- * A ProtocolType
- *
- * @author Tim Fox
- *
- *
- */
-public enum ProtocolType
-{
- CORE, STOMP, AMQP, AARDVARK;
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolType.java (from rev 8832, trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolType.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/ProtocolType.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2010 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.spi.core.protocol;
+
+/**
+ * A ProtocolType
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public enum ProtocolType
+{
+ CORE, STOMP, AMQP, AARDVARK;
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,155 +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.spi.core.protocol;
-
-import java.util.List;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.spi.core.remoting.BufferHandler;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A RemotingConnection is a connection between a client and a server.
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- */
-public interface RemotingConnection extends BufferHandler
-{
- /**
- * returns the unique id of the Remoting Connection
- *
- * @return the id
- */
- Object getID();
-
- /**
- * returns a string representation of the remote address of this connection
- *
- * @return the remote address
- */
- String getRemoteAddress();
-
- /**
- * add a failure listener.
- * <p/>
- * The listener will be called in the event of connection failure.
- *
- * @param listener the listener
- */
- void addFailureListener(FailureListener listener);
-
- /**
- * remove the failure listener
- *
- * @param listener the lister to remove
- * @return true if removed
- */
- boolean removeFailureListener(FailureListener listener);
-
- /**
- * add a CloseListener.
- * <p/>
- * This will be called in the event of the connection being closed.
- *
- * @param listener the listener to add
- */
- void addCloseListener(CloseListener listener);
-
- /**
- * remove a Close Listener
- *
- * @param listener the listener to remove
- * @return true if removed
- */
- boolean removeCloseListener(CloseListener listener);
-
- /**
- * return all the failure listeners
- *
- * @return the listeners
- */
- List<FailureListener> getFailureListeners();
-
- /**
- * set the failure listeners.
- * <p/>
- * These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.
- *
- * @param listeners the listeners to add.
- */
- void setFailureListeners(List<FailureListener> listeners);
-
- /**
- * creates a new HornetQBuffer of the specified size.
- *
- * @param size the size of buffer required
- * @return the buffer
- */
- HornetQBuffer createBuffer(int size);
-
- /**
- * called when the underlying connection fails.
- *
- * @param me the exception that caused the failure
- */
- void fail(HornetQException me);
-
- /**
- * destroys this connection.
- */
- void destroy();
-
- /**
- * return the underlying Connection.
- *
- * @return the connection
- */
- Connection getTransportConnection();
-
- /**
- * returns whether or not the Remoting Connection is a client
- *
- * @return true if client, false if a server
- */
- boolean isClient();
-
- /**
- * returns true if this Remoting Connection has been destroyed.
- *
- * @return true if destroyed, otherwise false
- */
- boolean isDestroyed();
-
- /**
- * Disconnect the connection, closing all channels
- */
- void disconnect();
-
- /**
- * returns true if any data has been received since the last time this method was called.
- *
- * @return true if data has been received.
- */
- boolean checkDataReceived();
-
- /**
- * flush all outstanding data from the connection.
- */
- void flush();
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java (from rev 8832, trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,155 @@
+/*
+ * 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.spi.core.protocol;
+
+import java.util.List;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.remoting.CloseListener;
+import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.remoting.BufferHandler;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A RemotingConnection is a connection between a client and a server.
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ */
+public interface RemotingConnection extends BufferHandler
+{
+ /**
+ * returns the unique id of the Remoting Connection
+ *
+ * @return the id
+ */
+ Object getID();
+
+ /**
+ * returns a string representation of the remote address of this connection
+ *
+ * @return the remote address
+ */
+ String getRemoteAddress();
+
+ /**
+ * add a failure listener.
+ * <p/>
+ * The listener will be called in the event of connection failure.
+ *
+ * @param listener the listener
+ */
+ void addFailureListener(FailureListener listener);
+
+ /**
+ * remove the failure listener
+ *
+ * @param listener the lister to remove
+ * @return true if removed
+ */
+ boolean removeFailureListener(FailureListener listener);
+
+ /**
+ * add a CloseListener.
+ * <p/>
+ * This will be called in the event of the connection being closed.
+ *
+ * @param listener the listener to add
+ */
+ void addCloseListener(CloseListener listener);
+
+ /**
+ * remove a Close Listener
+ *
+ * @param listener the listener to remove
+ * @return true if removed
+ */
+ boolean removeCloseListener(CloseListener listener);
+
+ /**
+ * return all the failure listeners
+ *
+ * @return the listeners
+ */
+ List<FailureListener> getFailureListeners();
+
+ /**
+ * set the failure listeners.
+ * <p/>
+ * These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.
+ *
+ * @param listeners the listeners to add.
+ */
+ void setFailureListeners(List<FailureListener> listeners);
+
+ /**
+ * creates a new HornetQBuffer of the specified size.
+ *
+ * @param size the size of buffer required
+ * @return the buffer
+ */
+ HornetQBuffer createBuffer(int size);
+
+ /**
+ * called when the underlying connection fails.
+ *
+ * @param me the exception that caused the failure
+ */
+ void fail(HornetQException me);
+
+ /**
+ * destroys this connection.
+ */
+ void destroy();
+
+ /**
+ * return the underlying Connection.
+ *
+ * @return the connection
+ */
+ Connection getTransportConnection();
+
+ /**
+ * returns whether or not the Remoting Connection is a client
+ *
+ * @return true if client, false if a server
+ */
+ boolean isClient();
+
+ /**
+ * returns true if this Remoting Connection has been destroyed.
+ *
+ * @return true if destroyed, otherwise false
+ */
+ boolean isDestroyed();
+
+ /**
+ * Disconnect the connection, closing all channels
+ */
+ void disconnect();
+
+ /**
+ * returns true if any data has been received since the last time this method was called.
+ *
+ * @return true if data has been received.
+ */
+ boolean checkDataReceived();
+
+ /**
+ * flush all outstanding data from the connection.
+ */
+ void flush();
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/SessionCallback.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/SessionCallback.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -1,37 +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.spi.core.protocol;
-
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.server.ServerMessage;
-
-/**
- * A SessionCallback
- *
- * @author Tim Fox
- *
- *
- */
-public interface SessionCallback
-{
- void sendProducerCreditsMessage(int credits, SimpleString address, int offset);
-
- int sendMessage(ServerMessage message, long consumerID, int deliveryCount);
-
- int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount);
-
- int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse);
-
- void closed();
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/SessionCallback.java (from rev 8832, trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/SessionCallback.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/protocol/SessionCallback.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,37 @@
+/*
+ * 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.spi.core.protocol;
+
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.server.ServerMessage;
+
+/**
+ * A SessionCallback
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public interface SessionCallback
+{
+ void sendProducerCreditsMessage(int credits, SimpleString address, int offset);
+
+ int sendMessage(ServerMessage message, long consumerID, int deliveryCount);
+
+ int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount);
+
+ int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse);
+
+ void closed();
+}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java 2010-01-22 10:19:02 UTC (rev 8835)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -13,7 +13,7 @@
package org.hornetq.spi.core.remoting;
import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
/**
* A ConnectionLifeCycleListener is called by the remoting implementation to notify of connection events.
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/utils/XidCodecSupport.java (from rev 8832, trunk/src/main/org/hornetq/utils/XidCodecSupport.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/utils/XidCodecSupport.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/utils/XidCodecSupport.java 2010-01-22 10:29:26 UTC (rev 8836)
@@ -0,0 +1,72 @@
+/*
+ * 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.utils;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.transaction.impl.XidImpl;
+
+/**
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class XidCodecSupport
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ public static void encodeXid(final Xid xid, final HornetQBuffer out)
+ {
+ out.writeInt(xid.getFormatId());
+ out.writeInt(xid.getBranchQualifier().length);
+ out.writeBytes(xid.getBranchQualifier());
+ out.writeInt(xid.getGlobalTransactionId().length);
+ out.writeBytes(xid.getGlobalTransactionId());
+ }
+
+ public static Xid decodeXid(final HornetQBuffer in)
+ {
+ int formatID = in.readInt();
+ byte[] bq = new byte[in.readInt()];
+ in.readBytes(bq);
+ byte[] gtxid = new byte[in.readInt()];
+ in.readBytes(gtxid);
+ Xid xid = new XidImpl(bq, formatID, gtxid);
+ return xid;
+ }
+
+ public static int getXidEncodeLength(final Xid xid)
+ {
+ return DataConstants.SIZE_INT * 3 + xid.getBranchQualifier().length + xid.getGlobalTransactionId().length;
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
14 years, 11 months
JBoss hornetq SVN: r8835 - in branches/HORNETQ-129_STOMP_protocol: src/main/org/hornetq/api/core and 7 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-01-22 05:19:02 -0500 (Fri, 22 Jan 2010)
New Revision: 8835
Added:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java
Removed:
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java
Modified:
branches/HORNETQ-129_STOMP_protocol/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/api/core/Interceptor.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/DelegatingSession.java
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/LargeMessageBufferImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/message/impl/MessageImpl.java
branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* sync with the trunk: svn merge -r 8821:8832 https://svn.jboss.org/repos/hornetq/trunk
Modified: branches/HORNETQ-129_STOMP_protocol/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -18,8 +18,8 @@
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A simple Interceptor implementation
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/api/core/Interceptor.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/api/core/Interceptor.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/api/core/Interceptor.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -15,7 +15,7 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* This is class is a simple way to intercepting calls on HornetQ client and servers.
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -26,11 +26,11 @@
import org.hornetq.core.list.impl.PriorityLinkedListImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
import org.hornetq.utils.Future;
import org.hornetq.utils.TokenBucketLimiter;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -17,9 +17,9 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
/**
*
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -25,9 +25,9 @@
import org.hornetq.core.message.BodyEncoder;
import org.hornetq.core.message.impl.MessageInternal;
import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
import org.hornetq.utils.TokenBucketLimiter;
import org.hornetq.utils.UUIDGenerator;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -37,43 +37,43 @@
import org.hornetq.core.protocol.core.CommandConfirmationHandler;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAStartMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.utils.ConcurrentHashSet;
import org.hornetq.utils.IDGenerator;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -17,10 +17,10 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A ClientSessionInternal
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -13,21 +13,21 @@
package org.hornetq.core.client.impl;
-import static org.hornetq.core.protocol.core.PacketImpl.EXCEPTION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_LARGE_MSG;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.EXCEPTION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_LARGE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_MSG;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Channel;
import org.hornetq.core.protocol.core.ChannelHandler;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
/**
*
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/DelegatingSession.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/DelegatingSession.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/DelegatingSession.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -28,10 +28,10 @@
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.ConcurrentHashSet;
/**
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-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -39,15 +39,15 @@
import org.hornetq.core.protocol.core.ChannelHandler;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketDecoder;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.Ping;
+import org.hornetq.core.protocol.core.impl.PacketDecoder;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.Ping;
import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.core.version.Version;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -30,7 +30,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
import org.hornetq.utils.DataConstants;
import org.hornetq.utils.UTF8Util;
import org.jboss.netty.buffer.ChannelBuffer;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -46,7 +46,6 @@
import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.PostOffice;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.JournalType;
@@ -54,6 +53,7 @@
import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.core.transaction.Transaction;
import org.hornetq.core.transaction.impl.XidImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/message/impl/MessageImpl.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/message/impl/MessageImpl.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/message/impl/MessageImpl.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -27,7 +27,7 @@
import org.hornetq.core.client.impl.LargeMessageBufferInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.BodyEncoder;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.utils.DataConstants;
import org.hornetq.utils.TypedProperties;
@@ -48,10 +48,12 @@
public abstract class MessageImpl implements MessageInternal
{
// Constants -----------------------------------------------------
-
+
private static final Logger log = Logger.getLogger(MessageImpl.class);
public static final SimpleString HDR_ROUTE_TO_IDS = new SimpleString("_HQ_ROUTE_TO");
+
+ public static final int BUFFER_HEADER_SPACE = PacketImpl.PACKET_HEADERS_SIZE;
protected long messageID;
@@ -165,7 +167,7 @@
int bodyPos = endOfBodyPosition == -1 ? buffer.writerIndex() : endOfBodyPosition;
- int bodySize = bodyPos - PacketImpl.PACKET_HEADERS_SIZE - DataConstants.SIZE_INT;
+ int bodySize = bodyPos - BUFFER_HEADER_SPACE - DataConstants.SIZE_INT;
return DataConstants.SIZE_INT + bodySize + DataConstants.SIZE_INT + headersPropsSize;
}
@@ -212,7 +214,7 @@
{
if (buffer instanceof LargeMessageBufferInternal == false)
{
- bodyBuffer = new ResetLimitWrappedHornetQBuffer(PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT,
+ bodyBuffer = new ResetLimitWrappedHornetQBuffer(BUFFER_HEADER_SPACE + DataConstants.SIZE_INT,
buffer,
this);
}
@@ -393,7 +395,7 @@
{
encodeToBuffer();
- buff.writeBytes(buffer, PacketImpl.PACKET_HEADERS_SIZE, endOfMessagePosition - PacketImpl.PACKET_HEADERS_SIZE);
+ buff.writeBytes(buffer, BUFFER_HEADER_SPACE, endOfMessagePosition - BUFFER_HEADER_SPACE);
}
// Decode from journal or paging
@@ -403,11 +405,11 @@
endOfBodyPosition = buff.readInt();
- endOfMessagePosition = buff.getInt(endOfBodyPosition - PacketImpl.PACKET_HEADERS_SIZE + start);
+ endOfMessagePosition = buff.getInt(endOfBodyPosition - BUFFER_HEADER_SPACE + start);
- int length = endOfMessagePosition - PacketImpl.PACKET_HEADERS_SIZE;
+ int length = endOfMessagePosition - BUFFER_HEADER_SPACE;
- buffer.setIndex(0, PacketImpl.PACKET_HEADERS_SIZE);
+ buffer.setIndex(0, BUFFER_HEADER_SPACE);
buffer.writeBytes(buff, start, length);
@@ -825,7 +827,7 @@
}
// write it
- buffer.setInt(PacketImpl.PACKET_HEADERS_SIZE, endOfBodyPosition);
+ buffer.setInt(BUFFER_HEADER_SPACE, endOfBodyPosition);
// Position at end of body and skip past the message end position int.
// check for enough room in the buffer even tho it is dynamic
@@ -855,7 +857,7 @@
private void decode()
{
- endOfBodyPosition = buffer.getInt(PacketImpl.PACKET_HEADERS_SIZE);
+ endOfBodyPosition = buffer.getInt(BUFFER_HEADER_SPACE);
buffer.readerIndex(endOfBodyPosition + DataConstants.SIZE_INT);
@@ -873,7 +875,7 @@
// There's a bug in netty which means a dynamic buffer won't resize until you write a byte
buffer.writeByte((byte)0);
- int limit = PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT;
+ int limit = BUFFER_HEADER_SPACE + DataConstants.SIZE_INT;
buffer.setIndex(limit, limit);
}
Modified: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-01-22 10:16:25 UTC (rev 8834)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -55,7 +55,6 @@
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.PostOffice;
-import org.hornetq.core.protocol.core.wireformat.XidCodecSupport;
import org.hornetq.core.replication.ReplicationManager;
import org.hornetq.core.replication.impl.ReplicatedJournal;
import org.hornetq.core.server.JournalType;
@@ -74,6 +73,7 @@
import org.hornetq.utils.DataConstants;
import org.hornetq.utils.ExecutorFactory;
import org.hornetq.utils.UUID;
+import org.hornetq.utils.XidCodecSupport;
/**
*
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark (from rev 8832, trunk/src/main/org/hornetq/core/protocol/aardvark)
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl (from rev 8832, trunk/src/main/org/hornetq/core/protocol/aardvark/impl)
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -1,139 +0,0 @@
-/*
- * Copyright 2010 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.protocol.aardvark.impl;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQBuffers;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.spi.core.protocol.RemotingConnection;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A AardvarkConnection
- *
- * @author Tim Fox
- *
- *
- */
-public class AardvarkConnection implements RemotingConnection
-{
- private static final Logger log = Logger.getLogger(AardvarkConnection.class);
-
- private final AardvarkProtocolManager manager;
-
- private final Connection transportConnection;
-
- AardvarkConnection(final Connection transportConnection, final AardvarkProtocolManager manager)
- {
- this.transportConnection = transportConnection;
-
- this.manager = manager;
- }
-
- public void addCloseListener(CloseListener listener)
- {
- }
-
- public void addFailureListener(FailureListener listener)
- {
- }
-
- public boolean checkDataReceived()
- {
- return true;
- }
-
- public HornetQBuffer createBuffer(int size)
- {
- return HornetQBuffers.dynamicBuffer(size);
- }
-
- public void destroy()
- {
- }
-
- public void disconnect()
- {
- }
-
- public void fail(HornetQException me)
- {
- }
-
- public void flush()
- {
- }
-
- public List<FailureListener> getFailureListeners()
- {
- return Collections.EMPTY_LIST;
- }
-
- public Object getID()
- {
- return transportConnection.getID();
- }
-
- public String getRemoteAddress()
- {
- return transportConnection.getRemoteAddress();
- }
-
- public Connection getTransportConnection()
- {
- return transportConnection;
- }
-
- public boolean isClient()
- {
- return false;
- }
-
- public boolean isDestroyed()
- {
- return false;
- }
-
- public boolean removeCloseListener(CloseListener listener)
- {
- return false;
- }
-
- public boolean removeFailureListener(FailureListener listener)
- {
- return false;
- }
-
- public void setFailureListeners(List<FailureListener> listeners)
- {
- }
-
- public void bufferReceived(Object connectionID, HornetQBuffer buffer)
- {
- manager.handleBuffer(this, buffer);
- }
-
- public int isReadyToHandle(HornetQBuffer buffer)
- {
- return -1;
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2010 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.protocol.aardvark.impl;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.remoting.CloseListener;
+import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A AardvarkConnection
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class AardvarkConnection implements RemotingConnection
+{
+ private static final Logger log = Logger.getLogger(AardvarkConnection.class);
+
+ private final AardvarkProtocolManager manager;
+
+ private final Connection transportConnection;
+
+ AardvarkConnection(final Connection transportConnection, final AardvarkProtocolManager manager)
+ {
+ this.transportConnection = transportConnection;
+
+ this.manager = manager;
+ }
+
+ public void addCloseListener(CloseListener listener)
+ {
+ }
+
+ public void addFailureListener(FailureListener listener)
+ {
+ }
+
+ public boolean checkDataReceived()
+ {
+ return true;
+ }
+
+ public HornetQBuffer createBuffer(int size)
+ {
+ return HornetQBuffers.dynamicBuffer(size);
+ }
+
+ public void destroy()
+ {
+ }
+
+ public void disconnect()
+ {
+ }
+
+ public void fail(HornetQException me)
+ {
+ }
+
+ public void flush()
+ {
+ }
+
+ public List<FailureListener> getFailureListeners()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ public Object getID()
+ {
+ return transportConnection.getID();
+ }
+
+ public String getRemoteAddress()
+ {
+ return transportConnection.getRemoteAddress();
+ }
+
+ public Connection getTransportConnection()
+ {
+ return transportConnection;
+ }
+
+ public boolean isClient()
+ {
+ return false;
+ }
+
+ public boolean isDestroyed()
+ {
+ return false;
+ }
+
+ public boolean removeCloseListener(CloseListener listener)
+ {
+ return false;
+ }
+
+ public boolean removeFailureListener(FailureListener listener)
+ {
+ return false;
+ }
+
+ public void setFailureListeners(List<FailureListener> listeners)
+ {
+ }
+
+ public void bufferReceived(Object connectionID, HornetQBuffer buffer)
+ {
+ manager.handleBuffer(this, buffer);
+ }
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ return -1;
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -1,171 +0,0 @@
-/*
- * Copyright 2010 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.protocol.aardvark.impl;
-
-import java.util.List;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.message.impl.MessageImpl;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.ServerMessage;
-import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.impl.ServerMessageImpl;
-import org.hornetq.spi.core.protocol.ConnectionEntry;
-import org.hornetq.spi.core.protocol.ProtocolManager;
-import org.hornetq.spi.core.protocol.RemotingConnection;
-import org.hornetq.spi.core.protocol.SessionCallback;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * AardvarkProtocolManager
- *
- * A stupid protocol to demonstrate how to implement a new protocol in HornetQ
- *
- * @author Tim Fox
- *
- *
- */
-public class AardvarkProtocolManager implements ProtocolManager
-{
- private static final Logger log = Logger.getLogger(AardvarkProtocolManager.class);
-
- private final HornetQServer server;
-
- public AardvarkProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
- {
- this.server = server;
- }
-
- public ConnectionEntry createConnectionEntry(final Connection connection)
- {
- AardvarkConnection conn = new AardvarkConnection(connection, this);
-
- return new ConnectionEntry(conn, 0, 0);
- }
-
- public void handleBuffer(final RemotingConnection conn, final HornetQBuffer buffer)
- {
- try
- {
- ServerSession session = server.createSession("aardvark",
- null,
- null,
- Integer.MAX_VALUE,
- conn,
- true,
- true,
- true,
- false);
-
- session.setCallback(new AardvarkSessionCallback(conn.getTransportConnection()));
-
- final SimpleString name = new SimpleString("hornetq.aardvark");
-
- session.createQueue(name, name, null, false, false);
-
- session.createConsumer(0, name, null, false);
-
- session.receiveConsumerCredits(0, -1); // No flow control
-
- session.start();
-
- ServerMessage message = new ServerMessageImpl(0, 1000);
-
- message.setAddress(name);
-
- message.getBodyBuffer().writeUTF("GIRAFFE\n");
-
- session.send(message);
-
- session.start();
-
- session.closeConsumer(0);
-
- session.deleteQueue(name);
-
- session.close();
- }
- catch (Exception e)
- {
- log.error("Failed to create session", e);
- }
- }
-
- private class AardvarkSessionCallback implements SessionCallback
- {
- private final Connection connection;
-
- AardvarkSessionCallback(final Connection connection)
- {
- this.connection = connection;
- }
-
- public void closed()
- {
- }
-
- public int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount)
- {
- return 0;
- }
-
- public int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse)
- {
- return 0;
- }
-
- public int sendMessage(ServerMessage message, long consumerID, int deliveryCount)
- {
- HornetQBuffer buffer = message.getBodyBuffer();
-
- buffer.readerIndex(MessageImpl.BUFFER_HEADER_SPACE);
-
- connection.write(buffer);
-
- return -1;
- }
-
- public void sendProducerCreditsMessage(int credits, SimpleString address, int offset)
- {
- }
-
- }
-
- public void bufferReceived(Object connectionID, HornetQBuffer buffer)
- {
- }
-
- public int isReadyToHandle(HornetQBuffer buffer)
- {
- //Look for a new-line
-
- //BTW this is very inefficient - in a real protocol you'd want to do this better
-
- for (int i = buffer.readerIndex(); i < buffer.writerIndex(); i++)
- {
- byte b = buffer.getByte(i);
-
- if (b == (byte)'\n')
- {
- return buffer.writerIndex();
- }
- }
-
- return -1;
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2010 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.protocol.aardvark.impl;
+
+import java.util.List;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.message.impl.MessageImpl;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.ServerMessage;
+import org.hornetq.core.server.ServerSession;
+import org.hornetq.core.server.impl.ServerMessageImpl;
+import org.hornetq.spi.core.protocol.ConnectionEntry;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.protocol.SessionCallback;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * AardvarkProtocolManager
+ *
+ * A stupid protocol to demonstrate how to implement a new protocol in HornetQ
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class AardvarkProtocolManager implements ProtocolManager
+{
+ private static final Logger log = Logger.getLogger(AardvarkProtocolManager.class);
+
+ private final HornetQServer server;
+
+ public AardvarkProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
+ {
+ this.server = server;
+ }
+
+ public ConnectionEntry createConnectionEntry(final Connection connection)
+ {
+ AardvarkConnection conn = new AardvarkConnection(connection, this);
+
+ return new ConnectionEntry(conn, 0, 0);
+ }
+
+ public void removeHandler(String name)
+ {
+ }
+
+ public void handleBuffer(final RemotingConnection conn, final HornetQBuffer buffer)
+ {
+ try
+ {
+ ServerSession session = server.createSession("aardvark",
+ null,
+ null,
+ Integer.MAX_VALUE,
+ conn,
+ true,
+ true,
+ true,
+ false,
+ new AardvarkSessionCallback(conn.getTransportConnection()));
+
+ final SimpleString name = new SimpleString("hornetq.aardvark");
+
+ session.createQueue(name, name, null, false, false);
+
+ session.createConsumer(0, name, null, false);
+
+ session.receiveConsumerCredits(0, -1); // No flow control
+
+ session.start();
+
+ ServerMessage message = new ServerMessageImpl(0, 1000);
+
+ message.setAddress(name);
+
+ message.getBodyBuffer().writeUTF("GIRAFFE\n");
+
+ session.send(message);
+
+ session.start();
+
+ session.closeConsumer(0);
+
+ session.deleteQueue(name);
+
+ session.close();
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to create session", e);
+ }
+ }
+
+ private class AardvarkSessionCallback implements SessionCallback
+ {
+ private final Connection connection;
+
+ AardvarkSessionCallback(final Connection connection)
+ {
+ this.connection = connection;
+ }
+
+ public void closed()
+ {
+ }
+
+ public int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount)
+ {
+ return 0;
+ }
+
+ public int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse)
+ {
+ return 0;
+ }
+
+ public int sendMessage(ServerMessage message, long consumerID, int deliveryCount)
+ {
+ HornetQBuffer buffer = message.getBodyBuffer();
+
+ buffer.readerIndex(MessageImpl.BUFFER_HEADER_SPACE);
+
+ connection.write(buffer);
+
+ return -1;
+ }
+
+ public void sendProducerCreditsMessage(int credits, SimpleString address, int offset)
+ {
+ }
+
+ }
+
+ public void bufferReceived(Object connectionID, HornetQBuffer buffer)
+ {
+ }
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ //Look for a new-line
+
+ //BTW this is very inefficient - in a real protocol you'd want to do this better
+
+ for (int i = buffer.readerIndex(); i < buffer.writerIndex(); i++)
+ {
+ byte b = buffer.getByte(i);
+
+ if (b == (byte)'\n')
+ {
+ return buffer.writerIndex();
+ }
+ }
+
+ return -1;
+ }
+
+}
Deleted: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -1,38 +0,0 @@
-/*
- * Copyright 2010 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.protocol.aardvark.impl;
-
-import java.util.List;
-
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.spi.core.protocol.ProtocolManager;
-import org.hornetq.spi.core.protocol.ProtocolManagerFactory;
-
-/**
- * A AardvarkProtocolManagerFactory
- *
- * @author Tim Fox
- *
- *
- */
-public class AardvarkProtocolManagerFactory implements ProtocolManagerFactory
-{
-
- public ProtocolManager createProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
- {
- return new AardvarkProtocolManager(server, interceptors);
- }
-
-}
Copied: branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java (from rev 8832, trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java 2010-01-22 10:19:02 UTC (rev 8835)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2010 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.protocol.aardvark.impl;
+
+import java.util.List;
+
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.ProtocolManagerFactory;
+
+/**
+ * A AardvarkProtocolManagerFactory
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class AardvarkProtocolManagerFactory implements ProtocolManagerFactory
+{
+
+ public ProtocolManager createProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
+ {
+ return new AardvarkProtocolManager(server, interceptors);
+ }
+
+}
14 years, 11 months
JBoss hornetq SVN: r8834 - in branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests: integration/client and 14 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-01-22 05:16:25 -0500 (Fri, 22 Jan 2010)
New Revision: 8834
Added:
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/remoting/AardvarkProtocolTest.java
Modified:
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/InterceptorTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/ProducerTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/SessionTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.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/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/remoting/PingTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.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/NettyConnectionTest.java
branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* sync with the trunk: svn merge -r 8821:8832 https://svn.jboss.org/repos/hornetq/trunk
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/InterceptorTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/InterceptorTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/InterceptorTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -25,12 +25,12 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.ServerMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -28,10 +28,10 @@
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -24,12 +24,12 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQSession;
import org.hornetq.jms.server.impl.JMSServerManagerImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.integration.jms.server.management.NullInitialContext;
import org.hornetq.tests.util.UnitTestCase;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -12,12 +12,12 @@
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
*
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -20,7 +20,7 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -27,8 +27,8 @@
import org.hornetq.core.protocol.core.Channel;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
import org.hornetq.core.server.HornetQServer;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/ProducerTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/ProducerTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/ProducerTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -26,9 +26,9 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -21,11 +21,11 @@
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.UnitTestCase;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/SessionTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/SessionTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/SessionTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -29,9 +29,9 @@
import org.hornetq.api.core.client.ClientSession.BindingQuery;
import org.hornetq.api.core.client.ClientSession.QueueQuery;
import org.hornetq.core.client.impl.ClientSessionInternal;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -28,13 +28,13 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.UnitTestCase;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -20,8 +20,8 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -19,7 +19,7 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
*
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -27,7 +27,6 @@
import org.hornetq.api.core.client.*;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
@@ -36,6 +35,7 @@
import org.hornetq.core.server.cluster.QueueConfiguration;
import org.hornetq.core.server.cluster.impl.BridgeImpl;
import org.hornetq.integration.transports.netty.NettyConnectorFactory;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A BridgeReconnectTest
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -31,7 +31,7 @@
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.client.impl.DelegatingSession;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A MultiThreadFailoverTest
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -16,8 +16,8 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A DelayInterceptor
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -17,8 +17,8 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A DelayInterceptor2
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -17,8 +17,8 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A DelayInterceptor3
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -35,10 +35,10 @@
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -22,10 +22,10 @@
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.cluster.MessageFlowRecord;
import org.hornetq.core.server.cluster.impl.ClusterConnectionImpl;
import org.hornetq.core.server.group.impl.GroupingHandlerConfiguration;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.integration.cluster.distribution.ClusterTestBase;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -30,11 +30,11 @@
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.replication.impl.ReplicationEndpointImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.impl.HornetQServerImpl;
import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A PagingFailoverTest
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -26,8 +26,8 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionInternal;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.integration.cluster.distribution.ClusterTestBase;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -26,7 +26,7 @@
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.UnitTestCase;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -31,7 +31,7 @@
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.util.ServiceTestBase;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -29,11 +29,11 @@
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
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-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -25,11 +25,10 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.protocol.core.PacketDecoder;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.NettyConnector;
import org.hornetq.integration.transports.netty.TransportConstants;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -32,9 +32,9 @@
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.integration.transports.netty.NettyConnectorFactory;
import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.JMSTestBase;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -38,7 +38,6 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.server.HornetQServer;
@@ -46,6 +45,7 @@
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQQueue;
import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -37,7 +37,6 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
@@ -45,6 +44,7 @@
import org.hornetq.jms.client.HornetQQueue;
import org.hornetq.jms.client.HornetQSession;
import org.hornetq.jms.client.HornetQTopic;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -27,7 +27,7 @@
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.JMSTestBase;
import org.hornetq.tests.util.UnitTestCase;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -26,9 +26,9 @@
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.JMSTestBase;
/**
Copied: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/remoting/AardvarkProtocolTest.java (from rev 8832, trunk/tests/src/org/hornetq/tests/integration/remoting/AardvarkProtocolTest.java)
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/remoting/AardvarkProtocolTest.java (rev 0)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/remoting/AardvarkProtocolTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2010 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.tests.integration.remoting;
+
+import java.io.BufferedOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
+import org.hornetq.integration.transports.netty.TransportConstants;
+import org.hornetq.spi.core.protocol.ProtocolType;
+import org.hornetq.tests.util.ServiceTestBase;
+
+/**
+ * An AardvarkProtocolTest
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class AardvarkProtocolTest extends ServiceTestBase
+{
+ private static final Logger log = Logger.getLogger(AardvarkProtocolTest.class);
+
+ public void testAardvark() throws Exception
+ {
+ RemotingServiceImpl.hackProtocol = ProtocolType.AARDVARK;
+
+ Configuration config = new ConfigurationImpl();
+
+ config.setSecurityEnabled(false);
+ config.setPersistenceEnabled(false);
+
+ Map<String, Object> params = new HashMap<String, Object>();
+
+ params.put(TransportConstants.PORT_PROP_NAME, 9876);
+ params.put(TransportConstants.HOST_PROP_NAME, "127.0.0.1");
+
+ TransportConfiguration tc = new TransportConfiguration(NettyAcceptorFactory.class.getCanonicalName(),
+ params);
+
+ config.getAcceptorConfigurations().add(tc);
+
+ HornetQServer server = HornetQServers.newHornetQServer(config);
+
+ server.start();
+
+ //Now we should be able to make a connection to this port and talk the Aardvark protocol!
+
+ Socket socket = new Socket("127.0.0.1", 9876);
+
+
+
+ OutputStream out = new BufferedOutputStream(socket.getOutputStream());
+
+ String s = "AARDVARK!\n";
+
+ byte[] bytes = s.getBytes("UTF-8");
+
+ out.write(bytes);
+
+ out.flush();
+
+ InputStream in = socket.getInputStream();
+
+ log.info("writing bytes");
+ byte b;
+
+ while ((b = (byte)in.read()) != '\n')
+ {
+ log.info("read " + (char)b);
+ }
+
+ socket.close();
+
+ server.stop();
+
+ RemotingServiceImpl.hackProtocol = ProtocolType.CORE;
+ }
+}
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/remoting/PingTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/remoting/PingTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/remoting/PingTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -33,11 +33,11 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -59,7 +59,6 @@
import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.persistence.impl.journal.OperationContextImpl;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.replication.impl.ReplicatedJournal;
import org.hornetq.core.replication.impl.ReplicationManagerImpl;
@@ -69,6 +68,7 @@
import org.hornetq.core.server.impl.ServerMessageImpl;
import org.hornetq.core.settings.HierarchicalRepository;
import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.utils.ExecutorFactory;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/integration/stomp/StompTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -58,6 +58,7 @@
import org.hornetq.jms.server.config.impl.JMSConfigurationImpl;
import org.hornetq.jms.server.config.impl.QueueConfigurationImpl;
import org.hornetq.jms.server.impl.JMSServerManagerImpl;
+import org.hornetq.spi.core.protocol.ProtocolType;
public class StompTest extends TestCase {
private static final transient Logger log = Logger.getLogger(StompTest.class);
@@ -852,7 +853,7 @@
config.setPersistenceEnabled(false);
Map<String, Object> params = new HashMap<String, Object>();
- params.put(TransportConstants.PROTOCOL_PROP_NAME, TransportConstants.STOMP_PROTOCOL);
+ params.put(TransportConstants.PROTOCOL_PROP_NAME, ProtocolType.STOMP.toString());
params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT);
TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params);
config.getAcceptorConfigurations().add(stompTransport);
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -25,9 +25,9 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.integration.remoting.PingTest;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -36,9 +36,9 @@
import org.hornetq.core.client.impl.ClientConsumerInternal;
import org.hornetq.core.client.impl.ClientMessageInternal;
import org.hornetq.core.client.impl.LargeMessageBufferImpl;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
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-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -21,10 +21,10 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
import org.hornetq.integration.transports.netty.ServerHolder;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
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-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -22,10 +22,10 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.ServerHolder;
import org.hornetq.integration.transports.netty.TransportConstants;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
Modified: branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
===================================================================
--- branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java 2010-01-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -22,8 +22,8 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.integration.transports.netty.NettyConnection;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
import org.hornetq.tests.util.RandomUtil;
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-22 09:57:54 UTC (rev 8833)
+++ branches/HORNETQ-129_STOMP_protocol/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java 2010-01-22 10:16:25 UTC (rev 8834)
@@ -21,8 +21,8 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.integration.transports.netty.NettyConnector;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
14 years, 11 months
JBoss hornetq SVN: r8833 - trunk/tests/src/org/hornetq/tests/integration/cluster/failover.
by do-not-reply@jboss.org
Author: timfox
Date: 2010-01-22 04:57:54 -0500 (Fri, 22 Jan 2010)
New Revision: 8833
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java
Log:
enable commented out tests for now, to see if they fail
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java 2010-01-21 20:09:23 UTC (rev 8832)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/LargeMessageFailoverTest.java 2010-01-22 09:57:54 UTC (rev 8833)
@@ -56,10 +56,10 @@
suite.addTest(new LargeMessageFailoverTest("testCreateNewFactoryAfterFailover"));
// Those tests are temporarily disabled for LargeMessage
- // suite.addTest(new LargeMessageFailoverTest("testFailoverMultipleSessionsWithConsumers"));
- // suite.addTest(new LargeMessageFailoverTest("testFailWithBrowser"));
- // suite.addTest(new LargeMessageFailoverTest("testFailThenReceiveMoreMessagesAfterFailover"));
- // suite.addTest(new LargeMessageFailoverTest("testFailThenReceiveMoreMessagesAfterFailover2"));
+ suite.addTest(new LargeMessageFailoverTest("testFailoverMultipleSessionsWithConsumers"));
+ suite.addTest(new LargeMessageFailoverTest("testFailWithBrowser"));
+ suite.addTest(new LargeMessageFailoverTest("testFailThenReceiveMoreMessagesAfterFailover"));
+ suite.addTest(new LargeMessageFailoverTest("testFailThenReceiveMoreMessagesAfterFailover2"));
suite.addTest(new LargeMessageFailoverTest("testForceBlockingReturn"));
suite.addTest(new LargeMessageFailoverTest("testCommitOccurredUnblockedAndResendNoDuplicates"));
14 years, 11 months
JBoss hornetq SVN: r8832 - in trunk: src/main/org/hornetq/core/protocol/aardvark and 4 other directories.
by do-not-reply@jboss.org
Author: timfox
Date: 2010-01-21 15:09:23 -0500 (Thu, 21 Jan 2010)
New Revision: 8832
Added:
trunk/src/main/org/hornetq/core/protocol/aardvark/
trunk/src/main/org/hornetq/core/protocol/aardvark/impl/
trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java
trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java
trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java
trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java
trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java
trunk/tests/src/org/hornetq/tests/integration/remoting/AardvarkProtocolTest.java
Log:
refactoring to abstract out protocol
Added: trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkConnection.java 2010-01-21 20:09:23 UTC (rev 8832)
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2010 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.protocol.aardvark.impl;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.remoting.CloseListener;
+import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A AardvarkConnection
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class AardvarkConnection implements RemotingConnection
+{
+ private static final Logger log = Logger.getLogger(AardvarkConnection.class);
+
+ private final AardvarkProtocolManager manager;
+
+ private final Connection transportConnection;
+
+ AardvarkConnection(final Connection transportConnection, final AardvarkProtocolManager manager)
+ {
+ this.transportConnection = transportConnection;
+
+ this.manager = manager;
+ }
+
+ public void addCloseListener(CloseListener listener)
+ {
+ }
+
+ public void addFailureListener(FailureListener listener)
+ {
+ }
+
+ public boolean checkDataReceived()
+ {
+ return true;
+ }
+
+ public HornetQBuffer createBuffer(int size)
+ {
+ return HornetQBuffers.dynamicBuffer(size);
+ }
+
+ public void destroy()
+ {
+ }
+
+ public void disconnect()
+ {
+ }
+
+ public void fail(HornetQException me)
+ {
+ }
+
+ public void flush()
+ {
+ }
+
+ public List<FailureListener> getFailureListeners()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ public Object getID()
+ {
+ return transportConnection.getID();
+ }
+
+ public String getRemoteAddress()
+ {
+ return transportConnection.getRemoteAddress();
+ }
+
+ public Connection getTransportConnection()
+ {
+ return transportConnection;
+ }
+
+ public boolean isClient()
+ {
+ return false;
+ }
+
+ public boolean isDestroyed()
+ {
+ return false;
+ }
+
+ public boolean removeCloseListener(CloseListener listener)
+ {
+ return false;
+ }
+
+ public boolean removeFailureListener(FailureListener listener)
+ {
+ return false;
+ }
+
+ public void setFailureListeners(List<FailureListener> listeners)
+ {
+ }
+
+ public void bufferReceived(Object connectionID, HornetQBuffer buffer)
+ {
+ manager.handleBuffer(this, buffer);
+ }
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ return -1;
+ }
+
+}
Added: trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManager.java 2010-01-21 20:09:23 UTC (rev 8832)
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2010 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.protocol.aardvark.impl;
+
+import java.util.List;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.message.impl.MessageImpl;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.ServerMessage;
+import org.hornetq.core.server.ServerSession;
+import org.hornetq.core.server.impl.ServerMessageImpl;
+import org.hornetq.spi.core.protocol.ConnectionEntry;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.protocol.SessionCallback;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * AardvarkProtocolManager
+ *
+ * A stupid protocol to demonstrate how to implement a new protocol in HornetQ
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class AardvarkProtocolManager implements ProtocolManager
+{
+ private static final Logger log = Logger.getLogger(AardvarkProtocolManager.class);
+
+ private final HornetQServer server;
+
+ public AardvarkProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
+ {
+ this.server = server;
+ }
+
+ public ConnectionEntry createConnectionEntry(final Connection connection)
+ {
+ AardvarkConnection conn = new AardvarkConnection(connection, this);
+
+ return new ConnectionEntry(conn, 0, 0);
+ }
+
+ public void handleBuffer(final RemotingConnection conn, final HornetQBuffer buffer)
+ {
+ try
+ {
+ ServerSession session = server.createSession("aardvark",
+ null,
+ null,
+ Integer.MAX_VALUE,
+ conn,
+ true,
+ true,
+ true,
+ false);
+
+ session.setCallback(new AardvarkSessionCallback(conn.getTransportConnection()));
+
+ final SimpleString name = new SimpleString("hornetq.aardvark");
+
+ session.createQueue(name, name, null, false, false);
+
+ session.createConsumer(0, name, null, false);
+
+ session.receiveConsumerCredits(0, -1); // No flow control
+
+ session.start();
+
+ ServerMessage message = new ServerMessageImpl(0, 1000);
+
+ message.setAddress(name);
+
+ message.getBodyBuffer().writeUTF("GIRAFFE\n");
+
+ session.send(message);
+
+ session.start();
+
+ session.closeConsumer(0);
+
+ session.deleteQueue(name);
+
+ session.close();
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to create session", e);
+ }
+ }
+
+ private class AardvarkSessionCallback implements SessionCallback
+ {
+ private final Connection connection;
+
+ AardvarkSessionCallback(final Connection connection)
+ {
+ this.connection = connection;
+ }
+
+ public void closed()
+ {
+ }
+
+ public int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount)
+ {
+ return 0;
+ }
+
+ public int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse)
+ {
+ return 0;
+ }
+
+ public int sendMessage(ServerMessage message, long consumerID, int deliveryCount)
+ {
+ HornetQBuffer buffer = message.getBodyBuffer();
+
+ buffer.readerIndex(MessageImpl.BUFFER_HEADER_SPACE);
+
+ connection.write(buffer);
+
+ return -1;
+ }
+
+ public void sendProducerCreditsMessage(int credits, SimpleString address, int offset)
+ {
+ }
+
+ }
+
+ public void bufferReceived(Object connectionID, HornetQBuffer buffer)
+ {
+ }
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ //Look for a new-line
+
+ //BTW this is very inefficient - in a real protocol you'd want to do this better
+
+ for (int i = buffer.readerIndex(); i < buffer.writerIndex(); i++)
+ {
+ byte b = buffer.getByte(i);
+
+ if (b == (byte)'\n')
+ {
+ return buffer.writerIndex();
+ }
+ }
+
+ return -1;
+ }
+
+}
Added: trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/aardvark/impl/AardvarkProtocolManagerFactory.java 2010-01-21 20:09:23 UTC (rev 8832)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2010 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.protocol.aardvark.impl;
+
+import java.util.List;
+
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.ProtocolManagerFactory;
+
+/**
+ * A AardvarkProtocolManagerFactory
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class AardvarkProtocolManagerFactory implements ProtocolManagerFactory
+{
+
+ public ProtocolManager createProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
+ {
+ return new AardvarkProtocolManager(server, interceptors);
+ }
+
+}
Added: trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManagerFactory.java 2010-01-21 20:09:23 UTC (rev 8832)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 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.protocol.core.impl;
+
+import java.util.List;
+
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.ProtocolManagerFactory;
+
+/**
+ * A CoreProtocolManagerFactory
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class CoreProtocolManagerFactory implements ProtocolManagerFactory
+{
+ public ProtocolManager createProtocolManager(final HornetQServer server, final List<Interceptor> interceptors)
+ {
+ return new CoreProtocolManager(server, interceptors);
+ }
+}
Added: trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManagerFactory.java 2010-01-21 20:09:23 UTC (rev 8832)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2010 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.spi.core.protocol;
+
+import java.util.List;
+
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.server.HornetQServer;
+
+/**
+ * A ProtocolManagerFactory
+ *
+ * @author tim
+ *
+ *
+ */
+public interface ProtocolManagerFactory
+{
+ ProtocolManager createProtocolManager(HornetQServer server, List<Interceptor> interceptors);
+}
Added: trunk/tests/src/org/hornetq/tests/integration/remoting/AardvarkProtocolTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/remoting/AardvarkProtocolTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/remoting/AardvarkProtocolTest.java 2010-01-21 20:09:23 UTC (rev 8832)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2010 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.tests.integration.remoting;
+
+import java.io.BufferedOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
+import org.hornetq.integration.transports.netty.TransportConstants;
+import org.hornetq.spi.core.protocol.ProtocolType;
+import org.hornetq.tests.util.ServiceTestBase;
+
+/**
+ * An AardvarkProtocolTest
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class AardvarkProtocolTest extends ServiceTestBase
+{
+ private static final Logger log = Logger.getLogger(AardvarkProtocolTest.class);
+
+ public void testAardvark() throws Exception
+ {
+ RemotingServiceImpl.hackProtocol = ProtocolType.AARDVARK;
+
+ Configuration config = new ConfigurationImpl();
+
+ config.setSecurityEnabled(false);
+ config.setPersistenceEnabled(false);
+
+ Map<String, Object> params = new HashMap<String, Object>();
+
+ params.put(TransportConstants.PORT_PROP_NAME, 9876);
+ params.put(TransportConstants.HOST_PROP_NAME, "127.0.0.1");
+
+ TransportConfiguration tc = new TransportConfiguration(NettyAcceptorFactory.class.getCanonicalName(),
+ params);
+
+ config.getAcceptorConfigurations().add(tc);
+
+ HornetQServer server = HornetQServers.newHornetQServer(config);
+
+ server.start();
+
+ //Now we should be able to make a connection to this port and talk the Aardvark protocol!
+
+ Socket socket = new Socket("127.0.0.1", 9876);
+
+
+
+ OutputStream out = new BufferedOutputStream(socket.getOutputStream());
+
+ String s = "AARDVARK!\n";
+
+ byte[] bytes = s.getBytes("UTF-8");
+
+ out.write(bytes);
+
+ out.flush();
+
+ InputStream in = socket.getInputStream();
+
+ log.info("writing bytes");
+ byte b;
+
+ while ((b = (byte)in.read()) != '\n')
+ {
+ log.info("read " + (char)b);
+ }
+
+ socket.close();
+
+ server.stop();
+
+ RemotingServiceImpl.hackProtocol = ProtocolType.CORE;
+ }
+}
14 years, 11 months
JBoss hornetq SVN: r8831 - in trunk: src/main/org/hornetq/api/core and 37 other directories.
by do-not-reply@jboss.org
Author: timfox
Date: 2010-01-21 15:07:20 -0500 (Thu, 21 Jan 2010)
New Revision: 8831
Added:
trunk/src/main/org/hornetq/core/protocol/core/impl/
trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java
trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java
trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java
trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java
trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java
trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/
trunk/src/main/org/hornetq/spi/core/protocol/
trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java
trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java
trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java
trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java
trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java
trunk/src/main/org/hornetq/utils/XidCodecSupport.java
Removed:
trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java
trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java
trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java
trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java
trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java
trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/XidCodecSupport.java
trunk/src/main/org/hornetq/core/protocol/core/wireformat/
trunk/src/main/org/hornetq/core/remoting/ProtocolType.java
trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java
trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java
trunk/src/main/org/hornetq/core/remoting/impl/wireformat/
trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java
trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java
trunk/src/main/org/hornetq/core/server/SessionCallback.java
Modified:
trunk/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java
trunk/src/main/org/hornetq/api/core/Interceptor.java
trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java
trunk/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java
trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java
trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
trunk/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java
trunk/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java
trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java
trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java
trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java
trunk/src/main/org/hornetq/core/protocol/core/Packet.java
trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java
trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java
trunk/src/main/org/hornetq/core/remoting/CloseListener.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java
trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java
trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
trunk/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
trunk/src/main/org/hornetq/core/server/HornetQServer.java
trunk/src/main/org/hornetq/core/server/ServerSession.java
trunk/src/main/org/hornetq/core/server/cluster/Bridge.java
trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyConnection.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java
trunk/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java
trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java
trunk/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
trunk/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java
trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
trunk/tests/src/org/hornetq/tests/integration/client/ProducerTest.java
trunk/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java
trunk/tests/src/org/hornetq/tests/integration/client/SessionTest.java
trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java
trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java
trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java
trunk/tests/src/org/hornetq/tests/integration/remoting/PingTest.java
trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
trunk/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java
trunk/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
Log:
refactoring to abstract out protocol
Modified: trunk/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java
===================================================================
--- trunk/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/examples/jms/interceptor/src/org/hornetq/jms/example/SimpleInterceptor.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,8 +18,8 @@
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A simple Interceptor implementation
Modified: trunk/src/main/org/hornetq/api/core/Interceptor.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/Interceptor.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/api/core/Interceptor.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -15,7 +15,7 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* This is class is a simple way to intercepting calls on HornetQ client and servers.
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,11 +26,11 @@
import org.hornetq.core.list.impl.PriorityLinkedListImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
import org.hornetq.utils.Future;
import org.hornetq.utils.TokenBucketLimiter;
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientConsumerInternal.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,9 +17,9 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
/**
*
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientProducerImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -25,9 +25,9 @@
import org.hornetq.core.message.BodyEncoder;
import org.hornetq.core.message.impl.MessageInternal;
import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
import org.hornetq.utils.TokenBucketLimiter;
import org.hornetq.utils.UUIDGenerator;
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientSessionImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -37,43 +37,43 @@
import org.hornetq.core.protocol.core.CommandConfirmationHandler;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAStartMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.utils.ConcurrentHashSet;
import org.hornetq.utils.IDGenerator;
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientSessionInternal.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,10 +17,10 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A ClientSessionInternal
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientSessionPacketHandler.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,21 +13,21 @@
package org.hornetq.core.client.impl;
-import static org.hornetq.core.protocol.core.PacketImpl.EXCEPTION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_LARGE_MSG;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.EXCEPTION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_LARGE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_MSG;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Channel;
import org.hornetq.core.protocol.core.ChannelHandler;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
/**
*
Modified: trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/DelegatingSession.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -28,10 +28,10 @@
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.ConcurrentHashSet;
/**
Modified: trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/FailoverManagerImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -39,15 +39,15 @@
import org.hornetq.core.protocol.core.ChannelHandler;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.Ping;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.Ping;
import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
import org.hornetq.core.version.Version;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
import org.hornetq.spi.core.remoting.Connector;
Modified: trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/client/impl/LargeMessageBufferImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -30,7 +30,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
import org.hornetq.utils.DataConstants;
import org.hornetq.utils.UTF8Util;
import org.jboss.netty.buffer.ChannelBuffer;
Modified: trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -46,7 +46,6 @@
import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.PostOffice;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.JournalType;
@@ -54,6 +53,7 @@
import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.core.transaction.Transaction;
import org.hornetq.core.transaction.impl.XidImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
Modified: trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -27,7 +27,7 @@
import org.hornetq.core.client.impl.LargeMessageBufferInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.BodyEncoder;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.utils.DataConstants;
import org.hornetq.utils.TypedProperties;
@@ -48,10 +48,12 @@
public abstract class MessageImpl implements MessageInternal
{
// Constants -----------------------------------------------------
-
+
private static final Logger log = Logger.getLogger(MessageImpl.class);
public static final SimpleString HDR_ROUTE_TO_IDS = new SimpleString("_HQ_ROUTE_TO");
+
+ public static final int BUFFER_HEADER_SPACE = PacketImpl.PACKET_HEADERS_SIZE;
protected long messageID;
@@ -165,7 +167,7 @@
int bodyPos = endOfBodyPosition == -1 ? buffer.writerIndex() : endOfBodyPosition;
- int bodySize = bodyPos - PacketImpl.PACKET_HEADERS_SIZE - DataConstants.SIZE_INT;
+ int bodySize = bodyPos - BUFFER_HEADER_SPACE - DataConstants.SIZE_INT;
return DataConstants.SIZE_INT + bodySize + DataConstants.SIZE_INT + headersPropsSize;
}
@@ -212,7 +214,7 @@
{
if (buffer instanceof LargeMessageBufferInternal == false)
{
- bodyBuffer = new ResetLimitWrappedHornetQBuffer(PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT,
+ bodyBuffer = new ResetLimitWrappedHornetQBuffer(BUFFER_HEADER_SPACE + DataConstants.SIZE_INT,
buffer,
this);
}
@@ -386,7 +388,7 @@
{
encodeToBuffer();
- buff.writeBytes(buffer, PacketImpl.PACKET_HEADERS_SIZE, endOfMessagePosition - PacketImpl.PACKET_HEADERS_SIZE);
+ buff.writeBytes(buffer, BUFFER_HEADER_SPACE, endOfMessagePosition - BUFFER_HEADER_SPACE);
}
// Decode from journal or paging
@@ -396,11 +398,11 @@
endOfBodyPosition = buff.readInt();
- endOfMessagePosition = buff.getInt(endOfBodyPosition - PacketImpl.PACKET_HEADERS_SIZE + start);
+ endOfMessagePosition = buff.getInt(endOfBodyPosition - BUFFER_HEADER_SPACE + start);
- int length = endOfMessagePosition - PacketImpl.PACKET_HEADERS_SIZE;
+ int length = endOfMessagePosition - BUFFER_HEADER_SPACE;
- buffer.setIndex(0, PacketImpl.PACKET_HEADERS_SIZE);
+ buffer.setIndex(0, BUFFER_HEADER_SPACE);
buffer.writeBytes(buff, start, length);
@@ -818,7 +820,7 @@
}
// write it
- buffer.setInt(PacketImpl.PACKET_HEADERS_SIZE, endOfBodyPosition);
+ buffer.setInt(BUFFER_HEADER_SPACE, endOfBodyPosition);
// Position at end of body and skip past the message end position int.
// check for enough room in the buffer even tho it is dynamic
@@ -848,7 +850,7 @@
private void decode()
{
- endOfBodyPosition = buffer.getInt(PacketImpl.PACKET_HEADERS_SIZE);
+ endOfBodyPosition = buffer.getInt(BUFFER_HEADER_SPACE);
buffer.readerIndex(endOfBodyPosition + DataConstants.SIZE_INT);
@@ -866,7 +868,7 @@
// There's a bug in netty which means a dynamic buffer won't resize until you write a byte
buffer.writeByte((byte)0);
- int limit = PacketImpl.PACKET_HEADERS_SIZE + DataConstants.SIZE_INT;
+ int limit = BUFFER_HEADER_SPACE + DataConstants.SIZE_INT;
buffer.setIndex(limit, limit);
}
Modified: trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -55,7 +55,6 @@
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.PostOffice;
-import org.hornetq.core.protocol.core.wireformat.XidCodecSupport;
import org.hornetq.core.replication.ReplicationManager;
import org.hornetq.core.replication.impl.ReplicatedJournal;
import org.hornetq.core.server.JournalType;
@@ -74,6 +73,7 @@
import org.hornetq.utils.DataConstants;
import org.hornetq.utils.ExecutorFactory;
import org.hornetq.utils.UUID;
+import org.hornetq.utils.XidCodecSupport;
/**
*
Deleted: trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,508 +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.protocol.core;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.PacketsConfirmedMessage;
-import org.hornetq.core.remoting.RemotingConnection;
-
-/**
- * A ChannelImpl
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- */
-public class ChannelImpl implements Channel
-{
- private static final Logger log = Logger.getLogger(ChannelImpl.class);
-
- private volatile long id;
-
- private ChannelHandler handler;
-
- private Packet response;
-
- private final java.util.Queue<Packet> resendCache;
-
- private volatile int firstStoredCommandID;
-
- private volatile int lastConfirmedCommandID = -1;
-
- private volatile CoreRemotingConnection connection;
-
- private volatile boolean closed;
-
- private final Lock lock = new ReentrantLock();
-
- private final Condition sendCondition = lock.newCondition();
-
- private final Condition failoverCondition = lock.newCondition();
-
- private final Object sendLock = new Object();
-
- private final Object sendBlockingLock = new Object();
-
- private boolean failingOver;
-
- private final int confWindowSize;
-
- private int receivedBytes;
-
- private CommandConfirmationHandler commandConfirmationHandler;
-
- private volatile boolean transferring;
-
- public ChannelImpl(final CoreRemotingConnection connection, final long id, final int confWindowSize)
- {
- this.connection = connection;
-
- this.id = id;
-
- this.confWindowSize = confWindowSize;
-
- if (confWindowSize != -1)
- {
- resendCache = new ConcurrentLinkedQueue<Packet>();
- }
- else
- {
- resendCache = null;
- }
- }
-
- public long getID()
- {
- return id;
- }
-
- public int getLastConfirmedCommandID()
- {
- return lastConfirmedCommandID;
- }
-
- public Lock getLock()
- {
- return lock;
- }
-
- public int getConfirmationWindowSize()
- {
- return confWindowSize;
- }
-
- public void returnBlocking()
- {
- lock.lock();
-
- try
- {
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.UNBLOCKED,
- "Connection failure detected. Unblocking a blocking call that will never get a response"
-
- ));
-
- sendCondition.signal();
- }
- finally
- {
- lock.unlock();
- }
- }
-
- public void sendAndFlush(final Packet packet)
- {
- send(packet, true);
- }
-
- public void send(final Packet packet)
- {
- send(packet, false);
- }
-
- public void setTransferring(boolean transferring)
- {
- this.transferring = transferring;
- }
-
- // This must never called by more than one thread concurrently
- public void send(final Packet packet, final boolean flush)
- {
- synchronized (sendLock)
- {
- packet.setChannelID(id);
-
- final HornetQBuffer buffer = packet.encode(connection);
-
- lock.lock();
-
- try
- {
- while (failingOver)
- {
- // TODO - don't hardcode this timeout
- try
- {
- failoverCondition.await(10000, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e)
- {
- }
- }
-
- //Sanity check
- if (transferring)
- {
- throw new IllegalStateException("Cannot send a packet while channel is doing failover");
- }
-
-
- if (resendCache != null && packet.isRequiresConfirmations())
- {
- resendCache.add(packet);
- }
-
- connection.getTransportConnection().write(buffer, flush);
- }
- finally
- {
- lock.unlock();
- }
- }
- }
-
- public Packet sendBlocking(final Packet packet) throws HornetQException
- {
- if (closed)
- {
- throw new HornetQException(HornetQException.NOT_CONNECTED, "Connection is destroyed");
- }
-
- if (connection.getBlockingCallTimeout() == -1)
- {
- throw new IllegalStateException("Cannot do a blocking call timeout on a server side connection");
- }
-
- // Synchronized since can't be called concurrently by more than one thread and this can occur
- // E.g. blocking acknowledge() from inside a message handler at some time as other operation on main thread
- synchronized (sendBlockingLock)
- {
- packet.setChannelID(id);
-
- final HornetQBuffer buffer = packet.encode(connection);
-
- lock.lock();
-
- try
- {
- while (failingOver)
- {
- // TODO - don't hardcode this timeout
- try
- {
- failoverCondition.await(10000, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e)
- {
- }
- }
-
- response = null;
-
- if (resendCache != null && packet.isRequiresConfirmations())
- {
- resendCache.add(packet);
- }
-
- connection.getTransportConnection().write(buffer);
-
- long toWait = connection.getBlockingCallTimeout();
-
- long start = System.currentTimeMillis();
-
- while (response == null && toWait > 0)
- {
- try
- {
- sendCondition.await(toWait, TimeUnit.MILLISECONDS);
- }
- catch (InterruptedException e)
- {
- }
-
- if (closed)
- {
- break;
- }
-
- final long now = System.currentTimeMillis();
-
- toWait -= now - start;
-
- start = now;
- }
-
- if (response == null)
- {
- throw new HornetQException(HornetQException.CONNECTION_TIMEDOUT,
- "Timed out waiting for response when sending packet " + packet.getType());
- }
-
- if (response.getType() == PacketImpl.EXCEPTION)
- {
- final HornetQExceptionMessage mem = (HornetQExceptionMessage)response;
-
- HornetQException e = mem.getException();
-
- e.fillInStackTrace();
-
- throw e;
- }
- }
- finally
- {
- lock.unlock();
- }
-
- return response;
- }
- }
-
- public void setCommandConfirmationHandler(final CommandConfirmationHandler handler)
- {
- commandConfirmationHandler = handler;
- }
-
- public void setHandler(final ChannelHandler handler)
- {
- this.handler = handler;
- }
-
- public void close()
- {
- if (closed)
- {
- return;
- }
-
- if (!connection.isDestroyed() && !connection.removeChannel(id))
- {
- throw new IllegalArgumentException("Cannot find channel with id " + id + " to close");
- }
-
- closed = true;
- }
-
- public void transferConnection(final CoreRemotingConnection newConnection)
- {
- // Needs to synchronize on the connection to make sure no packets from
- // the old connection get processed after transfer has occurred
- synchronized (connection.getTransferLock())
- {
- connection.removeChannel(id);
-
- // And switch it
-
- final CoreRemotingConnection rnewConnection = (CoreRemotingConnection)newConnection;
-
- rnewConnection.putChannel(id, this);
-
- connection = rnewConnection;
-
- transferring = true;
- }
- }
-
- public void replayCommands(final int otherLastConfirmedCommandID)
- {
- if (resendCache != null)
- {
- clearUpTo(otherLastConfirmedCommandID);
-
- for (final Packet packet : resendCache)
- {
- doWrite(packet);
- }
- }
- }
-
- public void lock()
- {
- lock.lock();
-
- failingOver = true;
-
- lock.unlock();
- }
-
- public void unlock()
- {
- lock.lock();
-
- failingOver = false;
-
- failoverCondition.signalAll();
-
- lock.unlock();
- }
-
- public CoreRemotingConnection getConnection()
- {
- return connection;
- }
-
- //Needs to be synchronized since can be called by remoting service timer thread too for timeout flush
- public synchronized void flushConfirmations()
- {
- if (resendCache != null && receivedBytes != 0)
- {
- receivedBytes = 0;
-
- final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
-
- confirmed.setChannelID(id);
-
- doWrite(confirmed);
- }
- }
-
- public void confirm(final Packet packet)
- {
- if (resendCache != null && packet.isRequiresConfirmations())
- {
- lastConfirmedCommandID++;
-
- receivedBytes += packet.getPacketSize();
-
- if (receivedBytes >= confWindowSize)
- {
- receivedBytes = 0;
-
- final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
-
- confirmed.setChannelID(id);
-
- doWrite(confirmed);
- }
- }
- }
-
- public void clearCommands()
- {
- if (resendCache != null)
- {
- lastConfirmedCommandID = -1;
-
- firstStoredCommandID = 0;
-
- resendCache.clear();
- }
- }
-
- public void handlePacket(final Packet packet)
- {
- if (packet.getType() == PacketImpl.PACKETS_CONFIRMED)
- {
- if (resendCache != null)
- {
- final PacketsConfirmedMessage msg = (PacketsConfirmedMessage)packet;
-
- clearUpTo(msg.getCommandID());
- }
-
- if (!connection.isClient())
- {
- handler.handlePacket(packet);
- }
-
- return;
- }
- else
- {
- if (packet.isResponse())
- {
- confirm(packet);
-
- lock.lock();
-
- response = packet;
-
- try
- {
- sendCondition.signal();
- }
- finally
- {
- lock.unlock();
- }
- }
- else if (handler != null)
- {
- handler.handlePacket(packet);
- }
- }
- }
-
- private void doWrite(final Packet packet)
- {
- final HornetQBuffer buffer = packet.encode(connection);
-
- connection.getTransportConnection().write(buffer);
- }
-
- private void clearUpTo(final int lastReceivedCommandID)
- {
- final int numberToClear = 1 + lastReceivedCommandID - firstStoredCommandID;
-
- if (numberToClear == -1)
- {
- throw new IllegalArgumentException("Invalid lastReceivedCommandID: " + lastReceivedCommandID);
- }
-
- int sizeToFree = 0;
-
- for (int i = 0; i < numberToClear; i++)
- {
- final Packet packet = resendCache.poll();
-
- if (packet == null)
- {
- ChannelImpl.log.warn("Can't find packet to clear: " + " last received command id " +
- lastReceivedCommandID +
- " first stored command id " +
- firstStoredCommandID);
- return;
- }
-
- if (packet.getType() != PacketImpl.PACKETS_CONFIRMED)
- {
- sizeToFree += packet.getPacketSize();
- }
-
- if (commandConfirmationHandler != null)
- {
- commandConfirmationHandler.commandConfirmed(packet);
- }
- }
-
- firstStoredCommandID += numberToClear;
- }
-}
Deleted: trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,116 +0,0 @@
-/*
- * Copyright 2010 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.protocol.core;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.protocol.core.wireformat.Ping;
-import org.hornetq.core.remoting.server.ConnectionEntry;
-import org.hornetq.core.remoting.server.ProtocolManager;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A CoreProtocolManager
- *
- * @author Tim Fox
- *
- *
- */
-public class CoreProtocolManager implements ProtocolManager
-{
- private final HornetQServer server;
-
- private final List<Interceptor> interceptors;
-
- public CoreProtocolManager(final HornetQServer server,
- final List<Interceptor> interceptors)
- {
- this.server = server;
-
- this.interceptors = interceptors;
- }
-
- public ConnectionEntry createConnectionEntry(final Connection connection)
- {
- final Configuration config = server.getConfiguration();
-
- CoreRemotingConnection rc = new RemotingConnectionImpl(connection,
- interceptors,
- config.isAsyncConnectionExecutionEnabled() ? server.getExecutorFactory().getExecutor()
- : null);
-
- Channel channel1 = rc.getChannel(1, -1);
-
- ChannelHandler handler = new HornetQPacketHandler(this, server, channel1, rc);
-
- channel1.setHandler(handler);
-
- long ttl = HornetQClient.DEFAULT_CONNECTION_TTL;
-
- if (config.getConnectionTTLOverride() != -1)
- {
- ttl = config.getConnectionTTLOverride();
- }
-
- final ConnectionEntry entry = new ConnectionEntry(rc, System.currentTimeMillis(), ttl);
-
- final Channel channel0 = rc.getChannel(0, -1);
-
- channel0.setHandler(new ChannelHandler()
- {
- public void handlePacket(final Packet packet)
- {
- if (packet.getType() == PacketImpl.PING)
- {
- Ping ping = (Ping)packet;
-
- if (config.getConnectionTTLOverride() == -1)
- {
- // Allow clients to specify connection ttl
- entry.ttl = ping.getConnectionTTL();
- }
-
- // Just send a ping back
- channel0.send(packet);
- }
- }
- });
-
- return entry;
- }
-
- private Map<String, ServerSessionPacketHandler> sessionHandlers =
- new ConcurrentHashMap<String, ServerSessionPacketHandler>();
-
- public ServerSessionPacketHandler getSessionHandler(final String sessionName)
- {
- return sessionHandlers.get(sessionName);
- }
-
- public void addSessionHandler(final String name, final ServerSessionPacketHandler handler)
- {
- sessionHandlers.put(name, handler);
- }
-
- public void removeHandler(final String name)
- {
- sessionHandlers.remove(name);
- }
-}
Modified: trunk/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/CoreRemotingConnection.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,7 +13,7 @@
package org.hornetq.core.protocol.core;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
Deleted: trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,310 +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.protocol.core;
-
-import static org.hornetq.core.protocol.core.PacketImpl.CREATESESSION;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_REPLICATION;
-import static org.hornetq.core.protocol.core.PacketImpl.REATTACH_SESSION;
-
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.replication.ReplicationEndpoint;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.version.Version;
-
-/**
- * A packet handler for all packets that need to be handled at the server level
- *
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
- */
-public class HornetQPacketHandler implements ChannelHandler
-{
- private static final Logger log = Logger.getLogger(HornetQPacketHandler.class);
-
- private final HornetQServer server;
-
- private final Channel channel1;
-
- private final CoreRemotingConnection connection;
-
- private final CoreProtocolManager protocolManager;
-
- public HornetQPacketHandler(final CoreProtocolManager protocolManager,
- final HornetQServer server,
- final Channel channel1,
- final CoreRemotingConnection connection)
- {
- this.protocolManager = protocolManager;
-
- this.server = server;
-
- this.channel1 = channel1;
-
- this.connection = connection;
- }
-
- public void handlePacket(final Packet packet)
- {
- byte type = packet.getType();
-
- switch (type)
- {
- case CREATESESSION:
- {
- CreateSessionMessage request = (CreateSessionMessage)packet;
-
- handleCreateSession(request);
-
- break;
- }
- case REATTACH_SESSION:
- {
- ReattachSessionMessage request = (ReattachSessionMessage)packet;
-
- handleReattachSession(request);
-
- break;
- }
- case CREATE_QUEUE:
- {
- // Create queue can also be fielded here in the case of a replicated store and forward queue creation
-
- CreateQueueMessage request = (CreateQueueMessage)packet;
-
- handleCreateQueue(request);
-
- break;
- }
- case CREATE_REPLICATION:
- {
- // Create queue can also be fielded here in the case of a replicated store and forward queue creation
-
- CreateReplicationSessionMessage request = (CreateReplicationSessionMessage)packet;
-
- handleCreateReplication(request);
-
- break;
- }
- default:
- {
- HornetQPacketHandler.log.error("Invalid packet " + packet);
- }
- }
- }
-
- private void handleCreateSession(final CreateSessionMessage request)
- {
- boolean incompatibleVersion = false;
- Packet response;
- try
- {
- Version version = server.getVersion();
-
- if (version.getIncrementingVersion() != request.getVersion())
- {
- log.warn("Client with version " + request.getVersion() +
- " and address " +
- connection.getRemoteAddress() +
- " is not compatible with server version " +
- version.getFullVersion() +
- ". " +
- "Please ensure all clients and servers are upgraded to the same version for them to " +
- "interoperate properly");
- throw new HornetQException(HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS,
- "Server and client versions incompatible");
- }
-
- if (!server.isStarted())
- {
- throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED, "Server not started");
- }
-
- if (!server.checkActivate())
- {
- throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED,
- "Server will not accept create session requests");
- }
-
- Channel channel = connection.getChannel(request.getSessionChannelID(), request.getWindowSize());
-
- ServerSession session = server.createSession(request.getName(),
- request.getUsername(),
- request.getPassword(),
- request.getMinLargeMessageSize(),
- connection,
- request.isAutoCommitSends(),
- request.isAutoCommitAcks(),
- request.isPreAcknowledge(),
- request.isXA());
-
- ServerSessionPacketHandler handler = new ServerSessionPacketHandler(protocolManager,
- session,
- server.getStorageManager()
- .newContext(server.getExecutorFactory()
- .getExecutor()),
- server.getStorageManager(),
- channel);
-
- session.setCallback(handler);
-
- channel.setHandler(handler);
-
- // TODO - where is this removed?
- protocolManager.addSessionHandler(request.getName(), handler);
-
- response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion());
- }
- catch (HornetQException e)
- {
- response = new HornetQExceptionMessage((HornetQException)e);
-
- if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
- {
- incompatibleVersion = true;
- }
- }
- catch (Exception e)
- {
- HornetQPacketHandler.log.error("Failed to create session", e);
-
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
- }
-
- // send the exception to the client and destroy
- // the connection if the client and server versions
- // are not compatible
- if (incompatibleVersion)
- {
- channel1.sendAndFlush(response);
- }
- else
- {
- channel1.send(response);
- }
- }
-
- private void handleReattachSession(final ReattachSessionMessage request)
- {
- Packet response = null;
-
- try
- {
-
- if (!server.isStarted())
- {
- response = new ReattachSessionResponseMessage(-1, false);
- }
-
- ServerSessionPacketHandler sessionHandler = protocolManager.getSessionHandler(request.getName());
-
- if (!server.checkActivate())
- {
- response = new ReattachSessionResponseMessage(-1, false);
- }
-
- if (sessionHandler == null)
- {
- response = new ReattachSessionResponseMessage(-1, false);
- }
- else
- {
- if (sessionHandler.getChannel().getConfirmationWindowSize() == -1)
- {
- // Even though session exists, we can't reattach since confi window size == -1,
- // i.e. we don't have a resend cache for commands, so we just close the old session
- // and let the client recreate
-
- sessionHandler.close();
-
- response = new ReattachSessionResponseMessage(-1, false);
- }
- else
- {
- // Reconnect the channel to the new connection
- int serverLastConfirmedCommandID = sessionHandler.transferConnection(connection,
- request.getLastConfirmedCommandID());
-
- response = new ReattachSessionResponseMessage(serverLastConfirmedCommandID, true);
- }
- }
- }
- catch (Exception e)
- {
- HornetQPacketHandler.log.error("Failed to reattach session", e);
-
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
- }
-
- channel1.send(response);
- }
-
- private void handleCreateQueue(final CreateQueueMessage request)
- {
- try
- {
- server.createQueue(request.getAddress(),
- request.getQueueName(),
- request.getFilterString(),
- request.isDurable(),
- request.isTemporary());
- }
- catch (Exception e)
- {
- HornetQPacketHandler.log.error("Failed to handle create queue", e);
- }
- }
-
- private void handleCreateReplication(final CreateReplicationSessionMessage request)
- {
- Packet response;
-
- try
- {
- Channel channel = connection.getChannel(request.getSessionChannelID(), -1);
-
- ReplicationEndpoint endpoint = server.connectToReplicationEndpoint(channel);
-
- channel.setHandler(endpoint);
-
- response = new NullResponseMessage();
- }
- catch (Exception e)
- {
- if (e instanceof HornetQException)
- {
- response = new HornetQExceptionMessage((HornetQException)e);
- }
- else
- {
- HornetQPacketHandler.log.warn(e.getMessage(), e);
- response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
- }
- }
-
- channel1.send(response);
- }
-
-}
\ No newline at end of file
Modified: trunk/src/main/org/hornetq/core/protocol/core/Packet.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/Packet.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/Packet.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -14,7 +14,7 @@
package org.hornetq.core.protocol.core;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A Packet represents a pcaket of data transmitted over a connection.
Deleted: trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,492 +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.protocol.core;
-
-import static org.hornetq.core.protocol.core.PacketImpl.CREATESESSION;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATESESSION_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_REPLICATION;
-import static org.hornetq.core.protocol.core.PacketImpl.DELETE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.DISCONNECT;
-import static org.hornetq.core.protocol.core.PacketImpl.EXCEPTION;
-import static org.hornetq.core.protocol.core.PacketImpl.NULL_RESPONSE;
-import static org.hornetq.core.protocol.core.PacketImpl.PACKETS_CONFIRMED;
-import static org.hornetq.core.protocol.core.PacketImpl.PING;
-import static org.hornetq.core.protocol.core.PacketImpl.REATTACH_SESSION;
-import static org.hornetq.core.protocol.core.PacketImpl.REATTACH_SESSION_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_APPEND;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_APPEND_TX;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_COMMIT_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_COMPARE_DATA;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_DELETE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_DELETE_TX;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_LARGE_MESSAGE_END;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_PAGE_EVENT;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_PAGE_WRITE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_PREPARE;
-import static org.hornetq.core.protocol.core.PacketImpl.REPLICATION_RESPONSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ACKNOWLEDGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_BINDINGQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_BINDINGQUERY_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CONSUMER_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CREATECONSUMER;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_EXPIRED;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FLOWTOKEN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_PRODUCER_CREDITS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_PRODUCER_REQUEST_CREDITS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_QUEUEQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_QUEUEQUERY_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_LARGE_MSG;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_RECEIVE_MSG;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_LARGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_STOP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_END;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_FORGET;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_GET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_GET_TIMEOUT_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_INDOUBT_XIDS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_INDOUBT_XIDS_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_JOIN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_PREPARE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_RESUME;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SET_TIMEOUT_RESP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SUSPEND;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.PacketsConfirmedMessage;
-import org.hornetq.core.protocol.core.wireformat.Ping;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReattachSessionResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAStartMessage;
-
-/**
- * A PacketDecoder
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- *
- */
-public class PacketDecoder
-{
- private static final Logger log = Logger.getLogger(PacketDecoder.class);
-
- public Packet decode(final HornetQBuffer in)
- {
- final byte packetType = in.readByte();
-
- Packet packet;
-
- switch (packetType)
- {
- case PING:
- {
- packet = new Ping();
- break;
- }
- case DISCONNECT:
- {
- packet = new PacketImpl(PacketImpl.DISCONNECT);
- break;
- }
- case EXCEPTION:
- {
- packet = new HornetQExceptionMessage();
- break;
- }
- case PACKETS_CONFIRMED:
- {
- packet = new PacketsConfirmedMessage();
- break;
- }
- case CREATESESSION:
- {
- packet = new CreateSessionMessage();
- break;
- }
- case CREATESESSION_RESP:
- {
- packet = new CreateSessionResponseMessage();
- break;
- }
- case REATTACH_SESSION:
- {
- packet = new ReattachSessionMessage();
- break;
- }
- case REATTACH_SESSION_RESP:
- {
- packet = new ReattachSessionResponseMessage();
- break;
- }
- case SESS_CLOSE:
- {
- packet = new SessionCloseMessage();
- break;
- }
- case SESS_CREATECONSUMER:
- {
- packet = new SessionCreateConsumerMessage();
- break;
- }
- case SESS_ACKNOWLEDGE:
- {
- packet = new SessionAcknowledgeMessage();
- break;
- }
- case SESS_EXPIRED:
- {
- packet = new SessionExpiredMessage();
- break;
- }
- case SESS_COMMIT:
- {
- packet = new SessionCommitMessage();
- break;
- }
- case SESS_ROLLBACK:
- {
- packet = new RollbackMessage();
- break;
- }
- case SESS_QUEUEQUERY:
- {
- packet = new SessionQueueQueryMessage();
- break;
- }
- case SESS_QUEUEQUERY_RESP:
- {
- packet = new SessionQueueQueryResponseMessage();
- break;
- }
- case CREATE_QUEUE:
- {
- packet = new CreateQueueMessage();
- break;
- }
- case DELETE_QUEUE:
- {
- packet = new SessionDeleteQueueMessage();
- break;
- }
- case SESS_BINDINGQUERY:
- {
- packet = new SessionBindingQueryMessage();
- break;
- }
- case SESS_BINDINGQUERY_RESP:
- {
- packet = new SessionBindingQueryResponseMessage();
- break;
- }
- case SESS_XA_START:
- {
- packet = new SessionXAStartMessage();
- break;
- }
- case SESS_XA_END:
- {
- packet = new SessionXAEndMessage();
- break;
- }
- case SESS_XA_COMMIT:
- {
- packet = new SessionXACommitMessage();
- break;
- }
- case SESS_XA_PREPARE:
- {
- packet = new SessionXAPrepareMessage();
- break;
- }
- case SESS_XA_RESP:
- {
- packet = new SessionXAResponseMessage();
- break;
- }
- case SESS_XA_ROLLBACK:
- {
- packet = new SessionXARollbackMessage();
- break;
- }
- case SESS_XA_JOIN:
- {
- packet = new SessionXAJoinMessage();
- break;
- }
- case SESS_XA_SUSPEND:
- {
- packet = new PacketImpl(PacketImpl.SESS_XA_SUSPEND);
- break;
- }
- case SESS_XA_RESUME:
- {
- packet = new SessionXAResumeMessage();
- break;
- }
- case SESS_XA_FORGET:
- {
- packet = new SessionXAForgetMessage();
- break;
- }
- case SESS_XA_INDOUBT_XIDS:
- {
- packet = new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS);
- break;
- }
- case SESS_XA_INDOUBT_XIDS_RESP:
- {
- packet = new SessionXAGetInDoubtXidsResponseMessage();
- break;
- }
- case SESS_XA_SET_TIMEOUT:
- {
- packet = new SessionXASetTimeoutMessage();
- break;
- }
- case SESS_XA_SET_TIMEOUT_RESP:
- {
- packet = new SessionXASetTimeoutResponseMessage();
- break;
- }
- case SESS_XA_GET_TIMEOUT:
- {
- packet = new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT);
- break;
- }
- case SESS_XA_GET_TIMEOUT_RESP:
- {
- packet = new SessionXAGetTimeoutResponseMessage();
- break;
- }
- case SESS_START:
- {
- packet = new PacketImpl(PacketImpl.SESS_START);
- break;
- }
- case SESS_STOP:
- {
- packet = new PacketImpl(PacketImpl.SESS_STOP);
- break;
- }
- case SESS_FLOWTOKEN:
- {
- packet = new SessionConsumerFlowCreditMessage();
- break;
- }
- case SESS_SEND:
- {
- packet = new SessionSendMessage();
- break;
- }
- case SESS_SEND_LARGE:
- {
- packet = new SessionSendLargeMessage();
- break;
- }
- case SESS_RECEIVE_MSG:
- {
- packet = new SessionReceiveMessage();
- break;
- }
- case SESS_RECEIVE_LARGE_MSG:
- {
- packet = new SessionReceiveLargeMessage();
- break;
- }
- case SESS_CONSUMER_CLOSE:
- {
- packet = new SessionConsumerCloseMessage();
- break;
- }
- case NULL_RESPONSE:
- {
- packet = new NullResponseMessage();
- break;
- }
- case SESS_RECEIVE_CONTINUATION:
- {
- packet = new SessionReceiveContinuationMessage();
- break;
- }
- case SESS_SEND_CONTINUATION:
- {
- packet = new SessionSendContinuationMessage();
- break;
- }
- case SESS_PRODUCER_REQUEST_CREDITS:
- {
- packet = new SessionRequestProducerCreditsMessage();
- break;
- }
- case SESS_PRODUCER_CREDITS:
- {
- packet = new SessionProducerCreditsMessage();
- break;
- }
- case CREATE_REPLICATION:
- {
- packet = new CreateReplicationSessionMessage();
- break;
- }
- case REPLICATION_APPEND:
- {
- packet = new ReplicationAddMessage();
- break;
- }
- case REPLICATION_APPEND_TX:
- {
- packet = new ReplicationAddTXMessage();
- break;
- }
- case REPLICATION_DELETE:
- {
- packet = new ReplicationDeleteMessage();
- break;
- }
- case REPLICATION_DELETE_TX:
- {
- packet = new ReplicationDeleteTXMessage();
- break;
- }
- case REPLICATION_PREPARE:
- {
- packet = new ReplicationPrepareMessage();
- break;
- }
- case REPLICATION_COMMIT_ROLLBACK:
- {
- packet = new ReplicationCommitMessage();
- break;
- }
- case REPLICATION_RESPONSE:
- {
- packet = new ReplicationResponseMessage();
- break;
- }
- case REPLICATION_PAGE_WRITE:
- {
- packet = new ReplicationPageWriteMessage();
- break;
- }
- case REPLICATION_PAGE_EVENT:
- {
- packet = new ReplicationPageEventMessage();
- break;
- }
- case REPLICATION_LARGE_MESSAGE_BEGIN:
- {
- packet = new ReplicationLargeMessageBeingMessage();
- break;
- }
- case REPLICATION_LARGE_MESSAGE_END:
- {
- packet = new ReplicationLargemessageEndMessage();
- break;
- }
- case REPLICATION_LARGE_MESSAGE_WRITE:
- {
- packet = new ReplicationLargeMessageWriteMessage();
- break;
- }
- case REPLICATION_COMPARE_DATA:
- {
- packet = new ReplicationCompareDataMessage();
- break;
- }
- case SESS_FORCE_CONSUMER_DELIVERY:
- {
- packet = new SessionForceConsumerDelivery();
- break;
- }
- default:
- {
- throw new IllegalArgumentException("Invalid type: " + packetType);
- }
- }
-
- packet.decode(in);
-
- return packet;
- }
-
-}
Deleted: trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,310 +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.protocol.core;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
-import org.hornetq.utils.DataConstants;
-
-/**
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision$</tt>
- */
-public class PacketImpl implements Packet
-{
- // Constants -------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(PacketImpl.class);
-
- // The minimal size for all the packets, Common data for all the packets (look at PacketImpl.encode)
- public static final int PACKET_HEADERS_SIZE = DataConstants.SIZE_INT + DataConstants.SIZE_BYTE +
- DataConstants.SIZE_LONG;
-
- private static final int INITIAL_PACKET_SIZE = 1500;
-
- protected long channelID;
-
- protected final byte type;
-
- protected int size = -1;
-
- // The packet types
- // -----------------------------------------------------------------------------------
-
- public static final byte PING = 10;
-
- public static final byte DISCONNECT = 11;
-
- // Miscellaneous
- public static final byte EXCEPTION = 20;
-
- public static final byte NULL_RESPONSE = 21;
-
- public static final byte PACKETS_CONFIRMED = 22;
-
- // Server
- public static final byte CREATESESSION = 30;
-
- public static final byte CREATESESSION_RESP = 31;
-
- public static final byte REATTACH_SESSION = 32;
-
- public static final byte REATTACH_SESSION_RESP = 33;
-
- public static final byte CREATE_QUEUE = 34;
-
- public static final byte DELETE_QUEUE = 35;
-
- public static final byte CREATE_REPLICATION = 36;
-
- // Session
- public static final byte SESS_CREATECONSUMER = 40;
-
- public static final byte SESS_ACKNOWLEDGE = 41;
-
- public static final byte SESS_EXPIRED = 42;
-
- public static final byte SESS_COMMIT = 43;
-
- public static final byte SESS_ROLLBACK = 44;
-
- public static final byte SESS_QUEUEQUERY = 45;
-
- public static final byte SESS_QUEUEQUERY_RESP = 46;
-
- public static final byte SESS_BINDINGQUERY = 49;
-
- public static final byte SESS_BINDINGQUERY_RESP = 50;
-
- public static final byte SESS_XA_START = 51;
-
- public static final byte SESS_XA_END = 52;
-
- public static final byte SESS_XA_COMMIT = 53;
-
- public static final byte SESS_XA_PREPARE = 54;
-
- public static final byte SESS_XA_RESP = 55;
-
- public static final byte SESS_XA_ROLLBACK = 56;
-
- public static final byte SESS_XA_JOIN = 57;
-
- public static final byte SESS_XA_SUSPEND = 58;
-
- public static final byte SESS_XA_RESUME = 59;
-
- public static final byte SESS_XA_FORGET = 60;
-
- public static final byte SESS_XA_INDOUBT_XIDS = 61;
-
- public static final byte SESS_XA_INDOUBT_XIDS_RESP = 62;
-
- public static final byte SESS_XA_SET_TIMEOUT = 63;
-
- public static final byte SESS_XA_SET_TIMEOUT_RESP = 64;
-
- public static final byte SESS_XA_GET_TIMEOUT = 65;
-
- public static final byte SESS_XA_GET_TIMEOUT_RESP = 66;
-
- public static final byte SESS_START = 67;
-
- public static final byte SESS_STOP = 68;
-
- public static final byte SESS_CLOSE = 69;
-
- public static final byte SESS_FLOWTOKEN = 70;
-
- public static final byte SESS_SEND = 71;
-
- public static final byte SESS_SEND_LARGE = 72;
-
- public static final byte SESS_SEND_CONTINUATION = 73;
-
- public static final byte SESS_CONSUMER_CLOSE = 74;
-
- public static final byte SESS_RECEIVE_MSG = 75;
-
- public static final byte SESS_RECEIVE_LARGE_MSG = 76;
-
- public static final byte SESS_RECEIVE_CONTINUATION = 77;
-
- public static final byte SESS_FORCE_CONSUMER_DELIVERY = 78;
-
- public static final byte SESS_PRODUCER_REQUEST_CREDITS = 79;
-
- public static final byte SESS_PRODUCER_CREDITS = 80;
-
- // Replication
-
- public static final byte REPLICATION_RESPONSE = 90;
-
- public static final byte REPLICATION_APPEND = 91;
-
- public static final byte REPLICATION_APPEND_TX = 92;
-
- public static final byte REPLICATION_DELETE = 93;
-
- public static final byte REPLICATION_DELETE_TX = 94;
-
- public static final byte REPLICATION_PREPARE = 95;
-
- public static final byte REPLICATION_COMMIT_ROLLBACK = 96;
-
- public static final byte REPLICATION_PAGE_WRITE = 97;
-
- public static final byte REPLICATION_PAGE_EVENT = 98;
-
- public static final byte REPLICATION_LARGE_MESSAGE_BEGIN = 99;
-
- public static final byte REPLICATION_LARGE_MESSAGE_END = 100;
-
- public static final byte REPLICATION_LARGE_MESSAGE_WRITE = 101;
-
- public static final byte REPLICATION_COMPARE_DATA = 102;
-
- public static final byte REPLICATION_SYNC = 103;
-
- // Static --------------------------------------------------------
-
- public PacketImpl(final byte type)
- {
- this.type = type;
- }
-
- // Public --------------------------------------------------------
-
- public byte getType()
- {
- return type;
- }
-
- public long getChannelID()
- {
- return channelID;
- }
-
- public void setChannelID(final long channelID)
- {
- this.channelID = channelID;
- }
-
- public HornetQBuffer encode(final RemotingConnection connection)
- {
- HornetQBuffer buffer = connection.createBuffer(PacketImpl.INITIAL_PACKET_SIZE);
-
- // The standard header fields
-
- buffer.writeInt(0); // The length gets filled in at the end
- buffer.writeByte(type);
- buffer.writeLong(channelID);
-
- encodeRest(buffer);
-
- size = buffer.writerIndex();
-
- // The length doesn't include the actual length byte
- int len = size - DataConstants.SIZE_INT;
-
- buffer.setInt(0, len);
-
- return buffer;
- }
-
- public void decode(final HornetQBuffer buffer)
- {
- channelID = buffer.readLong();
-
- decodeRest(buffer);
-
- size = buffer.readerIndex();
- }
-
- public int getPacketSize()
- {
- if (size == -1)
- {
- throw new IllegalStateException("Packet hasn't been encoded/decoded yet");
- }
-
- return size;
- }
-
- public boolean isResponse()
- {
- return false;
- }
-
- public void encodeRest(final HornetQBuffer buffer)
- {
- }
-
- public void decodeRest(final HornetQBuffer buffer)
- {
- }
-
- public boolean isRequiresConfirmations()
- {
- return true;
- }
-
- public boolean isAsyncExec()
- {
- return false;
- }
-
- @Override
- public String toString()
- {
- return getParentString() + "]";
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other instanceof PacketImpl == false)
- {
- return false;
- }
-
- PacketImpl r = (PacketImpl)other;
-
- return r.type == type && r.channelID == channelID;
- }
-
- // Package protected ---------------------------------------------
-
- protected String getParentString()
- {
- return "PACKET[type=" + type + ", channelID=" + channelID + "]";
- }
-
- // Protected -----------------------------------------------------
-
- protected int stringEncodeSize(final String str)
- {
- return DataConstants.SIZE_INT + str.length() * 2;
- }
-
- protected int nullableStringEncodeSize(final String str)
- {
- return DataConstants.SIZE_BOOLEAN + (str != null ? stringEncodeSize(str) : 0);
- }
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Deleted: trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,509 +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.protocol.core;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.Executor;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
-import org.hornetq.spi.core.remoting.Connection;
-import org.hornetq.utils.SimpleIDGenerator;
-
-/**
- * @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- * @version <tt>$Revision$</tt> $Id$
- */
-public class RemotingConnectionImpl extends AbstractBufferHandler implements CoreRemotingConnection
-{
- // Constants
- // ------------------------------------------------------------------------------------
-
- private static final Logger log = Logger.getLogger(RemotingConnectionImpl.class);
-
- // Static
- // ---------------------------------------------------------------------------------------
-
- // Attributes
- // -----------------------------------------------------------------------------------
-
- private final Connection transportConnection;
-
- private final Map<Long, Channel> channels = new ConcurrentHashMap<Long, Channel>();
-
- private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
-
- private final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>();
-
- private final long blockingCallTimeout;
-
- private final List<Interceptor> interceptors;
-
- private volatile boolean destroyed;
-
- private final boolean client;
-
- // Channels 0-9 are reserved for the system
- // 0 is for pinging
- // 1 is for session creation and attachment
- // 2 is for replication
- private volatile SimpleIDGenerator idGenerator = new SimpleIDGenerator(10);
-
- private boolean idGeneratorSynced = false;
-
- private final Object transferLock = new Object();
-
- private final Object failLock = new Object();
-
- private final PacketDecoder decoder = new PacketDecoder();
-
- private volatile boolean dataReceived;
-
- private final Executor executor;
-
- private volatile boolean executing;
-
- // Constructors
- // ---------------------------------------------------------------------------------
-
- /*
- * Create a client side connection
- */
- public RemotingConnectionImpl(final Connection transportConnection,
- final long blockingCallTimeout,
- final List<Interceptor> interceptors)
- {
- this(transportConnection, blockingCallTimeout, interceptors, true, null);
- }
-
- /*
- * Create a server side connection
- */
- public RemotingConnectionImpl(final Connection transportConnection,
- final List<Interceptor> interceptors,
- final Executor executor)
-
- {
- this(transportConnection, -1, interceptors, false, executor);
- }
-
- private RemotingConnectionImpl(final Connection transportConnection,
- final long blockingCallTimeout,
- final List<Interceptor> interceptors,
- final boolean client,
- final Executor executor)
-
- {
- this.transportConnection = transportConnection;
-
- this.blockingCallTimeout = blockingCallTimeout;
-
- this.interceptors = interceptors;
-
- this.client = client;
-
- this.executor = executor;
- }
-
- // RemotingConnection implementation
- // ------------------------------------------------------------
-
- public Connection getTransportConnection()
- {
- return transportConnection;
- }
-
- public List<FailureListener> getFailureListeners()
- {
- return new ArrayList<FailureListener>(failureListeners);
- }
-
- public void setFailureListeners(final List<FailureListener> listeners)
- {
- failureListeners.clear();
-
- failureListeners.addAll(listeners);
- }
-
- public Object getID()
- {
- return transportConnection.getID();
- }
-
- public String getRemoteAddress()
- {
- return transportConnection.getRemoteAddress();
- }
-
- public synchronized Channel getChannel(final long channelID, final int confWindowSize)
- {
- Channel channel = channels.get(channelID);
-
- if (channel == null)
- {
- channel = new ChannelImpl(this, channelID, confWindowSize);
-
- channels.put(channelID, channel);
- }
-
- return channel;
- }
-
- public synchronized boolean removeChannel(final long channelID)
- {
- return channels.remove(channelID) != null;
- }
-
- public synchronized void putChannel(final long channelID, final Channel channel)
- {
- channels.put(channelID, channel);
- }
-
- public void addFailureListener(final FailureListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("FailureListener cannot be null");
- }
-
- failureListeners.add(listener);
- }
-
- public boolean removeFailureListener(final FailureListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("FailureListener cannot be null");
- }
-
- return failureListeners.remove(listener);
- }
-
- public void addCloseListener(final CloseListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("CloseListener cannot be null");
- }
-
- closeListeners.add(listener);
- }
-
- public boolean removeCloseListener(final CloseListener listener)
- {
- if (listener == null)
- {
- throw new IllegalStateException("CloseListener cannot be null");
- }
-
- return closeListeners.remove(listener);
- }
-
- public HornetQBuffer createBuffer(final int size)
- {
- return transportConnection.createBuffer(size);
- }
-
- /*
- * This can be called concurrently by more than one thread so needs to be locked
- */
- public void fail(final HornetQException me)
- {
- synchronized (failLock)
- {
- if (destroyed)
- {
- return;
- }
-
- destroyed = true;
- }
-
- RemotingConnectionImpl.log.warn("Connection failure has been detected: " + me.getMessage() +
- " [code=" +
- me.getCode() +
- "]");
-
- // Then call the listeners
- callFailureListeners(me);
-
- callClosingListeners();
-
- internalClose();
-
- for (Channel channel : channels.values())
- {
- channel.returnBlocking();
- }
- }
-
- public void destroy()
- {
- synchronized (failLock)
- {
- if (destroyed)
- {
- return;
- }
-
- destroyed = true;
- }
-
- internalClose();
-
- callClosingListeners();
- }
-
- public void disconnect()
- {
- Channel channel0 = getChannel(0, -1);
-
- // And we remove all channels from the connection, this ensures no more packets will be processed after this
- // method is
- // complete
-
- Set<Channel> allChannels = new HashSet<Channel>(channels.values());
-
- removeAllChannels();
-
- // Now we are 100% sure that no more packets will be processed we can flush then send the disconnect
-
- for (Channel channel: allChannels)
- {
- channel.flushConfirmations();
- }
-
- channel0.sendAndFlush(new PacketImpl(PacketImpl.DISCONNECT));
- }
-
- public long generateChannelID()
- {
- return idGenerator.generateID();
- }
-
- public synchronized void syncIDGeneratorSequence(final long id)
- {
- if (!idGeneratorSynced)
- {
- idGenerator = new SimpleIDGenerator(id);
-
- idGeneratorSynced = true;
- }
- }
-
- public long getIDGeneratorSequence()
- {
- return idGenerator.getCurrentID();
- }
-
- public Object getTransferLock()
- {
- return transferLock;
- }
-
- public boolean isClient()
- {
- return client;
- }
-
- public boolean isDestroyed()
- {
- return destroyed;
- }
-
- public long getBlockingCallTimeout()
- {
- return blockingCallTimeout;
- }
-
- public boolean checkDataReceived()
- {
- boolean res = dataReceived;
-
- dataReceived = false;
-
- return res;
- }
-
- //We flush any confirmations on the connection - this prevents idle bridges for example
- //sitting there with many unacked messages
- public void flush()
- {
- synchronized (transferLock)
- {
- for (Channel channel : channels.values())
- {
- channel.flushConfirmations();
- }
- }
- }
-
- // Buffer Handler implementation
- // ----------------------------------------------------
-
- public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
- {
- final Packet packet = decoder.decode(buffer);
-
- if (packet.isAsyncExec() && executor != null)
- {
- executing = true;
-
- executor.execute(new Runnable()
- {
- public void run()
- {
- try
- {
- doBufferReceived(packet);
- }
- catch (Throwable t)
- {
- RemotingConnectionImpl.log.error("Unexpected error", t);
- }
-
- executing = false;
- }
- });
- }
- else
- {
- //To prevent out of order execution if interleaving sync and async operations on same connection
- while (executing)
- {
- Thread.yield();
- }
-
- // Pings must always be handled out of band so we can send pings back to the client quickly
- // otherwise they would get in the queue with everything else which might give an intolerable delay
- doBufferReceived(packet);
- }
-
- dataReceived = true;
- }
-
- private void doBufferReceived(final Packet packet)
- {
- if (interceptors != null)
- {
- for (final Interceptor interceptor : interceptors)
- {
- try
- {
- boolean callNext = interceptor.intercept(packet, this);
-
- if (!callNext)
- {
- return;
- }
- }
- catch (final Throwable e)
- {
- RemotingConnectionImpl.log.warn("Failure in calling interceptor: " + interceptor, e);
- }
- }
- }
-
- synchronized (transferLock)
- {
- final Channel channel = channels.get(packet.getChannelID());
-
- if (channel != null)
- {
- channel.handlePacket(packet);
- }
- }
- }
-
- // Package protected
- // ----------------------------------------------------------------------------
-
- // Protected
- // ------------------------------------------------------------------------------------
-
- // Private
- // --------------------------------------------------------------------------------------
-
- private void removeAllChannels()
- {
- // We get the transfer lock first - this ensures no packets are being processed AND
- // it's guaranteed no more packets will be processed once this method is complete
- synchronized (transferLock)
- {
- channels.clear();
- }
- }
- private void callFailureListeners(final HornetQException me)
- {
- final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
-
- for (final FailureListener listener : listenersClone)
- {
- try
- {
- listener.connectionFailed(me);
- }
- catch (final Throwable t)
- {
- // Failure of one listener to execute shouldn't prevent others
- // from
- // executing
- RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
- }
- }
- }
-
- private void callClosingListeners()
- {
- final List<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners);
-
- for (final CloseListener listener : listenersClone)
- {
- try
- {
- listener.connectionClosed();
- }
- catch (final Throwable t)
- {
- // Failure of one listener to execute shouldn't prevent others
- // from
- // executing
- RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
- }
- }
- }
-
- private void internalClose()
- {
- // We close the underlying transport connection
- transportConnection.close();
-
- for (Channel channel : channels.values())
- {
- channel.close();
- }
- }
-}
Modified: trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/protocol/core/ServerSessionPacketHandler.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,36 +13,36 @@
package org.hornetq.core.protocol.core;
-import static org.hornetq.core.protocol.core.PacketImpl.CREATE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.DELETE_QUEUE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ACKNOWLEDGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_BINDINGQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CONSUMER_CLOSE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_CREATECONSUMER;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_EXPIRED;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FLOWTOKEN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_QUEUEQUERY;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_CONTINUATION;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_SEND_LARGE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_STOP;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_COMMIT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_END;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_FORGET;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_GET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_INDOUBT_XIDS;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_JOIN;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_PREPARE;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_RESUME;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_ROLLBACK;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SET_TIMEOUT;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_START;
-import static org.hornetq.core.protocol.core.PacketImpl.SESS_XA_SUSPEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ACKNOWLEDGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CONSUMER_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CREATECONSUMER;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_EXPIRED;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FLOWTOKEN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_LARGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_STOP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_END;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_FORGET;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_JOIN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_PREPARE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESUME;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SUSPEND;
import java.util.List;
@@ -56,49 +56,51 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.persistence.OperationContext;
import org.hornetq.core.persistence.StorageManager;
-import org.hornetq.core.protocol.core.wireformat.CreateQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.RollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionAcknowledgeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionBindingQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerCloseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionConsumerFlowCreditMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionCreateConsumerMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionDeleteQueueMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionExpiredMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionForceConsumerDelivery;
-import org.hornetq.core.protocol.core.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionRequestProducerCreditsMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendLargeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXACommitMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAEndMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAForgetMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetInDoubtXidsResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAGetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAJoinMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAResumeMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXARollbackMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXASetTimeoutResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionXAStartMessage;
+import org.hornetq.core.protocol.core.impl.CoreProtocolManager;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
import org.hornetq.core.remoting.CloseListener;
import org.hornetq.core.remoting.FailureListener;
import org.hornetq.core.server.BindingQueryResult;
import org.hornetq.core.server.QueueQueryResult;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.SessionCallback;
+import org.hornetq.spi.core.protocol.SessionCallback;
/**
* A ServerSessionPacketHandler
Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/AbstractBufferHandler.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,46 @@
+/*
+ * 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.protocol.core.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@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;
+ }
+}
Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/ChannelImpl.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,513 @@
+/*
+ * 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.protocol.core.impl;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.ChannelHandler;
+import org.hornetq.core.protocol.core.CommandConfirmationHandler;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.PacketsConfirmedMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+
+/**
+ * A ChannelImpl
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ */
+public class ChannelImpl implements Channel
+{
+ private static final Logger log = Logger.getLogger(ChannelImpl.class);
+
+ private volatile long id;
+
+ private ChannelHandler handler;
+
+ private Packet response;
+
+ private final java.util.Queue<Packet> resendCache;
+
+ private volatile int firstStoredCommandID;
+
+ private volatile int lastConfirmedCommandID = -1;
+
+ private volatile CoreRemotingConnection connection;
+
+ private volatile boolean closed;
+
+ private final Lock lock = new ReentrantLock();
+
+ private final Condition sendCondition = lock.newCondition();
+
+ private final Condition failoverCondition = lock.newCondition();
+
+ private final Object sendLock = new Object();
+
+ private final Object sendBlockingLock = new Object();
+
+ private boolean failingOver;
+
+ private final int confWindowSize;
+
+ private int receivedBytes;
+
+ private CommandConfirmationHandler commandConfirmationHandler;
+
+ private volatile boolean transferring;
+
+ public ChannelImpl(final CoreRemotingConnection connection, final long id, final int confWindowSize)
+ {
+ this.connection = connection;
+
+ this.id = id;
+
+ this.confWindowSize = confWindowSize;
+
+ if (confWindowSize != -1)
+ {
+ resendCache = new ConcurrentLinkedQueue<Packet>();
+ }
+ else
+ {
+ resendCache = null;
+ }
+ }
+
+ public long getID()
+ {
+ return id;
+ }
+
+ public int getLastConfirmedCommandID()
+ {
+ return lastConfirmedCommandID;
+ }
+
+ public Lock getLock()
+ {
+ return lock;
+ }
+
+ public int getConfirmationWindowSize()
+ {
+ return confWindowSize;
+ }
+
+ public void returnBlocking()
+ {
+ lock.lock();
+
+ try
+ {
+ response = new HornetQExceptionMessage(new HornetQException(HornetQException.UNBLOCKED,
+ "Connection failure detected. Unblocking a blocking call that will never get a response"
+
+ ));
+
+ sendCondition.signal();
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+
+ public void sendAndFlush(final Packet packet)
+ {
+ send(packet, true);
+ }
+
+ public void send(final Packet packet)
+ {
+ send(packet, false);
+ }
+
+ public void setTransferring(boolean transferring)
+ {
+ this.transferring = transferring;
+ }
+
+ // This must never called by more than one thread concurrently
+ public void send(final Packet packet, final boolean flush)
+ {
+ synchronized (sendLock)
+ {
+ packet.setChannelID(id);
+
+ final HornetQBuffer buffer = packet.encode(connection);
+
+ lock.lock();
+
+ try
+ {
+ while (failingOver)
+ {
+ // TODO - don't hardcode this timeout
+ try
+ {
+ failoverCondition.await(10000, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+
+ //Sanity check
+ if (transferring)
+ {
+ throw new IllegalStateException("Cannot send a packet while channel is doing failover");
+ }
+
+
+ if (resendCache != null && packet.isRequiresConfirmations())
+ {
+ resendCache.add(packet);
+ }
+
+ connection.getTransportConnection().write(buffer, flush);
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+ }
+
+ public Packet sendBlocking(final Packet packet) throws HornetQException
+ {
+ if (closed)
+ {
+ throw new HornetQException(HornetQException.NOT_CONNECTED, "Connection is destroyed");
+ }
+
+ if (connection.getBlockingCallTimeout() == -1)
+ {
+ throw new IllegalStateException("Cannot do a blocking call timeout on a server side connection");
+ }
+
+ // Synchronized since can't be called concurrently by more than one thread and this can occur
+ // E.g. blocking acknowledge() from inside a message handler at some time as other operation on main thread
+ synchronized (sendBlockingLock)
+ {
+ packet.setChannelID(id);
+
+ final HornetQBuffer buffer = packet.encode(connection);
+
+ lock.lock();
+
+ try
+ {
+ while (failingOver)
+ {
+ // TODO - don't hardcode this timeout
+ try
+ {
+ failoverCondition.await(10000, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+
+ response = null;
+
+ if (resendCache != null && packet.isRequiresConfirmations())
+ {
+ resendCache.add(packet);
+ }
+
+ connection.getTransportConnection().write(buffer);
+
+ long toWait = connection.getBlockingCallTimeout();
+
+ long start = System.currentTimeMillis();
+
+ while (response == null && toWait > 0)
+ {
+ try
+ {
+ sendCondition.await(toWait, TimeUnit.MILLISECONDS);
+ }
+ catch (InterruptedException e)
+ {
+ }
+
+ if (closed)
+ {
+ break;
+ }
+
+ final long now = System.currentTimeMillis();
+
+ toWait -= now - start;
+
+ start = now;
+ }
+
+ if (response == null)
+ {
+ throw new HornetQException(HornetQException.CONNECTION_TIMEDOUT,
+ "Timed out waiting for response when sending packet " + packet.getType());
+ }
+
+ if (response.getType() == PacketImpl.EXCEPTION)
+ {
+ final HornetQExceptionMessage mem = (HornetQExceptionMessage)response;
+
+ HornetQException e = mem.getException();
+
+ e.fillInStackTrace();
+
+ throw e;
+ }
+ }
+ finally
+ {
+ lock.unlock();
+ }
+
+ return response;
+ }
+ }
+
+ public void setCommandConfirmationHandler(final CommandConfirmationHandler handler)
+ {
+ commandConfirmationHandler = handler;
+ }
+
+ public void setHandler(final ChannelHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ public void close()
+ {
+ if (closed)
+ {
+ return;
+ }
+
+ if (!connection.isDestroyed() && !connection.removeChannel(id))
+ {
+ throw new IllegalArgumentException("Cannot find channel with id " + id + " to close");
+ }
+
+ closed = true;
+ }
+
+ public void transferConnection(final CoreRemotingConnection newConnection)
+ {
+ // Needs to synchronize on the connection to make sure no packets from
+ // the old connection get processed after transfer has occurred
+ synchronized (connection.getTransferLock())
+ {
+ connection.removeChannel(id);
+
+ // And switch it
+
+ final CoreRemotingConnection rnewConnection = (CoreRemotingConnection)newConnection;
+
+ rnewConnection.putChannel(id, this);
+
+ connection = rnewConnection;
+
+ transferring = true;
+ }
+ }
+
+ public void replayCommands(final int otherLastConfirmedCommandID)
+ {
+ if (resendCache != null)
+ {
+ clearUpTo(otherLastConfirmedCommandID);
+
+ for (final Packet packet : resendCache)
+ {
+ doWrite(packet);
+ }
+ }
+ }
+
+ public void lock()
+ {
+ lock.lock();
+
+ failingOver = true;
+
+ lock.unlock();
+ }
+
+ public void unlock()
+ {
+ lock.lock();
+
+ failingOver = false;
+
+ failoverCondition.signalAll();
+
+ lock.unlock();
+ }
+
+ public CoreRemotingConnection getConnection()
+ {
+ return connection;
+ }
+
+ //Needs to be synchronized since can be called by remoting service timer thread too for timeout flush
+ public synchronized void flushConfirmations()
+ {
+ if (resendCache != null && receivedBytes != 0)
+ {
+ receivedBytes = 0;
+
+ final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
+
+ confirmed.setChannelID(id);
+
+ doWrite(confirmed);
+ }
+ }
+
+ public void confirm(final Packet packet)
+ {
+ if (resendCache != null && packet.isRequiresConfirmations())
+ {
+ lastConfirmedCommandID++;
+
+ receivedBytes += packet.getPacketSize();
+
+ if (receivedBytes >= confWindowSize)
+ {
+ receivedBytes = 0;
+
+ final Packet confirmed = new PacketsConfirmedMessage(lastConfirmedCommandID);
+
+ confirmed.setChannelID(id);
+
+ doWrite(confirmed);
+ }
+ }
+ }
+
+ public void clearCommands()
+ {
+ if (resendCache != null)
+ {
+ lastConfirmedCommandID = -1;
+
+ firstStoredCommandID = 0;
+
+ resendCache.clear();
+ }
+ }
+
+ public void handlePacket(final Packet packet)
+ {
+ if (packet.getType() == PacketImpl.PACKETS_CONFIRMED)
+ {
+ if (resendCache != null)
+ {
+ final PacketsConfirmedMessage msg = (PacketsConfirmedMessage)packet;
+
+ clearUpTo(msg.getCommandID());
+ }
+
+ if (!connection.isClient())
+ {
+ handler.handlePacket(packet);
+ }
+
+ return;
+ }
+ else
+ {
+ if (packet.isResponse())
+ {
+ confirm(packet);
+
+ lock.lock();
+
+ response = packet;
+
+ try
+ {
+ sendCondition.signal();
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+ else if (handler != null)
+ {
+ handler.handlePacket(packet);
+ }
+ }
+ }
+
+ private void doWrite(final Packet packet)
+ {
+ final HornetQBuffer buffer = packet.encode(connection);
+
+ connection.getTransportConnection().write(buffer);
+ }
+
+ private void clearUpTo(final int lastReceivedCommandID)
+ {
+ final int numberToClear = 1 + lastReceivedCommandID - firstStoredCommandID;
+
+ if (numberToClear == -1)
+ {
+ throw new IllegalArgumentException("Invalid lastReceivedCommandID: " + lastReceivedCommandID);
+ }
+
+ int sizeToFree = 0;
+
+ for (int i = 0; i < numberToClear; i++)
+ {
+ final Packet packet = resendCache.poll();
+
+ if (packet == null)
+ {
+ ChannelImpl.log.warn("Can't find packet to clear: " + " last received command id " +
+ lastReceivedCommandID +
+ " first stored command id " +
+ firstStoredCommandID);
+ return;
+ }
+
+ if (packet.getType() != PacketImpl.PACKETS_CONFIRMED)
+ {
+ sizeToFree += packet.getPacketSize();
+ }
+
+ if (commandConfirmationHandler != null)
+ {
+ commandConfirmationHandler.commandConfirmed(packet);
+ }
+ }
+
+ firstStoredCommandID += numberToClear;
+ }
+}
Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/CoreProtocolManager.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2010 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.protocol.core.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.ChannelHandler;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.ServerSessionPacketHandler;
+import org.hornetq.core.protocol.core.impl.wireformat.Ping;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.ConnectionEntry;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A CoreProtocolManager
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class CoreProtocolManager implements ProtocolManager
+{
+ private final HornetQServer server;
+
+ private final List<Interceptor> interceptors;
+
+ public CoreProtocolManager(final HornetQServer server,
+ final List<Interceptor> interceptors)
+ {
+ this.server = server;
+
+ this.interceptors = interceptors;
+ }
+
+ public ConnectionEntry createConnectionEntry(final Connection connection)
+ {
+ final Configuration config = server.getConfiguration();
+
+ CoreRemotingConnection rc = new RemotingConnectionImpl(connection,
+ interceptors,
+ config.isAsyncConnectionExecutionEnabled() ? server.getExecutorFactory().getExecutor()
+ : null);
+
+ Channel channel1 = rc.getChannel(1, -1);
+
+ ChannelHandler handler = new HornetQPacketHandler(this, server, channel1, rc);
+
+ channel1.setHandler(handler);
+
+ long ttl = HornetQClient.DEFAULT_CONNECTION_TTL;
+
+ if (config.getConnectionTTLOverride() != -1)
+ {
+ ttl = config.getConnectionTTLOverride();
+ }
+
+ final ConnectionEntry entry = new ConnectionEntry(rc, System.currentTimeMillis(), ttl);
+
+ final Channel channel0 = rc.getChannel(0, -1);
+
+ channel0.setHandler(new ChannelHandler()
+ {
+ public void handlePacket(final Packet packet)
+ {
+ if (packet.getType() == PacketImpl.PING)
+ {
+ Ping ping = (Ping)packet;
+
+ if (config.getConnectionTTLOverride() == -1)
+ {
+ // Allow clients to specify connection ttl
+ entry.ttl = ping.getConnectionTTL();
+ }
+
+ // Just send a ping back
+ channel0.send(packet);
+ }
+ }
+ });
+
+ return entry;
+ }
+
+ private Map<String, ServerSessionPacketHandler> sessionHandlers =
+ new ConcurrentHashMap<String, ServerSessionPacketHandler>();
+
+ public ServerSessionPacketHandler getSessionHandler(final String sessionName)
+ {
+ return sessionHandlers.get(sessionName);
+ }
+
+ public void addSessionHandler(final String name, final ServerSessionPacketHandler handler)
+ {
+ sessionHandlers.put(name, handler);
+ }
+
+ public void removeHandler(final String name)
+ {
+ sessionHandlers.remove(name);
+ }
+
+ public void bufferReceived(Object connectionID, HornetQBuffer buffer)
+ {
+ }
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ return -1;
+ }
+}
Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/HornetQPacketHandler.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/HornetQPacketHandler.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,315 @@
+/*
+ * 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.protocol.core.impl;
+
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_REPLICATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION;
+
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.ChannelHandler;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.ServerSessionPacketHandler;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
+import org.hornetq.core.replication.ReplicationEndpoint;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.ServerSession;
+import org.hornetq.core.version.Version;
+
+/**
+ * A packet handler for all packets that need to be handled at the server level
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
+ */
+public class HornetQPacketHandler implements ChannelHandler
+{
+ private static final Logger log = Logger.getLogger(HornetQPacketHandler.class);
+
+ private final HornetQServer server;
+
+ private final Channel channel1;
+
+ private final CoreRemotingConnection connection;
+
+ private final CoreProtocolManager protocolManager;
+
+ public HornetQPacketHandler(final CoreProtocolManager protocolManager,
+ final HornetQServer server,
+ final Channel channel1,
+ final CoreRemotingConnection connection)
+ {
+ this.protocolManager = protocolManager;
+
+ this.server = server;
+
+ this.channel1 = channel1;
+
+ this.connection = connection;
+ }
+
+ public void handlePacket(final Packet packet)
+ {
+ byte type = packet.getType();
+
+ switch (type)
+ {
+ case CREATESESSION:
+ {
+ CreateSessionMessage request = (CreateSessionMessage)packet;
+
+ handleCreateSession(request);
+
+ break;
+ }
+ case REATTACH_SESSION:
+ {
+ ReattachSessionMessage request = (ReattachSessionMessage)packet;
+
+ handleReattachSession(request);
+
+ break;
+ }
+ case CREATE_QUEUE:
+ {
+ // Create queue can also be fielded here in the case of a replicated store and forward queue creation
+
+ CreateQueueMessage request = (CreateQueueMessage)packet;
+
+ handleCreateQueue(request);
+
+ break;
+ }
+ case CREATE_REPLICATION:
+ {
+ // Create queue can also be fielded here in the case of a replicated store and forward queue creation
+
+ CreateReplicationSessionMessage request = (CreateReplicationSessionMessage)packet;
+
+ handleCreateReplication(request);
+
+ break;
+ }
+ default:
+ {
+ HornetQPacketHandler.log.error("Invalid packet " + packet);
+ }
+ }
+ }
+
+ private void handleCreateSession(final CreateSessionMessage request)
+ {
+ boolean incompatibleVersion = false;
+ Packet response;
+ try
+ {
+ Version version = server.getVersion();
+
+ if (version.getIncrementingVersion() != request.getVersion())
+ {
+ log.warn("Client with version " + request.getVersion() +
+ " and address " +
+ connection.getRemoteAddress() +
+ " is not compatible with server version " +
+ version.getFullVersion() +
+ ". " +
+ "Please ensure all clients and servers are upgraded to the same version for them to " +
+ "interoperate properly");
+ throw new HornetQException(HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS,
+ "Server and client versions incompatible");
+ }
+
+ if (!server.isStarted())
+ {
+ throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED, "Server not started");
+ }
+
+ if (!server.checkActivate())
+ {
+ throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED,
+ "Server will not accept create session requests");
+ }
+
+ Channel channel = connection.getChannel(request.getSessionChannelID(), request.getWindowSize());
+
+ ServerSession session = server.createSession(request.getName(),
+ request.getUsername(),
+ request.getPassword(),
+ request.getMinLargeMessageSize(),
+ connection,
+ request.isAutoCommitSends(),
+ request.isAutoCommitAcks(),
+ request.isPreAcknowledge(),
+ request.isXA());
+
+ ServerSessionPacketHandler handler = new ServerSessionPacketHandler(protocolManager,
+ session,
+ server.getStorageManager()
+ .newContext(server.getExecutorFactory()
+ .getExecutor()),
+ server.getStorageManager(),
+ channel);
+
+ session.setCallback(handler);
+
+ channel.setHandler(handler);
+
+ // TODO - where is this removed?
+ protocolManager.addSessionHandler(request.getName(), handler);
+
+ response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion());
+ }
+ catch (HornetQException e)
+ {
+ response = new HornetQExceptionMessage((HornetQException)e);
+
+ if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
+ {
+ incompatibleVersion = true;
+ }
+ }
+ catch (Exception e)
+ {
+ HornetQPacketHandler.log.error("Failed to create session", e);
+
+ response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
+ }
+
+ // send the exception to the client and destroy
+ // the connection if the client and server versions
+ // are not compatible
+ if (incompatibleVersion)
+ {
+ channel1.sendAndFlush(response);
+ }
+ else
+ {
+ channel1.send(response);
+ }
+ }
+
+ private void handleReattachSession(final ReattachSessionMessage request)
+ {
+ Packet response = null;
+
+ try
+ {
+
+ if (!server.isStarted())
+ {
+ response = new ReattachSessionResponseMessage(-1, false);
+ }
+
+ ServerSessionPacketHandler sessionHandler = protocolManager.getSessionHandler(request.getName());
+
+ if (!server.checkActivate())
+ {
+ response = new ReattachSessionResponseMessage(-1, false);
+ }
+
+ if (sessionHandler == null)
+ {
+ response = new ReattachSessionResponseMessage(-1, false);
+ }
+ else
+ {
+ if (sessionHandler.getChannel().getConfirmationWindowSize() == -1)
+ {
+ // Even though session exists, we can't reattach since confi window size == -1,
+ // i.e. we don't have a resend cache for commands, so we just close the old session
+ // and let the client recreate
+
+ sessionHandler.close();
+
+ response = new ReattachSessionResponseMessage(-1, false);
+ }
+ else
+ {
+ // Reconnect the channel to the new connection
+ int serverLastConfirmedCommandID = sessionHandler.transferConnection(connection,
+ request.getLastConfirmedCommandID());
+
+ response = new ReattachSessionResponseMessage(serverLastConfirmedCommandID, true);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ HornetQPacketHandler.log.error("Failed to reattach session", e);
+
+ response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
+ }
+
+ channel1.send(response);
+ }
+
+ private void handleCreateQueue(final CreateQueueMessage request)
+ {
+ try
+ {
+ server.createQueue(request.getAddress(),
+ request.getQueueName(),
+ request.getFilterString(),
+ request.isDurable(),
+ request.isTemporary());
+ }
+ catch (Exception e)
+ {
+ HornetQPacketHandler.log.error("Failed to handle create queue", e);
+ }
+ }
+
+ private void handleCreateReplication(final CreateReplicationSessionMessage request)
+ {
+ Packet response;
+
+ try
+ {
+ Channel channel = connection.getChannel(request.getSessionChannelID(), -1);
+
+ ReplicationEndpoint endpoint = server.connectToReplicationEndpoint(channel);
+
+ channel.setHandler(endpoint);
+
+ response = new NullResponseMessage();
+ }
+ catch (Exception e)
+ {
+ if (e instanceof HornetQException)
+ {
+ response = new HornetQExceptionMessage((HornetQException)e);
+ }
+ else
+ {
+ HornetQPacketHandler.log.warn(e.getMessage(), e);
+ response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
+ }
+ }
+
+ channel1.send(response);
+ }
+
+}
\ No newline at end of file
Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/PacketDecoder.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/PacketDecoder.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,493 @@
+/*
+ * 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.protocol.core.impl;
+
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATESESSION_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.CREATE_REPLICATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.DELETE_QUEUE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.DISCONNECT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.EXCEPTION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.NULL_RESPONSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.PACKETS_CONFIRMED;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.PING;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REATTACH_SESSION_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND_TX;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_COMMIT_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_COMPARE_DATA;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE_TX;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_END;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_EVENT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_WRITE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_PREPARE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.REPLICATION_RESPONSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ACKNOWLEDGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_BINDINGQUERY_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CONSUMER_CLOSE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_CREATECONSUMER;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_EXPIRED;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FLOWTOKEN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_FORCE_CONSUMER_DELIVERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_PRODUCER_CREDITS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_PRODUCER_REQUEST_CREDITS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_QUEUEQUERY_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_LARGE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_RECEIVE_MSG;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_CONTINUATION;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_SEND_LARGE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_STOP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_COMMIT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_END;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_FORGET;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_GET_TIMEOUT_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_INDOUBT_XIDS_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_JOIN;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_PREPARE;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_RESUME;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_ROLLBACK;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SET_TIMEOUT_RESP;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_START;
+import static org.hornetq.core.protocol.core.impl.PacketImpl.SESS_XA_SUSPEND;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.PacketsConfirmedMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.Ping;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReattachSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.RollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionAcknowledgeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionBindingQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerCloseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionConsumerFlowCreditMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionCreateConsumerMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionDeleteQueueMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionExpiredMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionForceConsumerDelivery;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionRequestProducerCreditsMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXACommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAForgetMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetInDoubtXidsResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAGetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAJoinMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAResumeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXARollbackMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXASetTimeoutResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionXAStartMessage;
+
+/**
+ * A PacketDecoder
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ *
+ *
+ */
+public class PacketDecoder
+{
+ private static final Logger log = Logger.getLogger(PacketDecoder.class);
+
+ public Packet decode(final HornetQBuffer in)
+ {
+ final byte packetType = in.readByte();
+
+ Packet packet;
+
+ switch (packetType)
+ {
+ case PING:
+ {
+ packet = new Ping();
+ break;
+ }
+ case DISCONNECT:
+ {
+ packet = new PacketImpl(PacketImpl.DISCONNECT);
+ break;
+ }
+ case EXCEPTION:
+ {
+ packet = new HornetQExceptionMessage();
+ break;
+ }
+ case PACKETS_CONFIRMED:
+ {
+ packet = new PacketsConfirmedMessage();
+ break;
+ }
+ case CREATESESSION:
+ {
+ packet = new CreateSessionMessage();
+ break;
+ }
+ case CREATESESSION_RESP:
+ {
+ packet = new CreateSessionResponseMessage();
+ break;
+ }
+ case REATTACH_SESSION:
+ {
+ packet = new ReattachSessionMessage();
+ break;
+ }
+ case REATTACH_SESSION_RESP:
+ {
+ packet = new ReattachSessionResponseMessage();
+ break;
+ }
+ case SESS_CLOSE:
+ {
+ packet = new SessionCloseMessage();
+ break;
+ }
+ case SESS_CREATECONSUMER:
+ {
+ packet = new SessionCreateConsumerMessage();
+ break;
+ }
+ case SESS_ACKNOWLEDGE:
+ {
+ packet = new SessionAcknowledgeMessage();
+ break;
+ }
+ case SESS_EXPIRED:
+ {
+ packet = new SessionExpiredMessage();
+ break;
+ }
+ case SESS_COMMIT:
+ {
+ packet = new SessionCommitMessage();
+ break;
+ }
+ case SESS_ROLLBACK:
+ {
+ packet = new RollbackMessage();
+ break;
+ }
+ case SESS_QUEUEQUERY:
+ {
+ packet = new SessionQueueQueryMessage();
+ break;
+ }
+ case SESS_QUEUEQUERY_RESP:
+ {
+ packet = new SessionQueueQueryResponseMessage();
+ break;
+ }
+ case CREATE_QUEUE:
+ {
+ packet = new CreateQueueMessage();
+ break;
+ }
+ case DELETE_QUEUE:
+ {
+ packet = new SessionDeleteQueueMessage();
+ break;
+ }
+ case SESS_BINDINGQUERY:
+ {
+ packet = new SessionBindingQueryMessage();
+ break;
+ }
+ case SESS_BINDINGQUERY_RESP:
+ {
+ packet = new SessionBindingQueryResponseMessage();
+ break;
+ }
+ case SESS_XA_START:
+ {
+ packet = new SessionXAStartMessage();
+ break;
+ }
+ case SESS_XA_END:
+ {
+ packet = new SessionXAEndMessage();
+ break;
+ }
+ case SESS_XA_COMMIT:
+ {
+ packet = new SessionXACommitMessage();
+ break;
+ }
+ case SESS_XA_PREPARE:
+ {
+ packet = new SessionXAPrepareMessage();
+ break;
+ }
+ case SESS_XA_RESP:
+ {
+ packet = new SessionXAResponseMessage();
+ break;
+ }
+ case SESS_XA_ROLLBACK:
+ {
+ packet = new SessionXARollbackMessage();
+ break;
+ }
+ case SESS_XA_JOIN:
+ {
+ packet = new SessionXAJoinMessage();
+ break;
+ }
+ case SESS_XA_SUSPEND:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_XA_SUSPEND);
+ break;
+ }
+ case SESS_XA_RESUME:
+ {
+ packet = new SessionXAResumeMessage();
+ break;
+ }
+ case SESS_XA_FORGET:
+ {
+ packet = new SessionXAForgetMessage();
+ break;
+ }
+ case SESS_XA_INDOUBT_XIDS:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS);
+ break;
+ }
+ case SESS_XA_INDOUBT_XIDS_RESP:
+ {
+ packet = new SessionXAGetInDoubtXidsResponseMessage();
+ break;
+ }
+ case SESS_XA_SET_TIMEOUT:
+ {
+ packet = new SessionXASetTimeoutMessage();
+ break;
+ }
+ case SESS_XA_SET_TIMEOUT_RESP:
+ {
+ packet = new SessionXASetTimeoutResponseMessage();
+ break;
+ }
+ case SESS_XA_GET_TIMEOUT:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT);
+ break;
+ }
+ case SESS_XA_GET_TIMEOUT_RESP:
+ {
+ packet = new SessionXAGetTimeoutResponseMessage();
+ break;
+ }
+ case SESS_START:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_START);
+ break;
+ }
+ case SESS_STOP:
+ {
+ packet = new PacketImpl(PacketImpl.SESS_STOP);
+ break;
+ }
+ case SESS_FLOWTOKEN:
+ {
+ packet = new SessionConsumerFlowCreditMessage();
+ break;
+ }
+ case SESS_SEND:
+ {
+ packet = new SessionSendMessage();
+ break;
+ }
+ case SESS_SEND_LARGE:
+ {
+ packet = new SessionSendLargeMessage();
+ break;
+ }
+ case SESS_RECEIVE_MSG:
+ {
+ packet = new SessionReceiveMessage();
+ break;
+ }
+ case SESS_RECEIVE_LARGE_MSG:
+ {
+ packet = new SessionReceiveLargeMessage();
+ break;
+ }
+ case SESS_CONSUMER_CLOSE:
+ {
+ packet = new SessionConsumerCloseMessage();
+ break;
+ }
+ case NULL_RESPONSE:
+ {
+ packet = new NullResponseMessage();
+ break;
+ }
+ case SESS_RECEIVE_CONTINUATION:
+ {
+ packet = new SessionReceiveContinuationMessage();
+ break;
+ }
+ case SESS_SEND_CONTINUATION:
+ {
+ packet = new SessionSendContinuationMessage();
+ break;
+ }
+ case SESS_PRODUCER_REQUEST_CREDITS:
+ {
+ packet = new SessionRequestProducerCreditsMessage();
+ break;
+ }
+ case SESS_PRODUCER_CREDITS:
+ {
+ packet = new SessionProducerCreditsMessage();
+ break;
+ }
+ case CREATE_REPLICATION:
+ {
+ packet = new CreateReplicationSessionMessage();
+ break;
+ }
+ case REPLICATION_APPEND:
+ {
+ packet = new ReplicationAddMessage();
+ break;
+ }
+ case REPLICATION_APPEND_TX:
+ {
+ packet = new ReplicationAddTXMessage();
+ break;
+ }
+ case REPLICATION_DELETE:
+ {
+ packet = new ReplicationDeleteMessage();
+ break;
+ }
+ case REPLICATION_DELETE_TX:
+ {
+ packet = new ReplicationDeleteTXMessage();
+ break;
+ }
+ case REPLICATION_PREPARE:
+ {
+ packet = new ReplicationPrepareMessage();
+ break;
+ }
+ case REPLICATION_COMMIT_ROLLBACK:
+ {
+ packet = new ReplicationCommitMessage();
+ break;
+ }
+ case REPLICATION_RESPONSE:
+ {
+ packet = new ReplicationResponseMessage();
+ break;
+ }
+ case REPLICATION_PAGE_WRITE:
+ {
+ packet = new ReplicationPageWriteMessage();
+ break;
+ }
+ case REPLICATION_PAGE_EVENT:
+ {
+ packet = new ReplicationPageEventMessage();
+ break;
+ }
+ case REPLICATION_LARGE_MESSAGE_BEGIN:
+ {
+ packet = new ReplicationLargeMessageBeingMessage();
+ break;
+ }
+ case REPLICATION_LARGE_MESSAGE_END:
+ {
+ packet = new ReplicationLargemessageEndMessage();
+ break;
+ }
+ case REPLICATION_LARGE_MESSAGE_WRITE:
+ {
+ packet = new ReplicationLargeMessageWriteMessage();
+ break;
+ }
+ case REPLICATION_COMPARE_DATA:
+ {
+ packet = new ReplicationCompareDataMessage();
+ break;
+ }
+ case SESS_FORCE_CONSUMER_DELIVERY:
+ {
+ packet = new SessionForceConsumerDelivery();
+ break;
+ }
+ default:
+ {
+ throw new IllegalArgumentException("Invalid type: " + packetType);
+ }
+ }
+
+ packet.decode(in);
+
+ return packet;
+ }
+
+}
Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/PacketImpl.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/PacketImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,311 @@
+/*
+ * 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.protocol.core.impl;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class PacketImpl implements Packet
+{
+ // Constants -------------------------------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(PacketImpl.class);
+
+ // The minimal size for all the packets, Common data for all the packets (look at PacketImpl.encode)
+ public static final int PACKET_HEADERS_SIZE = DataConstants.SIZE_INT + DataConstants.SIZE_BYTE +
+ DataConstants.SIZE_LONG;
+
+ private static final int INITIAL_PACKET_SIZE = 1500;
+
+ protected long channelID;
+
+ protected final byte type;
+
+ protected int size = -1;
+
+ // The packet types
+ // -----------------------------------------------------------------------------------
+
+ public static final byte PING = 10;
+
+ public static final byte DISCONNECT = 11;
+
+ // Miscellaneous
+ public static final byte EXCEPTION = 20;
+
+ public static final byte NULL_RESPONSE = 21;
+
+ public static final byte PACKETS_CONFIRMED = 22;
+
+ // Server
+ public static final byte CREATESESSION = 30;
+
+ public static final byte CREATESESSION_RESP = 31;
+
+ public static final byte REATTACH_SESSION = 32;
+
+ public static final byte REATTACH_SESSION_RESP = 33;
+
+ public static final byte CREATE_QUEUE = 34;
+
+ public static final byte DELETE_QUEUE = 35;
+
+ public static final byte CREATE_REPLICATION = 36;
+
+ // Session
+ public static final byte SESS_CREATECONSUMER = 40;
+
+ public static final byte SESS_ACKNOWLEDGE = 41;
+
+ public static final byte SESS_EXPIRED = 42;
+
+ public static final byte SESS_COMMIT = 43;
+
+ public static final byte SESS_ROLLBACK = 44;
+
+ public static final byte SESS_QUEUEQUERY = 45;
+
+ public static final byte SESS_QUEUEQUERY_RESP = 46;
+
+ public static final byte SESS_BINDINGQUERY = 49;
+
+ public static final byte SESS_BINDINGQUERY_RESP = 50;
+
+ public static final byte SESS_XA_START = 51;
+
+ public static final byte SESS_XA_END = 52;
+
+ public static final byte SESS_XA_COMMIT = 53;
+
+ public static final byte SESS_XA_PREPARE = 54;
+
+ public static final byte SESS_XA_RESP = 55;
+
+ public static final byte SESS_XA_ROLLBACK = 56;
+
+ public static final byte SESS_XA_JOIN = 57;
+
+ public static final byte SESS_XA_SUSPEND = 58;
+
+ public static final byte SESS_XA_RESUME = 59;
+
+ public static final byte SESS_XA_FORGET = 60;
+
+ public static final byte SESS_XA_INDOUBT_XIDS = 61;
+
+ public static final byte SESS_XA_INDOUBT_XIDS_RESP = 62;
+
+ public static final byte SESS_XA_SET_TIMEOUT = 63;
+
+ public static final byte SESS_XA_SET_TIMEOUT_RESP = 64;
+
+ public static final byte SESS_XA_GET_TIMEOUT = 65;
+
+ public static final byte SESS_XA_GET_TIMEOUT_RESP = 66;
+
+ public static final byte SESS_START = 67;
+
+ public static final byte SESS_STOP = 68;
+
+ public static final byte SESS_CLOSE = 69;
+
+ public static final byte SESS_FLOWTOKEN = 70;
+
+ public static final byte SESS_SEND = 71;
+
+ public static final byte SESS_SEND_LARGE = 72;
+
+ public static final byte SESS_SEND_CONTINUATION = 73;
+
+ public static final byte SESS_CONSUMER_CLOSE = 74;
+
+ public static final byte SESS_RECEIVE_MSG = 75;
+
+ public static final byte SESS_RECEIVE_LARGE_MSG = 76;
+
+ public static final byte SESS_RECEIVE_CONTINUATION = 77;
+
+ public static final byte SESS_FORCE_CONSUMER_DELIVERY = 78;
+
+ public static final byte SESS_PRODUCER_REQUEST_CREDITS = 79;
+
+ public static final byte SESS_PRODUCER_CREDITS = 80;
+
+ // Replication
+
+ public static final byte REPLICATION_RESPONSE = 90;
+
+ public static final byte REPLICATION_APPEND = 91;
+
+ public static final byte REPLICATION_APPEND_TX = 92;
+
+ public static final byte REPLICATION_DELETE = 93;
+
+ public static final byte REPLICATION_DELETE_TX = 94;
+
+ public static final byte REPLICATION_PREPARE = 95;
+
+ public static final byte REPLICATION_COMMIT_ROLLBACK = 96;
+
+ public static final byte REPLICATION_PAGE_WRITE = 97;
+
+ public static final byte REPLICATION_PAGE_EVENT = 98;
+
+ public static final byte REPLICATION_LARGE_MESSAGE_BEGIN = 99;
+
+ public static final byte REPLICATION_LARGE_MESSAGE_END = 100;
+
+ public static final byte REPLICATION_LARGE_MESSAGE_WRITE = 101;
+
+ public static final byte REPLICATION_COMPARE_DATA = 102;
+
+ public static final byte REPLICATION_SYNC = 103;
+
+ // Static --------------------------------------------------------
+
+ public PacketImpl(final byte type)
+ {
+ this.type = type;
+ }
+
+ // Public --------------------------------------------------------
+
+ public byte getType()
+ {
+ return type;
+ }
+
+ public long getChannelID()
+ {
+ return channelID;
+ }
+
+ public void setChannelID(final long channelID)
+ {
+ this.channelID = channelID;
+ }
+
+ public HornetQBuffer encode(final RemotingConnection connection)
+ {
+ HornetQBuffer buffer = connection.createBuffer(PacketImpl.INITIAL_PACKET_SIZE);
+
+ // The standard header fields
+
+ buffer.writeInt(0); // The length gets filled in at the end
+ buffer.writeByte(type);
+ buffer.writeLong(channelID);
+
+ encodeRest(buffer);
+
+ size = buffer.writerIndex();
+
+ // The length doesn't include the actual length byte
+ int len = size - DataConstants.SIZE_INT;
+
+ buffer.setInt(0, len);
+
+ return buffer;
+ }
+
+ public void decode(final HornetQBuffer buffer)
+ {
+ channelID = buffer.readLong();
+
+ decodeRest(buffer);
+
+ size = buffer.readerIndex();
+ }
+
+ public int getPacketSize()
+ {
+ if (size == -1)
+ {
+ throw new IllegalStateException("Packet hasn't been encoded/decoded yet");
+ }
+
+ return size;
+ }
+
+ public boolean isResponse()
+ {
+ return false;
+ }
+
+ public void encodeRest(final HornetQBuffer buffer)
+ {
+ }
+
+ public void decodeRest(final HornetQBuffer buffer)
+ {
+ }
+
+ public boolean isRequiresConfirmations()
+ {
+ return true;
+ }
+
+ public boolean isAsyncExec()
+ {
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getParentString() + "]";
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other instanceof PacketImpl == false)
+ {
+ return false;
+ }
+
+ PacketImpl r = (PacketImpl)other;
+
+ return r.type == type && r.channelID == channelID;
+ }
+
+ // Package protected ---------------------------------------------
+
+ protected String getParentString()
+ {
+ return "PACKET[type=" + type + ", channelID=" + channelID + "]";
+ }
+
+ // Protected -----------------------------------------------------
+
+ protected int stringEncodeSize(final String str)
+ {
+ return DataConstants.SIZE_INT + str.length() * 2;
+ }
+
+ protected int nullableStringEncodeSize(final String str)
+ {
+ return DataConstants.SIZE_BOOLEAN + (str != null ? stringEncodeSize(str) : 0);
+ }
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/RemotingConnectionImpl.java)
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java (rev 0)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/RemotingConnectionImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,511 @@
+/*
+ * 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.protocol.core.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executor;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Channel;
+import org.hornetq.core.protocol.core.CoreRemotingConnection;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.remoting.CloseListener;
+import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.remoting.Connection;
+import org.hornetq.utils.SimpleIDGenerator;
+
+/**
+ * @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ * @version <tt>$Revision$</tt> $Id$
+ */
+public class RemotingConnectionImpl extends AbstractBufferHandler implements CoreRemotingConnection
+{
+ // Constants
+ // ------------------------------------------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(RemotingConnectionImpl.class);
+
+ // Static
+ // ---------------------------------------------------------------------------------------
+
+ // Attributes
+ // -----------------------------------------------------------------------------------
+
+ private final Connection transportConnection;
+
+ private final Map<Long, Channel> channels = new ConcurrentHashMap<Long, Channel>();
+
+ private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
+
+ private final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>();
+
+ private final long blockingCallTimeout;
+
+ private final List<Interceptor> interceptors;
+
+ private volatile boolean destroyed;
+
+ private final boolean client;
+
+ // Channels 0-9 are reserved for the system
+ // 0 is for pinging
+ // 1 is for session creation and attachment
+ // 2 is for replication
+ private volatile SimpleIDGenerator idGenerator = new SimpleIDGenerator(10);
+
+ private boolean idGeneratorSynced = false;
+
+ private final Object transferLock = new Object();
+
+ private final Object failLock = new Object();
+
+ private final PacketDecoder decoder = new PacketDecoder();
+
+ private volatile boolean dataReceived;
+
+ private final Executor executor;
+
+ private volatile boolean executing;
+
+ // Constructors
+ // ---------------------------------------------------------------------------------
+
+ /*
+ * Create a client side connection
+ */
+ public RemotingConnectionImpl(final Connection transportConnection,
+ final long blockingCallTimeout,
+ final List<Interceptor> interceptors)
+ {
+ this(transportConnection, blockingCallTimeout, interceptors, true, null);
+ }
+
+ /*
+ * Create a server side connection
+ */
+ public RemotingConnectionImpl(final Connection transportConnection,
+ final List<Interceptor> interceptors,
+ final Executor executor)
+
+ {
+ this(transportConnection, -1, interceptors, false, executor);
+ }
+
+ private RemotingConnectionImpl(final Connection transportConnection,
+ final long blockingCallTimeout,
+ final List<Interceptor> interceptors,
+ final boolean client,
+ final Executor executor)
+
+ {
+ this.transportConnection = transportConnection;
+
+ this.blockingCallTimeout = blockingCallTimeout;
+
+ this.interceptors = interceptors;
+
+ this.client = client;
+
+ this.executor = executor;
+ }
+
+ // RemotingConnection implementation
+ // ------------------------------------------------------------
+
+ public Connection getTransportConnection()
+ {
+ return transportConnection;
+ }
+
+ public List<FailureListener> getFailureListeners()
+ {
+ return new ArrayList<FailureListener>(failureListeners);
+ }
+
+ public void setFailureListeners(final List<FailureListener> listeners)
+ {
+ failureListeners.clear();
+
+ failureListeners.addAll(listeners);
+ }
+
+ public Object getID()
+ {
+ return transportConnection.getID();
+ }
+
+ public String getRemoteAddress()
+ {
+ return transportConnection.getRemoteAddress();
+ }
+
+ public synchronized Channel getChannel(final long channelID, final int confWindowSize)
+ {
+ Channel channel = channels.get(channelID);
+
+ if (channel == null)
+ {
+ channel = new ChannelImpl(this, channelID, confWindowSize);
+
+ channels.put(channelID, channel);
+ }
+
+ return channel;
+ }
+
+ public synchronized boolean removeChannel(final long channelID)
+ {
+ return channels.remove(channelID) != null;
+ }
+
+ public synchronized void putChannel(final long channelID, final Channel channel)
+ {
+ channels.put(channelID, channel);
+ }
+
+ public void addFailureListener(final FailureListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalStateException("FailureListener cannot be null");
+ }
+
+ failureListeners.add(listener);
+ }
+
+ public boolean removeFailureListener(final FailureListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalStateException("FailureListener cannot be null");
+ }
+
+ return failureListeners.remove(listener);
+ }
+
+ public void addCloseListener(final CloseListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalStateException("CloseListener cannot be null");
+ }
+
+ closeListeners.add(listener);
+ }
+
+ public boolean removeCloseListener(final CloseListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalStateException("CloseListener cannot be null");
+ }
+
+ return closeListeners.remove(listener);
+ }
+
+ public HornetQBuffer createBuffer(final int size)
+ {
+ return transportConnection.createBuffer(size);
+ }
+
+ /*
+ * This can be called concurrently by more than one thread so needs to be locked
+ */
+ public void fail(final HornetQException me)
+ {
+ synchronized (failLock)
+ {
+ if (destroyed)
+ {
+ return;
+ }
+
+ destroyed = true;
+ }
+
+ RemotingConnectionImpl.log.warn("Connection failure has been detected: " + me.getMessage() +
+ " [code=" +
+ me.getCode() +
+ "]");
+
+ // Then call the listeners
+ callFailureListeners(me);
+
+ callClosingListeners();
+
+ internalClose();
+
+ for (Channel channel : channels.values())
+ {
+ channel.returnBlocking();
+ }
+ }
+
+ public void destroy()
+ {
+ synchronized (failLock)
+ {
+ if (destroyed)
+ {
+ return;
+ }
+
+ destroyed = true;
+ }
+
+ internalClose();
+
+ callClosingListeners();
+ }
+
+ public void disconnect()
+ {
+ Channel channel0 = getChannel(0, -1);
+
+ // And we remove all channels from the connection, this ensures no more packets will be processed after this
+ // method is
+ // complete
+
+ Set<Channel> allChannels = new HashSet<Channel>(channels.values());
+
+ removeAllChannels();
+
+ // Now we are 100% sure that no more packets will be processed we can flush then send the disconnect
+
+ for (Channel channel: allChannels)
+ {
+ channel.flushConfirmations();
+ }
+
+ channel0.sendAndFlush(new PacketImpl(PacketImpl.DISCONNECT));
+ }
+
+ public long generateChannelID()
+ {
+ return idGenerator.generateID();
+ }
+
+ public synchronized void syncIDGeneratorSequence(final long id)
+ {
+ if (!idGeneratorSynced)
+ {
+ idGenerator = new SimpleIDGenerator(id);
+
+ idGeneratorSynced = true;
+ }
+ }
+
+ public long getIDGeneratorSequence()
+ {
+ return idGenerator.getCurrentID();
+ }
+
+ public Object getTransferLock()
+ {
+ return transferLock;
+ }
+
+ public boolean isClient()
+ {
+ return client;
+ }
+
+ public boolean isDestroyed()
+ {
+ return destroyed;
+ }
+
+ public long getBlockingCallTimeout()
+ {
+ return blockingCallTimeout;
+ }
+
+ public boolean checkDataReceived()
+ {
+ boolean res = dataReceived;
+
+ dataReceived = false;
+
+ return res;
+ }
+
+ //We flush any confirmations on the connection - this prevents idle bridges for example
+ //sitting there with many unacked messages
+ public void flush()
+ {
+ synchronized (transferLock)
+ {
+ for (Channel channel : channels.values())
+ {
+ channel.flushConfirmations();
+ }
+ }
+ }
+
+ // Buffer Handler implementation
+ // ----------------------------------------------------
+
+ public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
+ {
+ final Packet packet = decoder.decode(buffer);
+
+ if (packet.isAsyncExec() && executor != null)
+ {
+ executing = true;
+
+ executor.execute(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ doBufferReceived(packet);
+ }
+ catch (Throwable t)
+ {
+ RemotingConnectionImpl.log.error("Unexpected error", t);
+ }
+
+ executing = false;
+ }
+ });
+ }
+ else
+ {
+ //To prevent out of order execution if interleaving sync and async operations on same connection
+ while (executing)
+ {
+ Thread.yield();
+ }
+
+ // Pings must always be handled out of band so we can send pings back to the client quickly
+ // otherwise they would get in the queue with everything else which might give an intolerable delay
+ doBufferReceived(packet);
+ }
+
+ dataReceived = true;
+ }
+
+ private void doBufferReceived(final Packet packet)
+ {
+ if (interceptors != null)
+ {
+ for (final Interceptor interceptor : interceptors)
+ {
+ try
+ {
+ boolean callNext = interceptor.intercept(packet, this);
+
+ if (!callNext)
+ {
+ return;
+ }
+ }
+ catch (final Throwable e)
+ {
+ RemotingConnectionImpl.log.warn("Failure in calling interceptor: " + interceptor, e);
+ }
+ }
+ }
+
+ synchronized (transferLock)
+ {
+ final Channel channel = channels.get(packet.getChannelID());
+
+ if (channel != null)
+ {
+ channel.handlePacket(packet);
+ }
+ }
+ }
+
+ // Package protected
+ // ----------------------------------------------------------------------------
+
+ // Protected
+ // ------------------------------------------------------------------------------------
+
+ // Private
+ // --------------------------------------------------------------------------------------
+
+ private void removeAllChannels()
+ {
+ // We get the transfer lock first - this ensures no packets are being processed AND
+ // it's guaranteed no more packets will be processed once this method is complete
+ synchronized (transferLock)
+ {
+ channels.clear();
+ }
+ }
+ private void callFailureListeners(final HornetQException me)
+ {
+ final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
+
+ for (final FailureListener listener : listenersClone)
+ {
+ try
+ {
+ listener.connectionFailed(me);
+ }
+ catch (final Throwable t)
+ {
+ // Failure of one listener to execute shouldn't prevent others
+ // from
+ // executing
+ RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
+ }
+ }
+ }
+
+ private void callClosingListeners()
+ {
+ final List<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners);
+
+ for (final CloseListener listener : listenersClone)
+ {
+ try
+ {
+ listener.connectionClosed();
+ }
+ catch (final Throwable t)
+ {
+ // Failure of one listener to execute shouldn't prevent others
+ // from
+ // executing
+ RemotingConnectionImpl.log.error("Failed to execute failure listener", t);
+ }
+ }
+ }
+
+ private void internalClose()
+ {
+ // We close the underlying transport connection
+ transportConnection.close();
+
+ for (Channel channel : channels.values())
+ {
+ channel.close();
+ }
+ }
+}
Copied: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/wireformat)
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/CreateQueueMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateQueueMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/CreateReplicationSessionMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateReplicationSessionMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Clebert Suconic</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/CreateSessionMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/CreateSessionResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/CreateSessionResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/HornetQExceptionMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/HornetQExceptionMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/MessagePacket.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/MessagePacket.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.Message;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A MessagePacket
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/NullResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/NullResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,9 +11,9 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/PacketsConfirmedMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/PacketsConfirmedMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
*
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/Ping.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/Ping.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
*
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReattachSessionMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
*
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReattachSessionResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReattachSessionResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
*
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationAddMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.EncodingSupport;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationAddMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationAddTXMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationAddMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationCommitMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCommitMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationAddMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationCompareDataMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationCompareDataMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.JournalLoadInformation;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* Message used to compare if the Journals between the live and
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationDeleteMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationAddMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationDeleteTXMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationAddMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationLargeMessageBeingMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageBeingMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationLargeMessageBeingMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationLargeMessageWriteMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargeMessageWriteMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationLargeMessageWriteMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationLargemessageEndMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationLargemessageEndMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationLargemessageEndMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationPageEventMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationPageWrite
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationPageWriteMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,12 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.paging.PagedMessage;
import org.hornetq.core.paging.impl.PagedMessageImpl;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationPageWrite
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationPrepareMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A ReplicationAddMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/ReplicationResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/ReplicationResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,9 +11,9 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/RollbackMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/RollbackMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A RollbackMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionAcknowledgeMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionAcknowledgeMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionBindingQueryMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
*
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionBindingQueryResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,14 +11,14 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import java.util.ArrayList;
import java.util.List;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
*
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionCloseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCloseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,9 +11,9 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionCommitMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCommitMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,9 +11,9 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A SessionCommitMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionConsumerCloseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerCloseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionConsumerFlowCreditMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionConsumerFlowCreditMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionContinuationMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionContinuationMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.utils.DataConstants;
/**
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionCreateConsumerMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionCreateConsumerMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionDeleteQueueMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionDeleteQueueMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionExpiredMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionExpiredMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionForceConsumerDelivery.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionForceConsumerDelivery.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
*
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionProducerCreditsMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionProducerCreditsMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionQueueQueryMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
*
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionQueueQueryResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionQueueQueryResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.QueueQueryResult;
/**
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionReceiveContinuationMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveContinuationMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.utils.DataConstants;
/**
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionReceiveLargeMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveLargeMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A SessionReceiveLargeMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionReceiveMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionReceiveMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,14 +11,14 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.client.impl.ClientMessageImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.DataConstants;
/**
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionRequestProducerCreditsMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionRequestProducerCreditsMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,11 +11,11 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionSendContinuationMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendContinuationMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* A SessionSendContinuationMessage
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionSendLargeMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendLargeMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionSendMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionSendMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,15 +11,15 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.Message;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.impl.MessageInternal;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.impl.ServerMessageImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.DataConstants;
/**
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXACommitMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXACommitMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import javax.transaction.xa.Xid;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAEndMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAEndMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import javax.transaction.xa.Xid;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAForgetMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import javax.transaction.xa.Xid;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAGetInDoubtXidsResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,7 +11,7 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import java.util.ArrayList;
import java.util.List;
@@ -19,7 +19,8 @@
import javax.transaction.xa.Xid;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAGetTimeoutResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAGetTimeoutResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAJoinMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import javax.transaction.xa.Xid;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAPrepareMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import javax.transaction.xa.Xid;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAResumeMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import javax.transaction.xa.Xid;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXARollbackMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import javax.transaction.xa.Xid;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXASetTimeoutMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXASetTimeoutResponseMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXASetTimeoutResponseMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,10 +11,10 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Modified: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/SessionXAStartMessage.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/SessionXAStartMessage.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -11,12 +11,13 @@
* permissions and limitations under the License.
*/
-package org.hornetq.core.protocol.core.wireformat;
+package org.hornetq.core.protocol.core.impl.wireformat;
import javax.transaction.xa.Xid;
import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.utils.XidCodecSupport;
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
Deleted: trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/XidCodecSupport.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/core/wireformat/XidCodecSupport.java 2010-01-21 14:46:21 UTC (rev 8827)
+++ trunk/src/main/org/hornetq/core/protocol/core/impl/wireformat/XidCodecSupport.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,73 +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.protocol.core.wireformat;
-
-import javax.transaction.xa.Xid;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.core.transaction.impl.XidImpl;
-import org.hornetq.utils.DataConstants;
-
-/**
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class XidCodecSupport
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- public static void encodeXid(final Xid xid, final HornetQBuffer out)
- {
- out.writeInt(xid.getFormatId());
- out.writeInt(xid.getBranchQualifier().length);
- out.writeBytes(xid.getBranchQualifier());
- out.writeInt(xid.getGlobalTransactionId().length);
- out.writeBytes(xid.getGlobalTransactionId());
- }
-
- public static Xid decodeXid(final HornetQBuffer in)
- {
- int formatID = in.readInt();
- byte[] bq = new byte[in.readInt()];
- in.readBytes(bq);
- byte[] gtxid = new byte[in.readInt()];
- in.readBytes(gtxid);
- Xid xid = new XidImpl(bq, formatID, gtxid);
- return xid;
- }
-
- public static int getXidEncodeLength(final Xid xid)
- {
- return DataConstants.SIZE_INT * 3 + xid.getBranchQualifier().length + xid.getGlobalTransactionId().length;
- }
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Modified: trunk/src/main/org/hornetq/core/remoting/CloseListener.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/CloseListener.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/CloseListener.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,9 +13,9 @@
package org.hornetq.core.remoting;
/**
- * CloseListeners can be registered with a {@link org.hornetq.core.remoting.RemotingConnection} to get notified when the connection is closed.
+ * CloseListeners can be registered with a {@link org.hornetq.spi.core.protocol.RemotingConnection} to get notified when the connection is closed.
* <p/>
- * {@link org.hornetq.core.remoting.RemotingConnection#addCloseListener(CloseListener)}
+ * {@link org.hornetq.spi.core.protocol.RemotingConnection#addCloseListener(CloseListener)}
*
* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
*/
Deleted: trunk/src/main/org/hornetq/core/remoting/ProtocolType.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/ProtocolType.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/ProtocolType.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,26 +0,0 @@
-/*
- * Copyright 2010 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;
-
-/**
- * A ProtocolType
- *
- * @author Tim Fox
- *
- *
- */
-public enum ProtocolType
-{
- CORE, STOMP, AMQP;
-}
Deleted: trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,156 +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;
-
-import java.util.List;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.spi.core.remoting.BufferHandler;
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A RemotingConnection is a connection between a client and a server.
- * <p/>
- * It allows multiple {@link org.hornetq.core.protocol.core.Channel}'s to be created and data multiplexed over them. It uses
- * and a {@link Connection} implementation and takes care of failures etc.
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- */
-public interface RemotingConnection extends BufferHandler
-{
- /**
- * returns the unique id of the Remoting Connection
- *
- * @return the id
- */
- Object getID();
-
- /**
- * returns a string representation of the remote address of this connection
- *
- * @return the remote address
- */
- String getRemoteAddress();
-
- /**
- * add a failure listener.
- * <p/>
- * The listener will be called in the event of connection failure.
- *
- * @param listener the listener
- */
- void addFailureListener(FailureListener listener);
-
- /**
- * remove the failure listener
- *
- * @param listener the lister to remove
- * @return true if removed
- */
- boolean removeFailureListener(FailureListener listener);
-
- /**
- * add a CloseListener.
- * <p/>
- * This will be called in the event of the connection being closed.
- *
- * @param listener the listener to add
- */
- void addCloseListener(CloseListener listener);
-
- /**
- * remove a Close Listener
- *
- * @param listener the listener to remove
- * @return true if removed
- */
- boolean removeCloseListener(CloseListener listener);
-
- /**
- * return all the failure listeners
- *
- * @return the listeners
- */
- List<FailureListener> getFailureListeners();
-
- /**
- * set the failure listeners.
- * <p/>
- * These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.
- *
- * @param listeners the listeners to add.
- */
- void setFailureListeners(List<FailureListener> listeners);
-
- /**
- * creates a new HornetQBuffer of the specified size.
- *
- * @param size the size of buffer required
- * @return the buffer
- */
- HornetQBuffer createBuffer(int size);
-
- /**
- * called when the underlying connection fails.
- *
- * @param me the exception that caused the failure
- */
- void fail(HornetQException me);
-
- /**
- * destroys this connection.
- */
- void destroy();
-
- /**
- * return the underlying Connection.
- *
- * @return the connection
- */
- Connection getTransportConnection();
-
- /**
- * returns whether or not the Remoting Connection is a client
- *
- * @return true if client, false if a server
- */
- boolean isClient();
-
- /**
- * returns true if this Remoting Connection has been destroyed.
- *
- * @return true if destroyed, otherwise false
- */
- boolean isDestroyed();
-
- /**
- * Disconnect the connection, closing all channels
- */
- void disconnect();
-
- /**
- * returns true if any data has been received since the last time this method was called.
- *
- * @return true if data has been received.
- */
- boolean checkDataReceived();
-
- /**
- * flush all outstanding data from the connection.
- */
- void flush();
-
-}
Deleted: trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/AbstractBufferHandler.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -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@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: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,9 +21,9 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.management.NotificationType;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
@@ -58,11 +58,14 @@
private boolean paused;
private NotificationService notificationService;
+
+ private final ProtocolType protocol;
public InVMAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
final ConnectionLifeCycleListener listener,
- final Executor threadPool)
+ final Executor threadPool,
+ final ProtocolType protocol)
{
this.handler = handler;
@@ -71,6 +74,8 @@
id = ConfigurationHelper.getIntProperty(TransportConstants.SERVER_ID_PROP_NAME, 0, configuration);
executorFactory = new OrderedExecutorFactory(threadPool);
+
+ this.protocol = protocol;
}
public synchronized void start() throws Exception
Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptorFactory.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,6 +17,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.AcceptorFactory;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -34,9 +35,10 @@
final BufferHandler handler,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
- final ScheduledExecutorService scheduledThreadPool)
+ final ScheduledExecutorService scheduledThreadPool,
+ final ProtocolType protocol)
{
- return new InVMAcceptor(configuration, handler, listener, threadPool);
+ return new InVMAcceptor(configuration, handler, listener, threadPool, protocol);
}
public Set<String> getAllowableProperties()
Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnection.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,7 +18,7 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMConnector.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -19,7 +19,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
Deleted: trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,41 +0,0 @@
-/*
- * Copyright 2010 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.server;
-
-import org.hornetq.core.remoting.RemotingConnection;
-
-/**
- * A ConnectionEntry
- *
- * @author Tim Fox
- *
- *
- */
-public class ConnectionEntry
-{
- public final RemotingConnection connection;
-
- public volatile long lastCheck;
-
- public volatile long ttl;
-
- public ConnectionEntry(final RemotingConnection connection, final long lastCheck, final long ttl)
- {
- this.connection = connection;
-
- this.lastCheck = lastCheck;
-
- this.ttl = ttl;
- }
-}
Deleted: trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,29 +0,0 @@
-/*
- * Copyright 2010 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.server;
-
-import org.hornetq.spi.core.remoting.Connection;
-
-/**
- * A ProtocolManager
- *
- * @author Tim Fox
- *
- *
- */
-public interface ProtocolManager
-{
- ConnectionEntry createConnectionEntry(Connection connection);
-
-}
Modified: trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -16,8 +16,8 @@
import java.util.Set;
import org.hornetq.api.core.Interceptor;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HornetQComponent;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
Modified: trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -28,15 +28,15 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.CoreProtocolManager;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.RemotingConnection;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
-import org.hornetq.core.remoting.server.ConnectionEntry;
-import org.hornetq.core.remoting.server.ProtocolManager;
+import org.hornetq.core.protocol.aardvark.impl.AardvarkProtocolManagerFactory;
+import org.hornetq.core.protocol.core.impl.CoreProtocolManagerFactory;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.management.ManagementService;
+import org.hornetq.spi.core.protocol.ConnectionEntry;
+import org.hornetq.spi.core.protocol.ProtocolManager;
+import org.hornetq.spi.core.protocol.ProtocolType;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.AcceptorFactory;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -70,7 +70,7 @@
private final Map<Object, ConnectionEntry> connections = new ConcurrentHashMap<Object, ConnectionEntry>();
- private final BufferHandler bufferHandler = new DelegatingBufferHandler();
+ //private final BufferHandler bufferHandler = new DelegatingBufferHandler();
private final Configuration config;
@@ -122,7 +122,8 @@
this.threadPool = threadPool;
this.scheduledThreadPool = scheduledThreadPool;
- this.protocolMap.put(ProtocolType.CORE, new CoreProtocolManager(server, interceptors));
+ this.protocolMap.put(ProtocolType.CORE, new CoreProtocolManagerFactory().createProtocolManager(server, interceptors));
+ this.protocolMap.put(ProtocolType.AARDVARK, new AardvarkProtocolManagerFactory().createProtocolManager(server, interceptors));
}
// RemotingService implementation -------------------------------
@@ -159,12 +160,19 @@
continue;
}
}
+
+ //TODO - allow protocol type to be configured from Configuration for each acceptor
+ ProtocolType protocol = hackProtocol;
+
+ ProtocolManager manager = protocolMap.get(protocol);
+
Acceptor acceptor = factory.createAcceptor(info.getParams(),
- bufferHandler,
+ new DelegatingBufferHandler(manager),
this,
threadPool,
- scheduledThreadPool);
+ scheduledThreadPool,
+ protocol);
acceptors.add(acceptor);
@@ -193,6 +201,9 @@
started = true;
}
+
+ //FIXME - temp hack so we can choose AARDVARK as protocol
+ public static ProtocolType hackProtocol = ProtocolType.CORE;
public synchronized void freeze()
{
@@ -376,8 +387,15 @@
// Inner classes -------------------------------------------------
- private final class DelegatingBufferHandler extends AbstractBufferHandler
+ private final class DelegatingBufferHandler implements BufferHandler
{
+ private ProtocolManager manager;
+
+ DelegatingBufferHandler(final ProtocolManager manager)
+ {
+ this.manager = manager;
+ }
+
public void bufferReceived(final Object connectionID, final HornetQBuffer buffer)
{
ConnectionEntry conn = connections.get(connectionID);
@@ -387,6 +405,11 @@
conn.connection.bufferReceived(connectionID, buffer);
}
}
+
+ public int isReadyToHandle(HornetQBuffer buffer)
+ {
+ return manager.isReadyToHandle(buffer);
+ }
}
private final class FailureCheckAndFlushThread extends Thread
Modified: trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -30,22 +30,22 @@
import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.protocol.core.Channel;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.HornetQExceptionMessage;
-import org.hornetq.core.protocol.core.wireformat.NullResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPrepareMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationResponseMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.HornetQExceptionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.NullResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationResponseMessage;
import org.hornetq.core.replication.ReplicationEndpoint;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.LargeServerMessage;
Modified: trunk/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -33,20 +33,20 @@
import org.hornetq.core.protocol.core.ChannelHandler;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.CreateReplicationSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationAddTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCommitMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationCompareDataMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationDeleteTXMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageBeingMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargeMessageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationLargemessageEndMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageEventMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPageWriteMessage;
-import org.hornetq.core.protocol.core.wireformat.ReplicationPrepareMessage;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateReplicationSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationAddTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCommitMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationCompareDataMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeingMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationLargemessageEndMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageEventMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.ReplicationPrepareMessage;
import org.hornetq.core.replication.ReplicationManager;
import org.hornetq.utils.ExecutorFactory;
Modified: trunk/src/main/org/hornetq/core/server/HornetQServer.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/HornetQServer.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/HornetQServer.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -24,7 +24,6 @@
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.replication.ReplicationEndpoint;
import org.hornetq.core.security.Role;
@@ -35,6 +34,7 @@
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.core.version.Version;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.spi.core.security.HornetQSecurityManager;
import org.hornetq.utils.ExecutorFactory;
@@ -76,7 +76,7 @@
String username,
String password,
int minLargeMessageSize,
- CoreRemotingConnection remotingConnection,
+ RemotingConnection remotingConnection,
boolean autoCommitSends,
boolean autoCommitAcks,
boolean preAcknowledge,
Modified: trunk/src/main/org/hornetq/core/server/ServerSession.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/ServerSession.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/ServerSession.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,6 +18,7 @@
import javax.transaction.xa.Xid;
import org.hornetq.api.core.SimpleString;
+import org.hornetq.spi.core.protocol.SessionCallback;
/**
*
@@ -85,7 +86,7 @@
void deleteQueue(SimpleString name) throws Exception;
- void createConsumer(long consumerID, SimpleString name, SimpleString filterString, boolean browseOnly) throws Exception;
+ void createConsumer(long consumerID, SimpleString queueName, SimpleString filterString, boolean browseOnly) throws Exception;
QueueQueryResult executeQueueQuery(SimpleString name) throws Exception;
Deleted: trunk/src/main/org/hornetq/core/server/SessionCallback.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/SessionCallback.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/SessionCallback.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -1,36 +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.server;
-
-import org.hornetq.api.core.SimpleString;
-
-/**
- * A SessionCallback
- *
- * @author Tim Fox
- *
- *
- */
-public interface SessionCallback
-{
- void sendProducerCreditsMessage(int credits, SimpleString address, int offset);
-
- int sendMessage(ServerMessage message, long consumerID, int deliveryCount);
-
- int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount);
-
- int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse);
-
- void closed();
-}
Modified: trunk/src/main/org/hornetq/core/server/cluster/Bridge.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/Bridge.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/cluster/Bridge.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -14,11 +14,11 @@
package org.hornetq.core.server.cluster;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.Consumer;
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A Core Bridge
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -36,7 +36,6 @@
import org.hornetq.core.message.impl.MessageImpl;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.BindingType;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HandleStatus;
import org.hornetq.core.server.MessageReference;
import org.hornetq.core.server.Queue;
@@ -46,6 +45,7 @@
import org.hornetq.core.server.cluster.Transformer;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.Future;
import org.hornetq.utils.TypedProperties;
import org.hornetq.utils.UUID;
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -69,7 +69,6 @@
import org.hornetq.core.postoffice.impl.LocalQueueBinding;
import org.hornetq.core.postoffice.impl.PostOfficeImpl;
import org.hornetq.core.protocol.core.Channel;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
import org.hornetq.core.replication.ReplicationEndpoint;
@@ -106,6 +105,7 @@
import org.hornetq.core.transaction.impl.ResourceManagerImpl;
import org.hornetq.core.version.Version;
import org.hornetq.spi.core.logging.LogDelegateFactory;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.spi.core.security.HornetQSecurityManager;
import org.hornetq.utils.ExecutorFactory;
import org.hornetq.utils.HornetQThreadFactory;
@@ -538,7 +538,7 @@
final String username,
final String password,
final int minLargeMessageSize,
- final CoreRemotingConnection connection,
+ final RemotingConnection connection,
final boolean autoCommitSends,
final boolean autoCommitAcks,
final boolean preAcknowledge,
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -39,11 +39,11 @@
import org.hornetq.core.server.ServerConsumer;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.SessionCallback;
import org.hornetq.core.server.management.ManagementService;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.transaction.Transaction;
import org.hornetq.core.transaction.impl.TransactionImpl;
+import org.hornetq.spi.core.protocol.SessionCallback;
import org.hornetq.utils.Future;
import org.hornetq.utils.TypedProperties;
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,7 +21,6 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.impl.MessageImpl;
import org.hornetq.core.paging.PagingStore;
-import org.hornetq.core.protocol.core.PacketImpl;
import org.hornetq.core.server.MessageReference;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.ServerMessage;
@@ -313,7 +312,7 @@
{
// We first set the message id - this needs to be set on the buffer since this buffer will be re-used
- buffer.setLong(buffer.getInt(PacketImpl.PACKET_HEADERS_SIZE) + DataConstants.SIZE_INT, messageID);
+ buffer.setLong(buffer.getInt(MessageImpl.BUFFER_HEADER_SPACE) + DataConstants.SIZE_INT, messageID);
}
}
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -42,7 +42,6 @@
import org.hornetq.core.postoffice.Bindings;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.postoffice.QueueBinding;
-import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.remoting.CloseListener;
import org.hornetq.core.remoting.FailureListener;
import org.hornetq.core.security.CheckType;
@@ -57,12 +56,13 @@
import org.hornetq.core.server.ServerConsumer;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.server.ServerSession;
-import org.hornetq.core.server.SessionCallback;
import org.hornetq.core.server.management.ManagementService;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.core.transaction.Transaction;
import org.hornetq.core.transaction.impl.TransactionImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.spi.core.protocol.SessionCallback;
import org.hornetq.utils.TypedProperties;
/*
@@ -99,7 +99,7 @@
private final boolean strictUpdateDeliveryCount;
- private CoreRemotingConnection remotingConnection;
+ private RemotingConnection remotingConnection;
private final Map<Long, ServerConsumer> consumers = new ConcurrentHashMap<Long, ServerConsumer>();
@@ -147,7 +147,7 @@
final boolean preAcknowledge,
final boolean strictUpdateDeliveryCount,
final boolean xa,
- final CoreRemotingConnection remotingConnection,
+ final RemotingConnection remotingConnection,
final StorageManager storageManager,
final PostOffice postOffice,
final ResourceManager resourceManager,
@@ -285,15 +285,15 @@
}
public void createConsumer(final long consumerID,
- final SimpleString name,
+ final SimpleString queueName,
final SimpleString filterString,
final boolean browseOnly) throws Exception
{
- Binding binding = postOffice.getBinding(name);
+ Binding binding = postOffice.getBinding(queueName);
if (binding == null || binding.getType() != BindingType.LOCAL_QUEUE)
{
- throw new HornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, "Queue " + name + " does not exist");
+ throw new HornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, "Queue " + queueName + " does not exist");
}
securityStore.check(binding.getAddress(), CheckType.CONSUME, this);
Modified: trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -16,6 +16,7 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.ssl.SslHandler;
@@ -44,10 +45,19 @@
// Public --------------------------------------------------------
- public static void addCodecFilter(final ChannelPipeline pipeline, final BufferHandler handler)
+ public static void addCodecFilter(final ProtocolType protocol, final ChannelPipeline pipeline, final BufferHandler handler)
{
assert pipeline != null;
- pipeline.addLast("decoder", new HornetQFrameDecoder2());
+
+ if (protocol == ProtocolType.CORE)
+ {
+ pipeline.addLast("decoder", new HornetQFrameDecoder2());
+ }
+ else
+ {
+ //Use the old frame decoder for other protocols
+ pipeline.addLast("decoder", new HornetQFrameDecoder(handler));
+ }
}
public static void addSSLFilter(final ChannelPipeline pipeline, final SSLContext context, final boolean client) throws Exception
Modified: trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -49,30 +49,33 @@
@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
+ log.info("dewcoding!!");
+
int start = in.readerIndex();
int length = handler.isReadyToHandle(new ChannelBufferWrapper(in));
+
+ log.info("length is " + length);
in.readerIndex(start);
+
+ log.info("length is 2 " + length);
if (length == -1)
{
return null;
}
+
+ log.info("creating buffer");
- // in.readerIndex(start + SIZE_INT);
+ ChannelBuffer buffer = in.readBytes(length);
- 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);
+
+ log.info("got the buffer");
- newBuffer.readInt();
-
return newBuffer;
}
}
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -31,10 +31,10 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.NotificationType;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.core.remoting.impl.ssl.SSLSupport;
import org.hornetq.core.server.management.Notification;
import org.hornetq.core.server.management.NotificationService;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
@@ -130,17 +130,24 @@
private NotificationService notificationService;
private VirtualExecutorService bossExecutor;
+
+ private final ProtocolType protocol;
+
+ private boolean paused;
public NettyAcceptor(final Map<String, Object> configuration,
final BufferHandler handler,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
- final ScheduledExecutorService scheduledThreadPool)
+ final ScheduledExecutorService scheduledThreadPool,
+ final ProtocolType protocol)
{
this.handler = handler;
this.listener = listener;
-
+
+ this.protocol = protocol;
+
sslEnabled = ConfigurationHelper.getBooleanProperty(TransportConstants.SSL_ENABLED_PROP_NAME,
TransportConstants.DEFAULT_SSL_ENABLED,
configuration);
@@ -281,7 +288,7 @@
pipeline.addLast("httphandler", new HttpAcceptorHandler(httpKeepAliveRunnable, httpResponseTime));
}
- ChannelPipelineSupport.addCodecFilter(pipeline, handler);
+ ChannelPipelineSupport.addCodecFilter(protocol, pipeline, handler);
pipeline.addLast("handler", new HornetQServerChannelHandler(channelGroup, handler, new Listener()));
return pipeline;
}
@@ -420,8 +427,6 @@
return channelFactory != null;
}
- private boolean paused;
-
public void pause()
{
if (paused)
@@ -454,7 +459,6 @@
bossExecutor.shutdown();
try
{
-
bossExecutor.awaitTermination(30, TimeUnit.SECONDS);
}
catch (InterruptedException e)
@@ -521,7 +525,7 @@
throw new IllegalArgumentException("Connection already exists with id " + connection.getID());
}
- listener.connectionCreated(connection, protocol);
+ listener.connectionCreated(connection, NettyAcceptor.this.protocol);
}
public void connectionDestroyed(final Object connectionID)
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptorFactory.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,6 +18,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.AcceptorFactory;
import org.hornetq.spi.core.remoting.BufferHandler;
@@ -34,9 +35,11 @@
final BufferHandler handler,
final ConnectionLifeCycleListener listener,
final Executor threadPool,
- final ScheduledExecutorService scheduledThreadPool)
+ final ScheduledExecutorService scheduledThreadPool,
+ final ProtocolType protocol)
{
- return new NettyAcceptor(configuration, handler, listener, threadPool, scheduledThreadPool);
+ return new NettyAcceptor(configuration, handler, listener, threadPool, scheduledThreadPool,
+ protocol);
}
public Set<String> getAllowableProperties()
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyConnection.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyConnection.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyConnection.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,7 +17,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.buffers.impl.ChannelBufferWrapper;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
import org.jboss.netty.buffer.ChannelBuffers;
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -30,8 +30,8 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.core.remoting.impl.ssl.SSLSupport;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -311,7 +311,7 @@
pipeline.addLast("httpResponseDecoder", new HttpResponseDecoder());
pipeline.addLast("httphandler", new HttpHandler());
}
- ChannelPipelineSupport.addCodecFilter(pipeline, handler);
+ ChannelPipelineSupport.addCodecFilter(ProtocolType.CORE, pipeline, handler);
pipeline.addLast("handler", new HornetQClientChannelHandler(channelGroup, handler, new Listener()));
return pipeline;
}
Copied: trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/server/ConnectionEntry.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/ConnectionEntry.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2010 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.spi.core.protocol;
+
+
+/**
+ * A ConnectionEntry
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class ConnectionEntry
+{
+ public final RemotingConnection connection;
+
+ public volatile long lastCheck;
+
+ public volatile long ttl;
+
+ public ConnectionEntry(final RemotingConnection connection, final long lastCheck, final long ttl)
+ {
+ this.connection = connection;
+
+ this.lastCheck = lastCheck;
+
+ this.ttl = ttl;
+ }
+}
Copied: trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/server/ProtocolManager.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/ProtocolManager.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2010 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.spi.core.protocol;
+
+import org.hornetq.spi.core.remoting.BufferHandler;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A ProtocolManager
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public interface ProtocolManager extends BufferHandler
+{
+ ConnectionEntry createConnectionEntry(Connection connection);
+}
Copied: trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/ProtocolType.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/ProtocolType.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2010 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.spi.core.protocol;
+
+/**
+ * A ProtocolType
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public enum ProtocolType
+{
+ CORE, STOMP, AMQP, AARDVARK;
+}
Copied: trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java (from rev 8827, trunk/src/main/org/hornetq/core/remoting/RemotingConnection.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/RemotingConnection.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,155 @@
+/*
+ * 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.spi.core.protocol;
+
+import java.util.List;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.core.remoting.CloseListener;
+import org.hornetq.core.remoting.FailureListener;
+import org.hornetq.spi.core.remoting.BufferHandler;
+import org.hornetq.spi.core.remoting.Connection;
+
+/**
+ * A RemotingConnection is a connection between a client and a server.
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ */
+public interface RemotingConnection extends BufferHandler
+{
+ /**
+ * returns the unique id of the Remoting Connection
+ *
+ * @return the id
+ */
+ Object getID();
+
+ /**
+ * returns a string representation of the remote address of this connection
+ *
+ * @return the remote address
+ */
+ String getRemoteAddress();
+
+ /**
+ * add a failure listener.
+ * <p/>
+ * The listener will be called in the event of connection failure.
+ *
+ * @param listener the listener
+ */
+ void addFailureListener(FailureListener listener);
+
+ /**
+ * remove the failure listener
+ *
+ * @param listener the lister to remove
+ * @return true if removed
+ */
+ boolean removeFailureListener(FailureListener listener);
+
+ /**
+ * add a CloseListener.
+ * <p/>
+ * This will be called in the event of the connection being closed.
+ *
+ * @param listener the listener to add
+ */
+ void addCloseListener(CloseListener listener);
+
+ /**
+ * remove a Close Listener
+ *
+ * @param listener the listener to remove
+ * @return true if removed
+ */
+ boolean removeCloseListener(CloseListener listener);
+
+ /**
+ * return all the failure listeners
+ *
+ * @return the listeners
+ */
+ List<FailureListener> getFailureListeners();
+
+ /**
+ * set the failure listeners.
+ * <p/>
+ * These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.
+ *
+ * @param listeners the listeners to add.
+ */
+ void setFailureListeners(List<FailureListener> listeners);
+
+ /**
+ * creates a new HornetQBuffer of the specified size.
+ *
+ * @param size the size of buffer required
+ * @return the buffer
+ */
+ HornetQBuffer createBuffer(int size);
+
+ /**
+ * called when the underlying connection fails.
+ *
+ * @param me the exception that caused the failure
+ */
+ void fail(HornetQException me);
+
+ /**
+ * destroys this connection.
+ */
+ void destroy();
+
+ /**
+ * return the underlying Connection.
+ *
+ * @return the connection
+ */
+ Connection getTransportConnection();
+
+ /**
+ * returns whether or not the Remoting Connection is a client
+ *
+ * @return true if client, false if a server
+ */
+ boolean isClient();
+
+ /**
+ * returns true if this Remoting Connection has been destroyed.
+ *
+ * @return true if destroyed, otherwise false
+ */
+ boolean isDestroyed();
+
+ /**
+ * Disconnect the connection, closing all channels
+ */
+ void disconnect();
+
+ /**
+ * returns true if any data has been received since the last time this method was called.
+ *
+ * @return true if data has been received.
+ */
+ boolean checkDataReceived();
+
+ /**
+ * flush all outstanding data from the connection.
+ */
+ void flush();
+
+}
Copied: trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java (from rev 8827, trunk/src/main/org/hornetq/core/server/SessionCallback.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/protocol/SessionCallback.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,37 @@
+/*
+ * 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.spi.core.protocol;
+
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.server.ServerMessage;
+
+/**
+ * A SessionCallback
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public interface SessionCallback
+{
+ void sendProducerCreditsMessage(int credits, SimpleString address, int offset);
+
+ int sendMessage(ServerMessage message, long consumerID, int deliveryCount);
+
+ int sendLargeMessage(long consumerID, byte[] headerBuffer, long bodySize, int deliveryCount);
+
+ int sendLargeMessageContinuation(long consumerID, byte[] body, boolean continues, boolean requiresResponse);
+
+ void closed();
+}
Modified: trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/spi/core/remoting/AcceptorFactory.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -18,6 +18,8 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
+import org.hornetq.spi.core.protocol.ProtocolType;
+
/**
* A factory for creating acceptors.
* <p/>
@@ -43,7 +45,8 @@
BufferHandler handler,
ConnectionLifeCycleListener listener,
Executor threadPool,
- ScheduledExecutorService scheduledThreadPool);
+ ScheduledExecutorService scheduledThreadPool,
+ ProtocolType protocol);
/**
* Returns the allowable properties for this acceptor.
Modified: trunk/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java
===================================================================
--- trunk/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/src/main/org/hornetq/spi/core/remoting/ConnectionLifeCycleListener.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -13,7 +13,7 @@
package org.hornetq.spi.core.remoting;
import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.ProtocolType;
+import org.hornetq.spi.core.protocol.ProtocolType;
/**
* A ConnectionLifeCycleListener is called by the remoting implementation to notify of connection events.
Copied: trunk/src/main/org/hornetq/utils/XidCodecSupport.java (from rev 8827, trunk/src/main/org/hornetq/core/protocol/core/wireformat/XidCodecSupport.java)
===================================================================
--- trunk/src/main/org/hornetq/utils/XidCodecSupport.java (rev 0)
+++ trunk/src/main/org/hornetq/utils/XidCodecSupport.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -0,0 +1,72 @@
+/*
+ * 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.utils;
+
+import javax.transaction.xa.Xid;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.transaction.impl.XidImpl;
+
+/**
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class XidCodecSupport
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ public static void encodeXid(final Xid xid, final HornetQBuffer out)
+ {
+ out.writeInt(xid.getFormatId());
+ out.writeInt(xid.getBranchQualifier().length);
+ out.writeBytes(xid.getBranchQualifier());
+ out.writeInt(xid.getGlobalTransactionId().length);
+ out.writeBytes(xid.getGlobalTransactionId());
+ }
+
+ public static Xid decodeXid(final HornetQBuffer in)
+ {
+ int formatID = in.readInt();
+ byte[] bq = new byte[in.readInt()];
+ in.readBytes(bq);
+ byte[] gtxid = new byte[in.readInt()];
+ in.readBytes(gtxid);
+ Xid xid = new XidImpl(bq, formatID, gtxid);
+ return xid;
+ }
+
+ public static int getXidEncodeLength(final Xid xid)
+ {
+ return DataConstants.SIZE_INT * 3 + xid.getBranchQualifier().length + xid.getGlobalTransactionId().length;
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Modified: trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -25,12 +25,12 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionSendMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.ServerMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -28,10 +28,10 @@
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/FailureDeadlockTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -24,12 +24,12 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQSession;
import org.hornetq.jms.server.impl.JMSServerManagerImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.integration.jms.server.management.NullInitialContext;
import org.hornetq.tests.util.UnitTestCase;
Modified: trunk/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -12,12 +12,12 @@
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
*
Modified: trunk/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -20,7 +20,7 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
Modified: trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -27,8 +27,8 @@
import org.hornetq.core.protocol.core.Channel;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionMessage;
-import org.hornetq.core.protocol.core.wireformat.CreateSessionResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
import org.hornetq.core.server.HornetQServer;
Modified: trunk/tests/src/org/hornetq/tests/integration/client/ProducerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ProducerTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ProducerTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,9 +26,9 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,11 +21,11 @@
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.UnitTestCase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/client/SessionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/SessionTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/SessionTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -29,9 +29,9 @@
import org.hornetq.api.core.client.ClientSession.BindingQuery;
import org.hornetq.api.core.client.ClientSession.QueueQuery;
import org.hornetq.core.client.impl.ClientSessionInternal;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -28,13 +28,13 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.UnitTestCase;
Modified: trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptor.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -20,8 +20,8 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveMessage;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
Modified: trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/clientcrash/DummyInterceptorB.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -19,7 +19,7 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
*
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -27,7 +27,6 @@
import org.hornetq.api.core.client.*;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
@@ -36,6 +35,7 @@
import org.hornetq.core.server.cluster.QueueConfiguration;
import org.hornetq.core.server.cluster.impl.BridgeImpl;
import org.hornetq.integration.transports.netty.NettyConnectorFactory;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A BridgeReconnectTest
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -31,7 +31,7 @@
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.client.impl.DelegatingSession;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A MultiThreadFailoverTest
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -16,8 +16,8 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A DelayInterceptor
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor2.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,8 +17,8 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A DelayInterceptor2
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/DelayInterceptor3.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -17,8 +17,8 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A DelayInterceptor3
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -35,10 +35,10 @@
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -22,10 +22,10 @@
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.server.cluster.MessageFlowRecord;
import org.hornetq.core.server.cluster.impl.ClusterConnectionImpl;
import org.hornetq.core.server.group.impl.GroupingHandlerConfiguration;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.integration.cluster.distribution.ClusterTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -30,11 +30,11 @@
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.replication.impl.ReplicationEndpointImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.impl.HornetQServerImpl;
import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A PagingFailoverTest
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,8 +26,8 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionInternal;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.integration.cluster.distribution.ClusterTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadReattachSupport.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,7 +26,7 @@
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.UnitTestCase;
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -31,7 +31,7 @@
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.protocol.core.RemotingConnectionImpl;
+import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.util.ServiceTestBase;
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -29,11 +29,11 @@
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/http/NettyHttpTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -25,11 +25,11 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.NettyConnector;
import org.hornetq.integration.transports.netty.TransportConstants;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -99,7 +99,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler2 connectorHandler = new SimpleBufferHandler2(connectorLatch);
@@ -153,7 +153,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler2 connectorHandler = new SimpleBufferHandler2(connectorLatch);
@@ -211,7 +211,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -270,7 +270,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, -1l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -328,7 +328,7 @@
conf.put(TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME, 500l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
SimpleBufferHandler connectorHandler = new SimpleBufferHandler(connectorLatch);
@@ -382,7 +382,7 @@
conf.put(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME, 5000l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler acceptorHandler = new SimpleBufferHandler(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
BogusResponseHandler connectorHandler = new BogusResponseHandler(connectorLatch);
@@ -429,7 +429,7 @@
conf.put(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME, 5000l);
DummyConnectionLifeCycleListener acceptorListener = new DummyConnectionLifeCycleListener(connCreatedLatch);
SimpleBufferHandler2 acceptorHandler = new SimpleBufferHandler2(acceptorLatch);
- acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool);
+ acceptor = new NettyAcceptor(conf, acceptorHandler, acceptorListener, threadPool, scheduledThreadPool, ProtocolType.CORE);
acceptor.start();
BogusResponseHandler connectorHandler = new BogusResponseHandler(connectorLatch);
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -32,9 +32,9 @@
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.integration.transports.netty.NettyConnectorFactory;
import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.JMSTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -38,7 +38,6 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.server.HornetQServer;
@@ -46,6 +45,7 @@
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQQueue;
import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/cluster/JMSReconnectTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -37,7 +37,6 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
@@ -45,6 +44,7 @@
import org.hornetq.jms.client.HornetQQueue;
import org.hornetq.jms.client.HornetQSession;
import org.hornetq.jms.client.HornetQTopic;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -27,7 +27,7 @@
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.JMSTestBase;
import org.hornetq.tests.util.UnitTestCase;
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseDestroyedConnectionTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -26,9 +26,9 @@
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQSession;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.JMSTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/remoting/PingTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/remoting/PingTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/remoting/PingTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -33,11 +33,11 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.remoting.CloseListener;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.ServiceTestBase;
/**
Modified: trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -59,7 +59,6 @@
import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.persistence.impl.journal.OperationContextImpl;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.replication.impl.ReplicatedJournal;
import org.hornetq.core.replication.impl.ReplicationManagerImpl;
@@ -69,6 +68,7 @@
import org.hornetq.core.server.impl.ServerMessageImpl;
import org.hornetq.core.settings.HierarchicalRepository;
import org.hornetq.core.settings.impl.AddressSettings;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.utils.ExecutorFactory;
Modified: trunk/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/stress/remote/PingStressTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -25,9 +25,9 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
-import org.hornetq.core.protocol.core.PacketImpl;
-import org.hornetq.core.remoting.RemotingConnection;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.tests.integration.remoting.PingTest;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
Modified: trunk/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/client/impl/LargeMessageBufferTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -36,9 +36,9 @@
import org.hornetq.core.client.impl.ClientConsumerInternal;
import org.hornetq.core.client.impl.ClientMessageInternal;
import org.hornetq.core.client.impl.LargeMessageBufferImpl;
-import org.hornetq.core.protocol.core.wireformat.SessionQueueQueryResponseMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveContinuationMessage;
-import org.hornetq.core.protocol.core.wireformat.SessionReceiveLargeMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionQueueQueryResponseMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage;
+import org.hornetq.core.protocol.core.impl.wireformat.SessionReceiveLargeMessage;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,10 +21,10 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.NettyAcceptorFactory;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Acceptor;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
@@ -73,7 +73,8 @@
handler,
listener,
Executors.newCachedThreadPool(),
- Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE));
+ Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE),
+ ProtocolType.CORE);
Assert.assertTrue(acceptor instanceof NettyAcceptor);
}
Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -22,10 +22,10 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
import org.hornetq.integration.transports.netty.NettyAcceptor;
import org.hornetq.integration.transports.netty.TransportConstants;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
@@ -86,7 +86,8 @@
handler,
listener,
Executors.newCachedThreadPool(),
- Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE));
+ Executors.newScheduledThreadPool(ConfigurationImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE),
+ ProtocolType.CORE);
acceptor.start();
Assert.assertTrue(acceptor.isStarted());
Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectionTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -22,8 +22,8 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.ProtocolType;
import org.hornetq.integration.transports.netty.NettyConnection;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
import org.hornetq.tests.util.RandomUtil;
Modified: trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java 2010-01-21 17:05:06 UTC (rev 8830)
+++ trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java 2010-01-21 20:07:20 UTC (rev 8831)
@@ -21,9 +21,9 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
-import org.hornetq.core.remoting.ProtocolType;
-import org.hornetq.core.remoting.impl.AbstractBufferHandler;
+import org.hornetq.core.protocol.core.impl.AbstractBufferHandler;
import org.hornetq.integration.transports.netty.NettyConnector;
+import org.hornetq.spi.core.protocol.ProtocolType;
import org.hornetq.spi.core.remoting.BufferHandler;
import org.hornetq.spi.core.remoting.Connection;
import org.hornetq.spi.core.remoting.ConnectionLifeCycleListener;
14 years, 11 months