You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/03/09 01:41:58 UTC
svn commit: r384390 [1/11] - in /incubator/activemq/trunk:
activemq-core/src/gram/java/org/apache/activemq/openwire/tool/
activemq-core/src/gram/script/
activemq-core/src/main/java/org/apache/activemq/command/
activemq-core/src/main/java/org/apache/act...
Author: chirino
Date: Wed Mar 8 16:41:39 2006
New Revision: 384390
URL: http://svn.apache.org/viewcvs?rev=384390&view=rev
Log:
I wish I could have commited this in smaller chunks
- Added support for the openwire loose encoding to the .NET port
- Fixed the InactivityMonitor, it was timing out conections too often and testcase for it would fail intermitently
- Improved the wire format option negociation phase.
- We now gaurd to sending the WireformatInfo, so it's only sent once even if the start method is called multiple times.
- We now wait for the WireFormatInfo to be sent before reconfiguring the WireFormat with the new negociated options
- Option negociation is now simpler to understand:
- The WireFormatInfo is allways sent with all options turned off
- Once WireFormatInfo's are exchanged, we enable the options on the WireFormat that both sides enabled.
Modified:
incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java
incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterMarshaller.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/QuickJournalPersistenceAdapter.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportFactory.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/WireFormatInfoData.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQDestinationTestSupport.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQQueueTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempDestinationTestSupport.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTextMessageTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTopicTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BaseCommandTestSupport.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerIdTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionErrorTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionIdTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerIdTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ControlCommandTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataArrayResponseTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataResponseTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DestinationInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DiscoveryEventTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ExceptionResponseTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/FlushCommandTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/IntegerResponseTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalQueueAckTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTopicAckTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTraceTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTransactionTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LocalTransactionIdTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageAckTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageIdTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageTestSupport.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerIdTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ReplayCommandTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ResponseTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionIdTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ShutdownInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SubscriptionInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionIdTestSupport.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/XATransactionIdTest.java
incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java
incubator/activemq/trunk/activemq-dotnet/activemq-dotnet.csproj
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/BrokerId.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/BrokerInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ConnectionError.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ConnectionId.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ConnectionInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ConsumerId.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ConsumerInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ControlCommand.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/DataArrayResponse.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/DataResponse.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/DestinationInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/DiscoveryEvent.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ExceptionResponse.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/FlushCommand.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/IntegerResponse.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/JournalQueueAck.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/JournalTopicAck.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/JournalTrace.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/JournalTransaction.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/KeepAliveInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/LocalTransactionId.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/Message.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/MessageAck.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/MessageDispatch.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/MessageDispatchNotification.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/MessageId.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/NetworkBridgeFilter.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ProducerId.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ProducerInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/RemoveInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/RemoveSubscriptionInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ReplayCommand.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/Response.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/SessionId.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/SessionInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/ShutdownInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/SubscriptionInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/TransactionId.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/TransactionInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/WireFormatInfo.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Commands/XATransactionId.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/BaseDataStreamMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/OpenWireFormat.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQBytesMessageMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQDestinationMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQMapMessageMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQMessageMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQObjectMessageMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQQueueMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQStreamMessageMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQTempDestinationMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQTempQueueMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQTempTopicMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQTextMessageMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ActiveMQTopicMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/BaseCommandMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/BrokerIdMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/BrokerInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ConnectionErrorMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ConnectionIdMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ConnectionInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ConsumerIdMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ConsumerInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ControlCommandMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/DataArrayResponseMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/DataResponseMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/DestinationInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/DiscoveryEventMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ExceptionResponseMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/FlushCommandMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/IntegerResponseMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/JournalQueueAckMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/JournalTopicAckMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/JournalTraceMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/JournalTransactionMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/KeepAliveInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/LocalTransactionIdMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/MessageAckMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/MessageDispatchMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/MessageDispatchNotificationMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/MessageIdMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/MessageMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/NetworkBridgeFilterMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ProducerIdMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ProducerInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/RemoveInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/RemoveSubscriptionInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ReplayCommandMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ResponseMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/SessionIdMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/SessionInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/ShutdownInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/SubscriptionInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/TransactionIdMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/TransactionInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/WireFormatInfoMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/OpenWire/V1/XATransactionIdMarshaller.cs
incubator/activemq/trunk/activemq-dotnet/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransport.cs
incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/ConfigTest.java
incubator/activemq/trunk/openwire-cpp/src/command/ConnectionError.hpp
incubator/activemq/trunk/openwire-cpp/src/command/ControlCommand.hpp
incubator/activemq/trunk/openwire-cpp/src/command/DataArrayResponse.hpp
incubator/activemq/trunk/openwire-cpp/src/command/DataResponse.hpp
incubator/activemq/trunk/openwire-cpp/src/command/DestinationInfo.hpp
incubator/activemq/trunk/openwire-cpp/src/command/DiscoveryEvent.hpp
incubator/activemq/trunk/openwire-cpp/src/command/FlushCommand.hpp
incubator/activemq/trunk/openwire-cpp/src/command/IntegerResponse.hpp
incubator/activemq/trunk/openwire-cpp/src/command/JournalQueueAck.hpp
incubator/activemq/trunk/openwire-cpp/src/command/JournalTopicAck.hpp
incubator/activemq/trunk/openwire-cpp/src/command/JournalTrace.hpp
incubator/activemq/trunk/openwire-cpp/src/command/JournalTransaction.hpp
incubator/activemq/trunk/openwire-cpp/src/command/KeepAliveInfo.hpp
incubator/activemq/trunk/openwire-cpp/src/command/LocalTransactionId.hpp
incubator/activemq/trunk/openwire-cpp/src/command/MessageDispatch.hpp
incubator/activemq/trunk/openwire-cpp/src/command/MessageDispatchNotification.hpp
incubator/activemq/trunk/openwire-cpp/src/command/MessageId.hpp
incubator/activemq/trunk/openwire-cpp/src/command/NetworkBridgeFilter.cpp
incubator/activemq/trunk/openwire-cpp/src/command/NetworkBridgeFilter.hpp
incubator/activemq/trunk/openwire-cpp/src/command/RemoveSubscriptionInfo.hpp
incubator/activemq/trunk/openwire-cpp/src/command/ReplayCommand.hpp
incubator/activemq/trunk/openwire-cpp/src/command/ShutdownInfo.hpp
incubator/activemq/trunk/openwire-cpp/src/command/SubscriptionInfo.hpp
incubator/activemq/trunk/openwire-cpp/src/command/TransactionId.hpp
incubator/activemq/trunk/openwire-cpp/src/command/TransactionInfo.hpp
incubator/activemq/trunk/openwire-cpp/src/command/XATransactionId.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQBytesMessageMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQDestinationMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQMapMessageMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQMessageMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQObjectMessageMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQQueueMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQStreamMessageMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQTempDestinationMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQTempQueueMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQTempTopicMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQTextMessageMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ActiveMQTopicMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/BaseCommandMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ConnectionErrorMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ConnectionIdMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ConnectionInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ConsumerIdMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ConsumerInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ControlCommandMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/DataArrayResponseMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/DataResponseMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/DestinationInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/DiscoveryEventMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ExceptionResponseMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/FlushCommandMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/IntegerResponseMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/JournalQueueAckMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/JournalTopicAckMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/JournalTraceMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/JournalTransactionMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/KeepAliveInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/LocalTransactionIdMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/MessageAckMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/MessageDispatchMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/MessageDispatchNotificationMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/MessageIdMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/MessageMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/NetworkBridgeFilterMarshaller.cpp
incubator/activemq/trunk/openwire-cpp/src/marshal/NetworkBridgeFilterMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ProducerIdMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ProducerInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/RemoveInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/RemoveSubscriptionInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ReplayCommandMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ResponseMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/SessionIdMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/SessionInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/ShutdownInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/SubscriptionInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/TransactionIdMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/TransactionInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/WireFormatInfoMarshaller.hpp
incubator/activemq/trunk/openwire-cpp/src/marshal/XATransactionIdMarshaller.hpp
Modified: incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/java/org/apache/activemq/openwire/tool/OpenWireCSharpMarshallingScript.java Wed Mar 8 16:41:39 2006
@@ -39,6 +39,9 @@
return super.run();
}
+ //////////////////////////////////////////////////////////////////////////////////////
+ // This section is for the tight wire format encoding generator
+ //////////////////////////////////////////////////////////////////////////////////////
protected void generateTightUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
@@ -242,4 +245,149 @@
}
}
}
+
+ //////////////////////////////////////////////////////////////////////////////////////
+ // This section is for the loose wire format encoding generator
+ //////////////////////////////////////////////////////////////////////////////////////
+
+ protected void generateLooseUnmarshalBodyForProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+
+ String propertyName = property.getSimpleName();
+ String type = property.getType().getSimpleName();
+
+ if (type.equals("boolean")) {
+ out.println(" info." + propertyName + " = dataIn.ReadBoolean();");
+ }
+ else if (type.equals("byte")) {
+ out.println(" info." + propertyName + " = dataIn.ReadByte();");
+ }
+ else if (type.equals("char")) {
+ out.println(" info." + propertyName + " = dataIn.ReadChar();");
+ }
+ else if (type.equals("short")) {
+ out.println(" info." + propertyName + " = dataIn.ReadInt16();");
+ }
+ else if (type.equals("int")) {
+ out.println(" info." + propertyName + " = dataIn.ReadInt32();");
+ }
+ else if (type.equals("long")) {
+ out.println(" info." + propertyName + " = LooseUnmarshalLong(wireFormat, dataIn);");
+ }
+ else if (type.equals("String")) {
+ out.println(" info." + propertyName + " = LooseUnmarshalString(dataIn);");
+ }
+ else if (type.equals("byte[]") || type.equals("ByteSequence")) {
+ if (size != null) {
+ out.println(" info." + propertyName + " = ReadBytes(dataIn, " + size.asInt() + ");");
+ }
+ else {
+ out.println(" info." + propertyName + " = ReadBytes(dataIn, dataIn.ReadBoolean());");
+ }
+ }
+ else if (isThrowable(property.getType())) {
+ out.println(" info." + propertyName + " = LooseUnmarshalBrokerError(wireFormat, dataIn);");
+ }
+ else if (isCachedProperty(property)) {
+ out.println(" info." + propertyName + " = (" + type + ") LooseUnmarshalCachedObject(wireFormat, dataIn);");
+ }
+ else {
+ out.println(" info." + propertyName + " = (" + type + ") LooseUnmarshalNestedObject(wireFormat, dataIn);");
+ }
+ }
+
+ protected void generateLooseUnmarshalBodyForArrayProperty(PrintWriter out, JProperty property, JAnnotationValue size) {
+ JClass propertyType = property.getType();
+ String arrayType = propertyType.getArrayComponentType().getSimpleName();
+ String propertyName = property.getSimpleName();
+ out.println();
+ if (size != null) {
+ out.println(" {");
+ out.println(" " + arrayType + "[] value = new " + arrayType + "[" + size.asInt() + "];");
+ out.println(" " + "for( int i=0; i < " + size.asInt() + "; i++ ) {");
+ out.println(" value[i] = (" + arrayType + ") LooseUnmarshalNestedObject(wireFormat,dataIn);");
+ out.println(" }");
+ out.println(" info." + propertyName + " = value;");
+ out.println(" }");
+ }
+ else {
+ out.println(" if (dataIn.ReadBoolean()) {");
+ out.println(" short size = dataIn.ReadInt16();");
+ out.println(" " + arrayType + "[] value = new " + arrayType + "[size];");
+ out.println(" for( int i=0; i < size; i++ ) {");
+ out.println(" value[i] = (" + arrayType + ") LooseUnmarshalNestedObject(wireFormat,dataIn);");
+ out.println(" }");
+ out.println(" info." + propertyName + " = value;");
+ out.println(" }");
+ out.println(" else {");
+ out.println(" info." + propertyName + " = null;");
+ out.println(" }");
+ }
+ }
+
+
+ protected void generateLooseMarshalBody(PrintWriter out) {
+ List properties = getProperties();
+ for (Iterator iter = properties.iterator(); iter.hasNext();) {
+ JProperty property = (JProperty) iter.next();
+ JAnnotation annotation = property.getAnnotation("openwire:property");
+ JAnnotationValue size = annotation.getValue("size");
+ JClass propertyType = property.getType();
+ String type = propertyType.getSimpleName();
+ String getter = "info." + property.getSimpleName();
+
+ if (type.equals("boolean")) {
+ out.println(" dataOut.Write(" + getter + ");");
+ }
+ else if (type.equals("byte")) {
+ out.println(" dataOut.Write(" + getter + ");");
+ }
+ else if (type.equals("char")) {
+ out.println(" dataOut.Write(" + getter + ");");
+ }
+ else if (type.equals("short")) {
+ out.println(" dataOut.Write(" + getter + ");");
+ }
+ else if (type.equals("int")) {
+ out.println(" dataOut.Write(" + getter + ");");
+ }
+ else if (type.equals("long")) {
+ out.println(" LooseMarshalLong(wireFormat, " + getter + ", dataOut);");
+ }
+ else if (type.equals("String")) {
+ out.println(" LooseMarshalString(" + getter + ", dataOut);");
+ }
+ else if (type.equals("byte[]") || type.equals("ByteSequence")) {
+ if (size != null) {
+ out.println(" dataOut.Write(" + getter + ", 0, " + size.asInt() + ");");
+ }
+ else {
+ out.println(" dataOut.Write(" + getter + "!=null);");
+ out.println(" if(" + getter + "!=null) {");
+ out.println(" dataOut.Write(" + getter + ".Length);");
+ out.println(" dataOut.Write(" + getter + ");");
+ out.println(" }");
+ }
+ }
+ else if (propertyType.isArrayType()) {
+ if (size != null) {
+ out.println(" LooseMarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, " + size.asInt() + ");");
+ }
+ else {
+ out.println(" LooseMarshalObjectArray(wireFormat, " + getter + ", dataOut);");
+ }
+ }
+ else if (isThrowable(propertyType)) {
+ out.println(" LooseMarshalBrokerError(wireFormat, " + getter + ", dataOut);");
+ }
+ else {
+ if (isCachedProperty(property)) {
+ out.println(" LooseMarshalCachedObject(wireFormat, (DataStructure)" + getter + ", dataOut);");
+ }
+ else {
+ out.println(" LooseMarshalNestedObject(wireFormat, (DataStructure)" + getter + ", dataOut);");
+ }
+ }
+ }
+ }
+
}
Modified: incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy (original)
+++ incubator/activemq/trunk/activemq-core/src/gram/script/GenerateCSharpMarshalling.groovy Wed Mar 8 16:41:39 2006
@@ -76,6 +76,9 @@
}
"""
+/*
+ * Generate the tight encoding marshallers
+ */
out << """
//
// Un-marshal an object instance from the data input stream
@@ -102,8 +105,9 @@
out << """
}
+"""
-
+out << """
//
// Write the booleans that this object uses to a BooleanStream
//
@@ -144,6 +148,69 @@
out << """
}
+"""
+
+/*
+ * Generate the loose encoding marshallers
+ */
+out << """
+ //
+ // Un-marshal an object instance from the data input stream
+ //
+ public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
+ {
+ base.LooseUnmarshal(wireFormat, o, dataIn);
+"""
+
+if( !properties.isEmpty() || marshallerAware ) out << """
+ ${jclass.simpleName} info = (${jclass.simpleName})o;
+"""
+
+if( marshallerAware ) out << """
+ info.BeforeUnmarshall(wireFormat);
+
+"""
+
+generateLooseUnmarshalBody(out)
+
+if( marshallerAware ) out << """
+ info.AfterUnmarshall(wireFormat);
+"""
+
+out << """
+ }
+"""
+
+out << """
+ //
+ // Write a object instance to data output stream
+ //
+ public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut) {
+"""
+
+if( !properties.isEmpty() || marshallerAware ) out << """
+ ${jclass.simpleName} info = (${jclass.simpleName})o;
+"""
+
+if( marshallerAware ) out << """
+ info.BeforeMarshall(wireFormat);
+"""
+
+out << """
+ base.LooseMarshal(wireFormat, o, dataOut);
+"""
+
+generateLooseMarshalBody(out)
+
+if( marshallerAware ) out << """
+ info.AfterMarshall(wireFormat);
+"""
+out << """
+ }
+"""
+
+
+out << """
}
}
"""
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java Wed Mar 8 16:41:39 2006
@@ -29,7 +29,6 @@
import org.activeio.ByteSequence;
import org.activeio.command.WireFormat;
import org.apache.activemq.state.CommandVisitor;
-import org.apache.activemq.util.IntrospectionSupport;
import org.apache.activemq.util.MarshallingSupport;
/**
@@ -39,7 +38,8 @@
*/
public class WireFormatInfo implements Command, MarshallAware {
- public static final byte DATA_STRUCTURE_TYPE = CommandTypes.WIREFORMAT_INFO;
+ private static final int MAX_PROPERTY_SIZE = 1024*4;
+ public static final byte DATA_STRUCTURE_TYPE = CommandTypes.WIREFORMAT_INFO;
static final private byte MAGIC[] = new byte[] { 'A', 'c', 't', 'i', 'v', 'e', 'M', 'Q' };
protected byte magic[] = MAGIC;
@@ -136,7 +136,7 @@
}
private HashMap unmarsallProperties(ByteSequence marshalledProperties) throws IOException {
- return MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)));
+ return MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)), MAX_PROPERTY_SIZE);
}
public void beforeMarshall(WireFormat wireFormat) throws IOException {
@@ -171,50 +171,50 @@
* @throws IOException
*/
public boolean isCacheEnabled() throws IOException {
- return Boolean.TRUE == getProperty("cache");
+ return Boolean.TRUE == getProperty("CacheEnabled");
}
public void setCacheEnabled(boolean cacheEnabled) throws IOException {
- setProperty("cache", cacheEnabled ? Boolean.TRUE : Boolean.FALSE);
+ setProperty("CacheEnabled", cacheEnabled ? Boolean.TRUE : Boolean.FALSE);
}
/**
* @throws IOException
*/
public boolean isStackTraceEnabled() throws IOException {
- return Boolean.TRUE == getProperty("stackTrace");
+ return Boolean.TRUE == getProperty("StackTraceEnabled");
}
public void setStackTraceEnabled(boolean stackTraceEnabled) throws IOException {
- setProperty("stackTrace", stackTraceEnabled ? Boolean.TRUE : Boolean.FALSE);
+ setProperty("StackTraceEnabled", stackTraceEnabled ? Boolean.TRUE : Boolean.FALSE);
}
/**
* @throws IOException
*/
public boolean isTcpNoDelayEnabled() throws IOException {
- return Boolean.TRUE == getProperty("tcpNoDelay");
+ return Boolean.TRUE == getProperty("TcpNoDelayEnabled");
}
public void setTcpNoDelayEnabled(boolean tcpNoDelayEnabled) throws IOException {
- setProperty("tcpNoDelay", tcpNoDelayEnabled ? Boolean.TRUE : Boolean.FALSE);
+ setProperty("TcpNoDelayEnabled", tcpNoDelayEnabled ? Boolean.TRUE : Boolean.FALSE);
}
/**
* @throws IOException
*/
- public boolean isPrefixPacketSize() throws IOException {
- return Boolean.TRUE == getProperty("prefixPacketSize");
+ public boolean isSizePrefixDisabled() throws IOException {
+ return Boolean.TRUE == getProperty("SizePrefixDisabled");
}
- public void setPrefixPacketSize(boolean prefixPacketSize) throws IOException {
- setProperty("prefixPacketSize", prefixPacketSize ? Boolean.TRUE : Boolean.FALSE);
+ public void setSizePrefixDisabled(boolean prefixPacketSize) throws IOException {
+ setProperty("SizePrefixDisabled", prefixPacketSize ? Boolean.TRUE : Boolean.FALSE);
}
/**
* @throws IOException
*/
public boolean isTightEncodingEnabled() throws IOException {
- return Boolean.TRUE == getProperty("tightEncoding");
+ return Boolean.TRUE == getProperty("TightEncodingEnabled");
}
public void setTightEncodingEnabled(boolean tightEncodingEnabled) throws IOException {
- setProperty("tightEncoding", tightEncodingEnabled ? Boolean.TRUE : Boolean.FALSE);
+ setProperty("TightEncodingEnabled", tightEncodingEnabled ? Boolean.TRUE : Boolean.FALSE);
}
public Response visit(CommandVisitor visitor) throws Exception {
@@ -222,7 +222,12 @@
}
public String toString() {
- return IntrospectionSupport.toString(this, WireFormatInfo.class);
+ Map p=null;
+ try {
+ p = getProperties();
+ } catch (IOException e) {
+ }
+ return "WireFormatInfo { version="+version+", properties="+p+", magic="+Arrays.toString(magic)+"}";
}
///////////////////////////////////////////////////////////////
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java Wed Mar 8 16:41:39 2006
@@ -33,6 +33,8 @@
import org.apache.activemq.command.CommandTypes;
import org.apache.activemq.command.DataStructure;
import org.apache.activemq.command.MarshallAware;
+import org.apache.activemq.command.WireFormatInfo;
+import org.apache.activemq.util.IdGenerator;
/**
*
@@ -46,11 +48,11 @@
private DataStreamMarshaller dataMarshallers[];
private int version;
- private boolean stackTraceEnabled=true;
+ private boolean stackTraceEnabled=false;
private boolean tcpNoDelayEnabled=false;
- private boolean cacheEnabled=true;
- private boolean tightEncodingEnabled=true;
- private boolean prefixPacketSize=true;
+ private boolean cacheEnabled=false;
+ private boolean tightEncodingEnabled=false;
+ private boolean sizePrefixDisabled=false;
private HashMap marshallCacheMap = new HashMap();
private short nextMarshallCacheIndex=0;
@@ -58,22 +60,22 @@
private DataStructure marshallCache[] = new DataStructure[MARSHAL_CACHE_SIZE];
private DataStructure unmarshallCache[] = new DataStructure[MARSHAL_CACHE_SIZE];
-
- public OpenWireFormat() {
- this(true);
- }
-
- public OpenWireFormat(boolean cacheEnabled) {
- setVersion(1);
- setCacheEnabled(cacheEnabled);
- }
-
- public int hashCode() {
+ private WireFormatInfo preferedWireFormatInfo;
+
+ public OpenWireFormat() {
+ this(1);
+ }
+
+ public OpenWireFormat(int i) {
+ setVersion(i);
+ }
+
+ public int hashCode() {
return version
^ (cacheEnabled ? 0x10000000:0x20000000)
^ (stackTraceEnabled ? 0x01000000:0x02000000)
^ (tightEncodingEnabled ? 0x00100000:0x00200000)
- ^ (prefixPacketSize ? 0x00010000:0x00020000)
+ ^ (sizePrefixDisabled ? 0x00010000:0x00020000)
;
}
@@ -85,12 +87,15 @@
o.cacheEnabled == cacheEnabled &&
o.version == version &&
o.tightEncodingEnabled == tightEncodingEnabled &&
- o.prefixPacketSize == prefixPacketSize
+ o.sizePrefixDisabled == sizePrefixDisabled
;
}
+ static IdGenerator g = new IdGenerator();
+ String id = g.generateId();
public String toString() {
- return "OpenWireFormat{version="+version+", cacheEnabled="+cacheEnabled+", stackTraceEnabled="+stackTraceEnabled+", tightEncodingEnabled="+tightEncodingEnabled+", prefixPacketSize="+prefixPacketSize+"}";
+ //return "OpenWireFormat{version="+version+", cacheEnabled="+cacheEnabled+", stackTraceEnabled="+stackTraceEnabled+", tightEncodingEnabled="+tightEncodingEnabled+", sizePrefixDisabled="+sizePrefixDisabled+"}";
+ return "OpenWireFormat{id="+id+", tightEncodingEnabled="+tightEncodingEnabled+"}";
}
public int getVersion() {
@@ -133,7 +138,7 @@
ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
DataOutputStream ds = new DataOutputStream(baos);
- if( prefixPacketSize ) {
+ if( !sizePrefixDisabled ) {
ds.writeInt(size);
}
ds.writeByte(type);
@@ -144,9 +149,9 @@
} else {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream ds = new DataOutputStream(baos);
- if( prefixPacketSize ) {
+ if( !sizePrefixDisabled ) {
ds.writeInt(0); // we don't know the final size yet but write this here for now.
}
ds.writeByte(type);
@@ -154,7 +159,7 @@
ds.close();
sequence = baos.toByteSequence();
- if( prefixPacketSize ) {
+ if( !sizePrefixDisabled ) {
size = sequence.getLength()-4;
ByteArrayPacket packet = new ByteArrayPacket(sequence);
PacketData.writeIntBig(packet, size);
@@ -183,11 +188,11 @@
ByteSequence sequence = packet.asByteSequence();
DataInputStream dis = new DataInputStream(new PacketToInputStream(packet));
- if( prefixPacketSize ) {
+ if( !sizePrefixDisabled ) {
int size = dis.readInt();
- if( sequence.getLength()-4 != size )
- System.out.println("Packet size does not match marshaled size: "+size+", "+(sequence.getLength()-4));
+ if( sequence.getLength()-4 != size ) {
// throw new IOException("Packet size does not match marshaled size");
+ }
}
Object command = doUnmarshal(dis);
@@ -197,7 +202,7 @@
return command;
}
- public void marshal(Object o, DataOutputStream ds) throws IOException {
+ public void marshal(Object o, DataOutputStream dataOut) throws IOException {
if( cacheEnabled ) {
runMarshallCacheEvictionSweep();
@@ -205,28 +210,53 @@
int size=1;
if( o != null) {
+
DataStructure c = (DataStructure) o;
byte type = c.getDataStructureType();
DataStreamMarshaller dsm = (DataStreamMarshaller) dataMarshallers[type & 0xFF];
if( dsm == null )
throw new IOException("Unknown data type: "+type);
- BooleanStream bs = new BooleanStream();
- size += dsm.tightMarshal1(this, c, bs);
- size += bs.marshalledSize();
+ if( tightEncodingEnabled ) {
+ BooleanStream bs = new BooleanStream();
+ size += dsm.tightMarshal1(this, c, bs);
+ size += bs.marshalledSize();
+
+ dataOut.writeInt(size);
+ dataOut.writeByte(type);
+ bs.marshal(dataOut);
+ dsm.tightMarshal2(this, c, dataOut, bs);
+ } else {
+ DataOutputStream looseOut = dataOut;
+ ByteArrayOutputStream baos=null;
+
+ if( !sizePrefixDisabled ) {
+ baos = new ByteArrayOutputStream();
+ looseOut = new DataOutputStream(baos);
+ }
+
+ looseOut.writeByte(type);
+ dsm.looseMarshal(this, c, looseOut);
+
+ if( !sizePrefixDisabled ) {
+ looseOut.close();
+ ByteSequence sequence = baos.toByteSequence();
+ dataOut.writeInt(sequence.getLength()-4);
+ dataOut.write(sequence.getData(), sequence.getOffset(), sequence.getLength());
+ }
- ds.writeInt(size);
- ds.writeByte(type);
- bs.marshal(ds);
- dsm.tightMarshal2(this, c, ds, bs);
+ }
+
} else {
- ds.writeInt(size);
- ds.writeByte(NULL_TYPE);
+ dataOut.writeInt(size);
+ dataOut.writeByte(NULL_TYPE);
}
}
public Object unmarshal(DataInputStream dis) throws IOException {
- dis.readInt();
+ if( !sizePrefixDisabled ) {
+ dis.readInt();
+ }
return doUnmarshal(dis);
}
@@ -310,7 +340,10 @@
return null;
}
}
-
+// public void debug(String msg) {
+// String t = (Thread.currentThread().getName()+" ").substring(0, 40);
+// System.out.println(t+": "+msg);
+// }
public int tightMarshalNestedObject1(DataStructure o, BooleanStream bs) throws IOException {
bs.writeBoolean(o != null);
if( o == null )
@@ -496,12 +529,33 @@
this.tightEncodingEnabled = tightEncodingEnabled;
}
- public boolean isPrefixPacketSize() {
- return prefixPacketSize;
+ public boolean isSizePrefixDisabled() {
+ return sizePrefixDisabled;
}
- public void setPrefixPacketSize(boolean prefixPacketSize) {
- this.prefixPacketSize = prefixPacketSize;
+ public void setSizePrefixDisabled(boolean prefixPacketSize) {
+ this.sizePrefixDisabled = prefixPacketSize;
}
-
+
+ public void setPreferedWireFormatInfo(WireFormatInfo info) {
+ this.preferedWireFormatInfo = info;
+ }
+ public WireFormatInfo getPreferedWireFormatInfo() {
+ return preferedWireFormatInfo;
+ }
+
+ public void renegociatWireFormat(WireFormatInfo info) throws IOException {
+
+ if( preferedWireFormatInfo==null )
+ throw new IllegalStateException("Wireformat cannot not be renegociated.");
+
+ this.setVersion(Math.max(preferedWireFormatInfo.getVersion(), info.getVersion()) );
+ this.stackTraceEnabled = info.isStackTraceEnabled() && preferedWireFormatInfo.isStackTraceEnabled();
+ this.tcpNoDelayEnabled = info.isTcpNoDelayEnabled() && preferedWireFormatInfo.isTcpNoDelayEnabled();
+ this.cacheEnabled = info.isCacheEnabled() && preferedWireFormatInfo.isCacheEnabled();
+ this.tightEncodingEnabled = info.isTightEncodingEnabled() && preferedWireFormatInfo.isTightEncodingEnabled();
+ this.sizePrefixDisabled = info.isSizePrefixDisabled() && preferedWireFormatInfo.isSizePrefixDisabled();
+
+ }
+
}
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java Wed Mar 8 16:41:39 2006
@@ -18,28 +18,41 @@
import org.activeio.command.WireFormat;
import org.activeio.command.WireFormatFactory;
+import org.apache.activemq.command.WireFormatInfo;
/**
* @version $Revision$
*/
public class OpenWireFormatFactory implements WireFormatFactory {
+ //
+ // The default values here are what the wireformat chanages to after a default negociation.
+ //
+
private int version=1;
private boolean stackTraceEnabled=true;
- private boolean tcpNoDelayEnabled=false;
+ private boolean tcpNoDelayEnabled=true;
private boolean cacheEnabled=true;
private boolean tightEncodingEnabled=true;
- private boolean prefixPacketSize=true;
+ private boolean sizePrefixDisabled=false;
public WireFormat createWireFormat() {
- OpenWireFormat format = new OpenWireFormat();
- format.setVersion(version);
- format.setStackTraceEnabled(stackTraceEnabled);
- format.setCacheEnabled(cacheEnabled);
- format.setTcpNoDelayEnabled(tcpNoDelayEnabled);
- format.setTightEncodingEnabled(tightEncodingEnabled);
- format.setPrefixPacketSize(prefixPacketSize);
- return format;
+ WireFormatInfo info = new WireFormatInfo();
+ info.setVersion(version);
+
+ try {
+ info.setStackTraceEnabled(stackTraceEnabled);
+ info.setCacheEnabled(cacheEnabled);
+ info.setTcpNoDelayEnabled(tcpNoDelayEnabled);
+ info.setTightEncodingEnabled(tightEncodingEnabled);
+ info.setSizePrefixDisabled(sizePrefixDisabled);
+ } catch (Exception e) {
+ throw new IllegalStateException("Could not configure WireFormatInfo", e);
+ }
+
+ OpenWireFormat f = new OpenWireFormat();
+ f.setPreferedWireFormatInfo(info);
+ return f;
}
public boolean isStackTraceEnabled() {
@@ -82,11 +95,11 @@
this.tightEncodingEnabled = tightEncodingEnabled;
}
- public boolean isPrefixPacketSize() {
- return prefixPacketSize;
- }
-
- public void setPrefixPacketSize(boolean prefixPacketSize) {
- this.prefixPacketSize = prefixPacketSize;
- }
+ public boolean isSizePrefixDisabled() {
+ return sizePrefixDisabled;
+ }
+
+ public void setSizePrefixDisabled(boolean sizePrefixDisabled) {
+ this.sizePrefixDisabled = sizePrefixDisabled;
+ }
}
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterMarshaller.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterMarshaller.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterMarshaller.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/NetworkBridgeFilterMarshaller.java Wed Mar 8 16:41:39 2006
@@ -1 +1,132 @@
-/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
* 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.
*/
package org.apache.activemq.openwire.v1;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.activemq.openwire.*;
import org.apache.activemq.command.*;
/**
* Marshalling code for Open Wire Format for NetworkBridgeFilterMarshaller
*
*
* NOTE!: This file is auto generated - do not modify!
* if
you need to make a change, please see the modify the groovy scripts in the
* under src/gram/script and then use maven openwire:generate to regenerate
* this file.
*
* @version $Revision$
*/
public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
*/
public byte getDataStructureType() {
return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
}
/**
* @return a new object instance
*/
public DataStructure createObject() {
return new NetworkBridgeFilter();
}
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn, Bo
oleanStream bs) throws IOException {
super.tightUnmarshal(wireFormat, o, dataIn, bs);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId((org.apache.activemq.command.BrokerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getNetworkBrokerId(), bs);
return rc + 4;
}
/**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stream
* @throws IOException thrown if an error occurs
*/
pub
lic void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut, BooleanStream bs) throws IOException {
super.tightMarshal2(wireFormat, o, dataOut, bs);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
dataOut.writeInt(info.getNetworkTTL());
tightMarshalCachedObject2(wireFormat, (DataStructure)info.getNetworkBrokerId(), dataOut, bs);
}
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn) throws IOException {
super.looseUnmarshal(wireFormat, o, dataIn);
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
info.setNetworkTTL(dataIn.readInt());
info.setNetworkBrokerId((org.apache.activemq.command.BrokerId) looseUnmarsalCachedObje
ct(wireFormat, dataIn));
}
/**
* Write the booleans that this object uses to a BooleanStream
*/
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut) throws IOException {
NetworkBridgeFilter info = (NetworkBridgeFilter)o;
super.looseMarshal(wireFormat, o, dataOut);
dataOut.writeInt(info.getNetworkTTL());
looseMarshalCachedObject(wireFormat, (DataStructure)info.getNetworkBrokerId(), dataOut);
}
}
\ No newline at end of file
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * 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.
+ */
+
+package org.apache.activemq.openwire.v1;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.activemq.openwire.*;
+import org.apache.activemq.command.*;
+
+
+
+/**
+ * Marshalling code for Open Wire Format for NetworkBridgeFilterMarshaller
+ *
+ *
+ * NOTE!: This file is auto generated - do not modify!
+ * if you need to make a change, please see the modify the groovy scripts in the
+ * under src/gram/script and then use maven openwire:generate to regenerate
+ * this file.
+ *
+ * @version $Revision$
+ */
+public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller {
+
+ /**
+ * Return the type of Data Structure we marshal
+ * @return short representation of the type data structure
+ */
+ public byte getDataStructureType() {
+ return NetworkBridgeFilter.DATA_STRUCTURE_TYPE;
+ }
+
+ /**
+ * @return a new object instance
+ */
+ public DataStructure createObject() {
+ return new NetworkBridgeFilter();
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o the object to un-marshal
+ * @param dataIn the data input stream to build the object from
+ * @throws IOException
+ */
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn, BooleanStream bs) throws IOException {
+ super.tightUnmarshal(wireFormat, o, dataIn, bs);
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter)o;
+ info.setNetworkTTL(dataIn.readInt());
+ info.setNetworkBrokerId((org.apache.activemq.command.BrokerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
+
+ }
+
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter)o;
+
+ int rc = super.tightMarshal1(wireFormat, o, bs);
+ rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getNetworkBrokerId(), bs);
+
+ return rc + 4;
+ }
+
+ /**
+ * Write a object instance to data output stream
+ *
+ * @param o the instance to be marshaled
+ * @param dataOut the output stream
+ * @throws IOException thrown if an error occurs
+ */
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut, BooleanStream bs) throws IOException {
+ super.tightMarshal2(wireFormat, o, dataOut, bs);
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter)o;
+ dataOut.writeInt(info.getNetworkTTL());
+ tightMarshalCachedObject2(wireFormat, (DataStructure)info.getNetworkBrokerId(), dataOut, bs);
+
+ }
+
+ /**
+ * Un-marshal an object instance from the data input stream
+ *
+ * @param o the object to un-marshal
+ * @param dataIn the data input stream to build the object from
+ * @throws IOException
+ */
+ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInputStream dataIn) throws IOException {
+ super.looseUnmarshal(wireFormat, o, dataIn);
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter)o;
+ info.setNetworkTTL(dataIn.readInt());
+ info.setNetworkBrokerId((org.apache.activemq.command.BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn));
+
+ }
+
+
+ /**
+ * Write the booleans that this object uses to a BooleanStream
+ */
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutputStream dataOut) throws IOException {
+
+ NetworkBridgeFilter info = (NetworkBridgeFilter)o;
+
+ super.looseMarshal(wireFormat, o, dataOut);
+ dataOut.writeInt(info.getNetworkTTL());
+ looseMarshalCachedObject(wireFormat, (DataStructure)info.getNetworkBrokerId(), dataOut);
+
+ }
+}
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java Wed Mar 8 16:41:39 2006
@@ -61,7 +61,7 @@
private static final Log log = LogFactory.getLog(JDBCPersistenceAdapter.class);
private static FactoryFinder factoryFinder = new FactoryFinder("META-INF/services/org/apache/activemq/store/jdbc/");
- private WireFormat wireFormat = new OpenWireFormat(false);
+ private WireFormat wireFormat = new OpenWireFormat();
private DataSource dataSource;
private Statements statements;
private JDBCAdapter adapter;
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/JournalPersistenceAdapter.java Wed Mar 8 16:41:39 2006
@@ -82,7 +82,7 @@
private final PersistenceAdapter longTermPersistence;
final UsageManager usageManager;
- private final WireFormat wireFormat = new OpenWireFormat(false);
+ private final WireFormat wireFormat = new OpenWireFormat();
private final ConcurrentHashMap queues = new ConcurrentHashMap();
private final ConcurrentHashMap topics = new ConcurrentHashMap();
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/QuickJournalPersistenceAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/QuickJournalPersistenceAdapter.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/QuickJournalPersistenceAdapter.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/journal/QuickJournalPersistenceAdapter.java Wed Mar 8 16:41:39 2006
@@ -82,7 +82,7 @@
private final PersistenceAdapter longTermPersistence;
final UsageManager usageManager;
- private final WireFormat wireFormat = new OpenWireFormat(false);
+ private final WireFormat wireFormat = new OpenWireFormat();
private final ConcurrentHashMap queues = new ConcurrentHashMap();
private final ConcurrentHashMap topics = new ConcurrentHashMap();
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/InactivityMonitor.java Wed Mar 8 16:41:39 2006
@@ -64,6 +64,7 @@
case 0:
writeCheck();
readCheckIteration++;
+ break;
case 1:
readCheck();
writeCheck();
@@ -100,10 +101,10 @@
}
if( !commandReceived.get() ) {
- log.debug("No message received since last read check!");
+ log.debug("No message received since last read check! ");
onException(new InactivityIOException("Channel was inactive for too long."));
} else {
- log.debug("Message received since last read check, resetting flag");
+ log.debug("Message received since last read check, resetting flag: ");
}
commandReceived.set(false);
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java Wed Mar 8 16:41:39 2006
@@ -19,7 +19,6 @@
import java.io.IOException;
import java.io.InterruptedIOException;
-import org.activeio.command.WireFormat;
import org.apache.activemq.command.Command;
import org.apache.activemq.command.WireFormatInfo;
import org.apache.activemq.openwire.OpenWireFormat;
@@ -27,17 +26,19 @@
import org.apache.commons.logging.LogFactory;
import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
public class WireFormatNegotiator extends TransportFilter {
private static final Log log = LogFactory.getLog(WireFormatNegotiator.class);
- private final WireFormat wireFormat;
+ private OpenWireFormat wireFormat;
private final int minimumVersion;
- private boolean firstStart=true;
- private CountDownLatch readyCountDownLatch = new CountDownLatch(1);
+ private final AtomicBoolean firstStart=new AtomicBoolean(true);
+ private final CountDownLatch readyCountDownLatch = new CountDownLatch(1);
+ private final CountDownLatch wireInfoSentDownLatch = new CountDownLatch(1);
/**
* Negotiator
@@ -45,7 +46,7 @@
* @param next
* @param preferedFormat
*/
- public WireFormatNegotiator(Transport next, WireFormat wireFormat, int minimumVersion) {
+ public WireFormatNegotiator(Transport next, OpenWireFormat wireFormat, int minimumVersion) {
super(next);
this.wireFormat = wireFormat;
this.minimumVersion = minimumVersion;
@@ -54,9 +55,13 @@
public void start() throws Exception {
super.start();
- if( firstStart ) {
- WireFormatInfo info = createWireFormatInfo();
- next.oneway(info);
+ if( firstStart.compareAndSet(true, false) ) {
+ try {
+ WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
+ next.oneway(info);
+ } finally {
+ wireInfoSentDownLatch.countDown();
+ }
}
}
@@ -69,18 +74,6 @@
super.oneway(command);
}
- protected WireFormatInfo createWireFormatInfo() throws IOException {
- WireFormatInfo info = new WireFormatInfo();
- info.setVersion(wireFormat.getVersion());
- if ( wireFormat instanceof OpenWireFormat ) {
- info.setStackTraceEnabled(((OpenWireFormat)wireFormat).isStackTraceEnabled());
- info.setTcpNoDelayEnabled(((OpenWireFormat)wireFormat).isTcpNoDelayEnabled());
- info.setCacheEnabled(((OpenWireFormat)wireFormat).isCacheEnabled());
- info.setPrefixPacketSize(((OpenWireFormat)wireFormat).isPrefixPacketSize());
- info.setTightEncodingEnabled(((OpenWireFormat)wireFormat).isTightEncodingEnabled());
- }
- return info;
- }
public void onCommand(Command command) {
if( command.isWireFormatInfo() ) {
@@ -89,40 +82,31 @@
log.debug("Received WireFormat: " + info);
}
- if( !info.isValid() ) {
- getTransportListener().onException(new IOException("Remote wire format magic is invalid"));
- } else if( info.getVersion() < minimumVersion ) {
- getTransportListener().onException(new IOException("Remote wire format ("+info.getVersion()+") is lower the minimum version required ("+minimumVersion+")"));
- } else if ( info.getVersion()!=wireFormat.getVersion() ) {
- // Match the remote side.
- wireFormat.setVersion(info.getVersion());
- }
- if ( wireFormat instanceof OpenWireFormat ) {
- try {
- if( !info.isStackTraceEnabled() ) {
- ((OpenWireFormat)wireFormat).setStackTraceEnabled(false);
- }
- if( info.isTcpNoDelayEnabled() ) {
- ((OpenWireFormat)wireFormat).setTcpNoDelayEnabled(true);
- }
- if( !info.isCacheEnabled() ) {
- ((OpenWireFormat)wireFormat).setCacheEnabled(false);
- }
- if( !info.isPrefixPacketSize() ) {
- ((OpenWireFormat)wireFormat).setPrefixPacketSize(false);
- }
- if( !info.isTightEncodingEnabled() ) {
- ((OpenWireFormat)wireFormat).setTightEncodingEnabled(false);
- }
- } catch (IOException e) {
- getTransportListener().onException(e);
+ try {
+ wireInfoSentDownLatch.await();
+
+ if( !info.isValid() ) {
+ onException(new IOException("Remote wire format magic is invalid"));
+ } else if( info.getVersion() < minimumVersion ) {
+ onException(new IOException("Remote wire format ("+info.getVersion()+") is lower the minimum version required ("+minimumVersion+")"));
}
- }
+ wireFormat.renegociatWireFormat(info);
+
+ } catch (IOException e) {
+ onException(e);
+ } catch (InterruptedException e) {
+ onException((IOException) new InterruptedIOException().initCause(e));
+ }
readyCountDownLatch.countDown();
}
getTransportListener().onCommand(command);
+ }
+
+ public void onException(IOException error) {
+ readyCountDownLatch.countDown();
+ super.onException(error);
}
public String toString() {
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportFactory.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportFactory.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportFactory.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportFactory.java Wed Mar 8 16:41:39 2006
@@ -29,6 +29,7 @@
import org.activeio.command.AsyncChannelToAsyncCommandChannel;
import org.activeio.command.WireFormat;
import org.activeio.net.SocketMetadata;
+import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.activemq.transport.InactivityMonitor;
import org.apache.activemq.transport.MutexTransport;
import org.apache.activemq.transport.ResponseCorrelator;
@@ -229,7 +230,10 @@
if( activeIOTransport.isTrace() ) {
transport = new TransportLogger(transport);
}
- transport = new WireFormatNegotiator(transport,format, activeIOTransport.getMinmumWireFormatVersion());
+ if( format instanceof OpenWireFormat ) {
+ transport = new WireFormatNegotiator(transport, (OpenWireFormat) format, activeIOTransport.getMinmumWireFormatVersion());
+ }
+
transport = new InactivityMonitor(transport, activeIOTransport.getMaxInactivityDuration());
transport = new MutexTransport(transport);
transport = new ResponseCorrelator(transport);
@@ -275,7 +279,9 @@
if( activeIOTransport.isTrace() ) {
transport = new TransportLogger(transport);
}
- transport = new WireFormatNegotiator(transport,format, activeIOTransport.getMinmumWireFormatVersion());
+ if( format instanceof OpenWireFormat ) {
+ transport = new WireFormatNegotiator(transport, (OpenWireFormat) format, activeIOTransport.getMinmumWireFormatVersion());
+ }
transport = new InactivityMonitor(transport, activeIOTransport.getMaxInactivityDuration());
return transport;
}
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java Wed Mar 8 16:41:39 2006
@@ -64,8 +64,10 @@
transport = new TransportLogger(transport);
}
- if( format instanceof OpenWireFormat )
- transport = new WireFormatNegotiator(transport, format, tcpTransport.getMinmumWireFormatVersion());
+ // Only need the OpenWireFormat if using openwire
+ if( format instanceof OpenWireFormat ) {
+ transport = new WireFormatNegotiator(transport, (OpenWireFormat)format, tcpTransport.getMinmumWireFormatVersion());
+ }
if( tcpTransport.getMaxInactivityDuration() > 0 ) {
transport = new InactivityMonitor(transport, tcpTransport.getMaxInactivityDuration());
@@ -83,7 +85,11 @@
transport = new TransportLogger(transport);
}
- transport = new WireFormatNegotiator(transport, format, tcpTransport.getMinmumWireFormatVersion());
+ // Only need the OpenWireFormat if using openwire
+ if( format instanceof OpenWireFormat ) {
+ transport = new WireFormatNegotiator(transport, (OpenWireFormat)format, tcpTransport.getMinmumWireFormatVersion());
+ }
+
if( tcpTransport.getMaxInactivityDuration() > 0 ) {
transport = new InactivityMonitor(transport, tcpTransport.getMaxInactivityDuration());
}
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java Wed Mar 8 16:41:39 2006
@@ -83,7 +83,7 @@
protected Transport createTransport(URI location, WireFormat wf) throws UnknownHostException, IOException {
OpenWireFormat wireFormat = (OpenWireFormat) wf;
- wireFormat.setPrefixPacketSize(false);
+ wireFormat.setSizePrefixDisabled(true);
return new UdpTransport(wireFormat, location);
}
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java Wed Mar 8 16:41:39 2006
@@ -61,13 +61,21 @@
}
}
+ static public HashMap unmarshalPrimitiveMap(DataInputStream in) throws IOException {
+ return unmarshalPrimitiveMap(in, Integer.MAX_VALUE);
+ }
+
/**
* @param in
* @return
+ * @throws IOException
* @throws IOException
*/
- static public HashMap unmarshalPrimitiveMap(DataInputStream in) throws IOException {
+ public static HashMap unmarshalPrimitiveMap(DataInputStream in, int max_property_size) throws IOException {
int size = in.readInt();
+ if( size > max_property_size ) {
+ throw new IOException("Primitive map is larger than the allowed size: "+size);
+ }
if( size < 0 ) {
return null;
} else {
@@ -265,5 +273,6 @@
return null;
}
}
+
}
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/MarshallingBrokerTest.java Wed Mar 8 16:41:39 2006
@@ -35,9 +35,15 @@
public WireFormat wireFormat = new OpenWireFormat();
public void initCombos() {
+
+ OpenWireFormat wf1 = new OpenWireFormat();
+ wf1.setCacheEnabled(false);
+ OpenWireFormat wf2 = new OpenWireFormat();
+ wf2.setCacheEnabled(true);
+
addCombinationValues( "wireFormat", new Object[]{
- new OpenWireFormat(true),
- new OpenWireFormat(false),
+ wf1,
+ wf2,
});
}
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java Wed Mar 8 16:41:39 2006
@@ -22,6 +22,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
@@ -153,5 +154,5 @@
}
}
- abstract protected Object createObject();
+ abstract protected Object createObject() throws IOException;
}
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/WireFormatInfoData.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/WireFormatInfoData.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/WireFormatInfoData.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/WireFormatInfoData.java Wed Mar 8 16:41:39 2006
@@ -16,13 +16,16 @@
*/
package org.apache.activemq.openwire;
+import java.io.IOException;
+
import org.apache.activemq.command.WireFormatInfo;
public class WireFormatInfoData extends DataFileGenerator {
- protected Object createObject() {
+ protected Object createObject() throws IOException {
WireFormatInfo rc = new WireFormatInfo();
rc.setResponseRequired(false);
+ rc.setCacheEnabled(true);
rc.setVersion(1);
return rc;
}
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java Wed Mar 8 16:41:39 2006
@@ -33,7 +33,7 @@
* under src/gram/script and then use maven openwire:generate to regenerate
* this file.
*
- * @version $Revision: $
+ * @version $Revision$
*/
public class ActiveMQBytesMessageTest extends ActiveMQMessageTest {
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQDestinationTestSupport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQDestinationTestSupport.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQDestinationTestSupport.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQDestinationTestSupport.java Wed Mar 8 16:41:39 2006
@@ -33,7 +33,7 @@
* under src/gram/script and then use maven openwire:generate to regenerate
* this file.
*
- * @version $Revision: $
+ * @version $Revision$
*/
public abstract class ActiveMQDestinationTestSupport extends DataFileGeneratorTestSupport {
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java Wed Mar 8 16:41:39 2006
@@ -33,7 +33,7 @@
* under src/gram/script and then use maven openwire:generate to regenerate
* this file.
*
- * @version $Revision: $
+ * @version $Revision$
*/
public class ActiveMQMapMessageTest extends ActiveMQMessageTest {
Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java?rev=384390&r1=384389&r2=384390&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java (original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java Wed Mar 8 16:41:39 2006
@@ -33,7 +33,7 @@
* under src/gram/script and then use maven openwire:generate to regenerate
* this file.
*
- * @version $Revision: $
+ * @version $Revision$
*/
public class ActiveMQMessageTest extends MessageTestSupport {