From 161c24aa1695f297c757dfa725adbe66c2b8ef39 Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Thu, 30 Mar 2006 18:06:06 +0000 Subject: [PATCH] Changed the KeepAliveInfo packet so that it extends BaseCommand so that a reply can be requested. Should will allow for a broker or a client to get almost imediate feedback to see if the connection is down. git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@390200 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/activemq/command/KeepAliveInfo.java | 16 +--------------- .../openwire/v1/KeepAliveInfoMarshaller.java | 2 +- .../activemq/openwire/v1/KeepAliveInfoTest.java | 2 +- .../csharp/ActiveMQ/Commands/KeepAliveInfo.cs | 2 +- .../OpenWire/V1/KeepAliveInfoMarshaller.cs | 2 +- openwire-c/src/libopenwire/ow_commands_v1.c | 7 ++++--- openwire-c/src/libopenwire/ow_commands_v1.h | 2 ++ openwire-cpp/src/command/KeepAliveInfo.hpp | 2 +- .../src/marshal/KeepAliveInfoMarshaller.hpp | 2 +- 9 files changed, 13 insertions(+), 24 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java b/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java index 2c8496df9c..a38d8175a9 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java @@ -23,7 +23,7 @@ import org.apache.activemq.util.IntrospectionSupport; * @openwire:marshaller code="10" * @version $Revision$ */ -public class KeepAliveInfo implements Command { +public class KeepAliveInfo extends BaseCommand { public static final byte DATA_STRUCTURE_TYPE=CommandTypes.KEEP_ALIVE_INFO; @@ -34,20 +34,6 @@ public class KeepAliveInfo implements Command { return DATA_STRUCTURE_TYPE; } - public void setCommandId(int value) { - } - - public int getCommandId() { - return 0; - } - - public void setResponseRequired(boolean responseRequired) { - } - - public boolean isResponseRequired() { - return false; - } - public boolean isResponse() { return false; } diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/KeepAliveInfoMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/KeepAliveInfoMarshaller.java index 7b263527de..548f6ebb46 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/KeepAliveInfoMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/KeepAliveInfoMarshaller.java @@ -37,7 +37,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class KeepAliveInfoMarshaller extends BaseDataStreamMarshaller { +public class KeepAliveInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java index 3b6d466c83..8180e06258 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java @@ -35,7 +35,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class KeepAliveInfoTest extends DataFileGeneratorTestSupport { +public class KeepAliveInfoTest extends BaseCommandTestSupport { public static KeepAliveInfoTest SINGLETON = new KeepAliveInfoTest(); diff --git a/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/KeepAliveInfo.cs b/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/KeepAliveInfo.cs index 678474891d..7d9fa07d7a 100644 --- a/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/KeepAliveInfo.cs +++ b/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/KeepAliveInfo.cs @@ -32,7 +32,7 @@ namespace ActiveMQ.Commands /// /// The ActiveMQ KeepAliveInfo Command /// - public class KeepAliveInfo : BaseDataStructure, Command + public class KeepAliveInfo : BaseCommand { public const byte ID_KeepAliveInfo = 10; diff --git a/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/KeepAliveInfoMarshaller.cs b/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/KeepAliveInfoMarshaller.cs index 471a794393..623d7f06b0 100644 --- a/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/KeepAliveInfoMarshaller.cs +++ b/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/KeepAliveInfoMarshaller.cs @@ -34,7 +34,7 @@ namespace ActiveMQ.OpenWire.V1 /// /// Marshalling code for Open Wire Format for KeepAliveInfo /// - class KeepAliveInfoMarshaller : BaseDataStreamMarshaller + class KeepAliveInfoMarshaller : BaseCommandMarshaller { diff --git a/openwire-c/src/libopenwire/ow_commands_v1.c b/openwire-c/src/libopenwire/ow_commands_v1.c index fdc93c7b7d..7ab5e58307 100644 --- a/openwire-c/src/libopenwire/ow_commands_v1.c +++ b/openwire-c/src/libopenwire/ow_commands_v1.c @@ -2223,20 +2223,20 @@ ow_KeepAliveInfo *ow_KeepAliveInfo_create(apr_pool_t *pool) apr_status_t ow_marshal1_KeepAliveInfo(ow_bit_buffer *buffer, ow_KeepAliveInfo *object) { - ow_marshal1_DataStructure(buffer, (ow_DataStructure*)object); + ow_marshal1_BaseCommand(buffer, (ow_BaseCommand*)object); return APR_SUCCESS; } apr_status_t ow_marshal2_KeepAliveInfo(ow_byte_buffer *buffer, ow_bit_buffer *bitbuffer, ow_KeepAliveInfo *object) { - ow_marshal2_DataStructure(buffer, bitbuffer, (ow_DataStructure*)object); + ow_marshal2_BaseCommand(buffer, bitbuffer, (ow_BaseCommand*)object); return APR_SUCCESS; } apr_status_t ow_unmarshal_KeepAliveInfo(ow_byte_array *buffer, ow_bit_buffer *bitbuffer, ow_KeepAliveInfo *object, apr_pool_t *pool) { - ow_unmarshal_DataStructure(buffer, bitbuffer, (ow_DataStructure*)object, pool); + ow_unmarshal_BaseCommand(buffer, bitbuffer, (ow_BaseCommand*)object, pool); return APR_SUCCESS; } @@ -2384,6 +2384,7 @@ ow_boolean ow_is_a_BaseCommand(ow_DataStructure *object) { case OW_DESTINATIONINFO_TYPE: case OW_SHUTDOWNINFO_TYPE: case OW_DATARESPONSE_TYPE: + case OW_KEEPALIVEINFO_TYPE: case OW_FLUSHCOMMAND_TYPE: case OW_MESSAGEDISPATCH_TYPE: case OW_ACTIVEMQMAPMESSAGE_TYPE: diff --git a/openwire-c/src/libopenwire/ow_commands_v1.h b/openwire-c/src/libopenwire/ow_commands_v1.h index 4f853810b9..737adf5f8c 100644 --- a/openwire-c/src/libopenwire/ow_commands_v1.h +++ b/openwire-c/src/libopenwire/ow_commands_v1.h @@ -653,6 +653,8 @@ ow_boolean ow_is_a_DataResponse(ow_DataStructure *object); typedef struct ow_KeepAliveInfo { ow_byte structType; + ow_int commandId; + ow_boolean responseRequired; } ow_KeepAliveInfo; ow_KeepAliveInfo *ow_KeepAliveInfo_create(apr_pool_t *pool); diff --git a/openwire-cpp/src/command/KeepAliveInfo.hpp b/openwire-cpp/src/command/KeepAliveInfo.hpp index f14d2583eb..99f542de5a 100644 --- a/openwire-cpp/src/command/KeepAliveInfo.hpp +++ b/openwire-cpp/src/command/KeepAliveInfo.hpp @@ -1 +1 @@ -/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed 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. */ #ifndef KeepAliveInfo_hpp_ #define KeepAliveInfo_hpp_ #include #include "command/BaseDataStructure.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for KeepAliveInfo * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class KeepAliveInfo : public BaseDataStructure { private: public: const static int TYPE = 10; public: KeepAliveInfo() ; virtual ~KeepAliveInfo() ; virtual int getCommandType() ; } ; /* namespace */ } } } } #endif /*KeepAliveInfo_hpp_*/ \ No newline at end of file +/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed 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. */ #ifndef KeepAliveInfo_hpp_ #define KeepAliveInfo_hpp_ #include #include "command/BaseCommand.hpp" #include "util/ifr/ap.hpp" #include "util/ifr/p.hpp" namespace apache { namespace activemq { namespace client { namespace command { using namespace ifr; using namespace std; using namespace apache::activemq::client; /* * * Marshalling code for Open Wire Format for KeepAliveInfo * * * NOTE!: This file is autogenerated - do not modify! * if you need to make a change, please see the Groovy scripts in the * activemq-core module * */ class KeepAliveInfo : public BaseCommand { private: public: const static int TYPE = 10; public: KeepAliveInfo() ; virtual ~KeepAliveInfo() ; virtual int getCommandType() ; } ; /* namespace */ } } } } #endif /*KeepAliveInfo_hpp_*/ \ No newline at end of file diff --git a/openwire-cpp/src/marshal/KeepAliveInfoMarshaller.hpp b/openwire-cpp/src/marshal/KeepAliveInfoMarshaller.hpp index 8ba96d7f0e..2d05251743 100644 --- a/openwire-cpp/src/marshal/KeepAliveInfoMarshaller.hpp +++ b/openwire-cpp/src/marshal/KeepAliveInfoMarshaller.hpp @@ -1 +1 @@ -/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed 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. */ #ifndef KeepAliveInfoMarshaller_hpp_ #define KeepAliveInfoMarshaller_hpp_ #include #include "command/IDataStructure.hpp" /* we could cut this down - for now include all possible headers */ #include "command/BrokerId.hpp" #include "command/ConnectionId.hpp" #include "command/ConsumerId.hpp" #include "command/ProducerId.hpp" #include "command/SessionId.hpp" #include "io/BinaryReader.hpp" #include "io/BinaryWriter.hpp" #include "command/BaseDataStreamMarshaller.hpp" #include "util/ifr/p.hpp" #include "protocol/ProtocolFormat.hpp" namespace apache { namespace activemq { namespace client { namespace marshal { using namespace ifr ; using namespace apache::activemq::client::command; using namespace apache::activemq::client::io; using namespace apache::activemq::client::protocol; /* * */ class KeepAliveInfoMarshaller : public BaseDataStreamMarshaller { public: KeepAliveInfoMarshaller() ; virtual ~KeepAliveInfoMarshaller() ; virtual IDataStructure* createCommand() ; virtual char getDataStructureType() ; virtual void unmarshal(ProtocolFormat& wireFormat, Object o, BinaryReader& dataIn, BooleanStream& bs) ; virtual int marshal1(ProtocolFormat& wireFormat, Object& o, BooleanStream& bs) ; virtual void marshal2(ProtocolFormat& wireFormat, Object& o, BinaryWriter& dataOut, BooleanStream& bs) ; } ; /* namespace */ } } } } #endif /*KeepAliveInfoMarshaller_hpp_*/ \ No newline at end of file +/* * Copyright 2006 The Apache Software Foundation or its licensors, as * applicable. * * Licensed 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. */ #ifndef KeepAliveInfoMarshaller_hpp_ #define KeepAliveInfoMarshaller_hpp_ #include #include "command/IDataStructure.hpp" /* we could cut this down - for now include all possible headers */ #include "command/BrokerId.hpp" #include "command/ConnectionId.hpp" #include "command/ConsumerId.hpp" #include "command/ProducerId.hpp" #include "command/SessionId.hpp" #include "io/BinaryReader.hpp" #include "io/BinaryWriter.hpp" #include "command/BaseCommandMarshaller.hpp" #include "util/ifr/p.hpp" #include "protocol/ProtocolFormat.hpp" namespace apache { namespace activemq { namespace client { namespace marshal { using namespace ifr ; using namespace apache::activemq::client::command; using namespace apache::activemq::client::io; using namespace apache::activemq::client::protocol; /* * */ class KeepAliveInfoMarshaller : public BaseCommandMarshaller { public: KeepAliveInfoMarshaller() ; virtual ~KeepAliveInfoMarshaller() ; virtual IDataStructure* createCommand() ; virtual char getDataStructureType() ; virtual void unmarshal(ProtocolFormat& wireFormat, Object o, BinaryReader& dataIn, BooleanStream& bs) ; virtual int marshal1(ProtocolFormat& wireFormat, Object& o, BooleanStream& bs) ; virtual void marshal2(ProtocolFormat& wireFormat, Object& o, BinaryWriter& dataOut, BooleanStream& bs) ; } ; /* namespace */ } } } } #endif /*KeepAliveInfoMarshaller_hpp_*/ \ No newline at end of file