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 2012/02/18 15:48:59 UTC
svn commit: r1245931 - in
/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire:
OpenwireProtocolHandler.scala dto/OpenwireDTO.java
Author: chirino
Date: Sat Feb 18 14:48:59 2012
New Revision: 1245931
URL: http://svn.apache.org/viewvc?rev=1245931&view=rev
Log:
Support better openwire protocol config options.
Modified:
activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolHandler.scala
activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/dto/OpenwireDTO.java
Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolHandler.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolHandler.scala?rev=1245931&r1=1245930&r2=1245931&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolHandler.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolHandler.scala Sat Feb 18 14:48:59 2012
@@ -50,17 +50,16 @@ object OpenwireProtocolHandler extends L
val DEFAULT_DIE_DELAY = 5 * 1000L
var die_delay = DEFAULT_DIE_DELAY
- val preferred_wireformat_settings = new WireFormatInfo();
- preferred_wireformat_settings.setVersion(OpenWireFormat.DEFAULT_VERSION);
- preferred_wireformat_settings.setStackTraceEnabled(true);
- preferred_wireformat_settings.setCacheEnabled(false);
- preferred_wireformat_settings.setTcpNoDelayEnabled(true);
- preferred_wireformat_settings.setTightEncodingEnabled(true);
- preferred_wireformat_settings.setSizePrefixDisabled(false);
- preferred_wireformat_settings.setMaxInactivityDuration(30 * 1000 * 1000);
- preferred_wireformat_settings.setMaxInactivityDurationInitalDelay(10 * 1000 * 1000);
- preferred_wireformat_settings.setCacheSize(1024);
- preferred_wireformat_settings.setMaxFrameSize(OpenWireFormat.DEFAULT_MAX_FRAME_SIZE);
+ val DEFAULT_WIREFORMAT_SETTINGS = new WireFormatInfo();
+ DEFAULT_WIREFORMAT_SETTINGS.setVersion(OpenWireFormat.DEFAULT_VERSION);
+ DEFAULT_WIREFORMAT_SETTINGS.setStackTraceEnabled(true);
+ DEFAULT_WIREFORMAT_SETTINGS.setCacheEnabled(true);
+ DEFAULT_WIREFORMAT_SETTINGS.setTightEncodingEnabled(true);
+ DEFAULT_WIREFORMAT_SETTINGS.setSizePrefixDisabled(false);
+ DEFAULT_WIREFORMAT_SETTINGS.setMaxInactivityDuration(30 * 1000 * 1000);
+ DEFAULT_WIREFORMAT_SETTINGS.setMaxInactivityDurationInitalDelay(10 * 1000 * 1000);
+ DEFAULT_WIREFORMAT_SETTINGS.setCacheSize(1024);
+ DEFAULT_WIREFORMAT_SETTINGS.setMaxFrameSize(OpenWireFormat.DEFAULT_MAX_FRAME_SIZE);
val WAITING_ON_CLIENT_REQUEST = ()=> "client request"
}
@@ -121,6 +120,7 @@ class OpenwireProtocolHandler extends Pr
var messages_sent = 0L
var messages_received = 0L
+ val preferred_wireformat_settings = new WireFormatInfo();
override def create_connection_status = {
var rc = new OpenwireConnectionStatusDTO
@@ -142,25 +142,21 @@ class OpenwireProtocolHandler extends Pr
config = connector_config.protocols.find( _.isInstanceOf[OpenwireDTO]).map(_.asInstanceOf[OpenwireDTO]).getOrElse(new OpenwireDTO)
// protocol_filters = ProtocolFilter.create_filters(config.protocol_filters.toList, this)
-//
- // config.max_data_length.foreach( codec.max_data_length = _ )
-// config.max_header_length.foreach( codec.max_header_length = _ )
-// config.max_headers.foreach( codec.max_headers = _ )
-
- if( config.destination_separator!=null ||
- config.path_separator!= null ||
- config.any_child_wildcard != null ||
- config.any_descendant_wildcard!= null ) {
-
-// destination_parser = new DestinationParser().copy(Stomp.destination_parser)
-// if( config.destination_separator!=null ) { destination_parser.destination_separator = config.destination_separator }
-// if( config.path_separator!=null ) { destination_parser.path_separator = config.path_separator }
-// if( config.any_child_wildcard!=null ) { destination_parser.any_child_wildcard = config.any_child_wildcard }
-// if( config.any_descendant_wildcard!=null ) { destination_parser.any_descendant_wildcard = config.any_descendant_wildcard }
- }
+ import OptionSupport._
+ preferred_wireformat_settings.setSizePrefixDisabled(false)
+ preferred_wireformat_settings.setCacheEnabled(config.cache_enabled.getOrElse(DEFAULT_WIREFORMAT_SETTINGS.isCacheEnabled))
+ preferred_wireformat_settings.setVersion(config.version.getOrElse(DEFAULT_WIREFORMAT_SETTINGS.getVersion))
+ preferred_wireformat_settings.setStackTraceEnabled(config.stack_trace_enabled.getOrElse(DEFAULT_WIREFORMAT_SETTINGS.isStackTraceEnabled))
+ preferred_wireformat_settings.setCacheEnabled(config.cache_enabled.getOrElse(DEFAULT_WIREFORMAT_SETTINGS.isCacheEnabled))
+ preferred_wireformat_settings.setTightEncodingEnabled(config.tight_encoding_enabled.getOrElse(DEFAULT_WIREFORMAT_SETTINGS.isTightEncodingEnabled))
+ preferred_wireformat_settings.setMaxInactivityDuration(config.max_inactivity_duration.getOrElse(DEFAULT_WIREFORMAT_SETTINGS.getMaxInactivityDuration))
+ preferred_wireformat_settings.setMaxInactivityDurationInitalDelay(config.max_inactivity_duration_initial_delay.getOrElse(DEFAULT_WIREFORMAT_SETTINGS.getMaxInactivityDurationInitalDelay))
+ preferred_wireformat_settings.setCacheSize(config.cache_size.getOrElse(DEFAULT_WIREFORMAT_SETTINGS.getCacheSize))
+ preferred_wireformat_settings.setMaxFrameSize(config.max_frame_size.getOrElse(DEFAULT_WIREFORMAT_SETTINGS.getMaxFrameSize))
}
+
def suspend_read(reason: => String) = {
waiting_on = reason _
connection.transport.suspendRead
Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/dto/OpenwireDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/dto/OpenwireDTO.java?rev=1245931&r1=1245930&r2=1245931&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/dto/OpenwireDTO.java (original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/dto/OpenwireDTO.java Sat Feb 18 14:48:59 2012
@@ -21,7 +21,7 @@ import org.apache.activemq.apollo.dto.Pr
import javax.xml.bind.annotation.*;
/**
- * Allow you to customize the openwire protocol implementation.
+ * AllowS you to customize the openwire protocol implementation.
*/
@XmlRootElement(name="openwire")
@XmlAccessorType(XmlAccessType.FIELD)
@@ -30,46 +30,67 @@ public class OpenwireDTO extends Protoco
@XmlAttribute(name="max_data_length")
public String max_data_length;
- @XmlAttribute(name="destination_separator")
- public String destination_separator;
-
- @XmlAttribute(name="path_separator")
- public String path_separator;
-
- @XmlAttribute(name="any_child_wildcard")
- public String any_child_wildcard;
-
- @XmlAttribute(name="any_descendant_wildcard")
- public String any_descendant_wildcard;
+ public Integer version;
+ @XmlAttribute(name="stack_trace_enabled")
+ public Boolean stack_trace_enabled;
+ @XmlAttribute(name="cache_enabled")
+ public Boolean cache_enabled;
+ @XmlAttribute(name="cache_size")
+ public Integer cache_size;
+ @XmlAttribute(name="tight_encoding_enabled")
+ public Boolean tight_encoding_enabled;
+ @XmlAttribute(name="size_prefix_disabled")
+ public Boolean size_prefix_disabled;
+ @XmlAttribute(name="max_inactivity_duration")
+ public Long max_inactivity_duration;
+ @XmlAttribute(name="max_inactivity_duration_initial_delay")
+ public Long max_inactivity_duration_initial_delay;
+ @XmlAttribute(name="max_frame_size")
+ public Long max_frame_size;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof OpenwireDTO)) return false;
+ if (!super.equals(o)) return false;
- OpenwireDTO openwireDTO = (OpenwireDTO) o;
+ OpenwireDTO that = (OpenwireDTO) o;
- if (any_child_wildcard != null ? !any_child_wildcard.equals(openwireDTO.any_child_wildcard) : openwireDTO.any_child_wildcard != null)
+ if (cache_enabled != null ? !cache_enabled.equals(that.cache_enabled) : that.cache_enabled != null)
+ return false;
+ if (cache_size != null ? !cache_size.equals(that.cache_size) : that.cache_size != null) return false;
+ if (max_data_length != null ? !max_data_length.equals(that.max_data_length) : that.max_data_length != null)
+ return false;
+ if (max_frame_size != null ? !max_frame_size.equals(that.max_frame_size) : that.max_frame_size != null)
+ return false;
+ if (max_inactivity_duration != null ? !max_inactivity_duration.equals(that.max_inactivity_duration) : that.max_inactivity_duration != null)
return false;
- if (any_descendant_wildcard != null ? !any_descendant_wildcard.equals(openwireDTO.any_descendant_wildcard) : openwireDTO.any_descendant_wildcard != null)
+ if (max_inactivity_duration_initial_delay != null ? !max_inactivity_duration_initial_delay.equals(that.max_inactivity_duration_initial_delay) : that.max_inactivity_duration_initial_delay != null)
return false;
- if (destination_separator != null ? !destination_separator.equals(openwireDTO.destination_separator) : openwireDTO.destination_separator != null)
+ if (size_prefix_disabled != null ? !size_prefix_disabled.equals(that.size_prefix_disabled) : that.size_prefix_disabled != null)
return false;
- if (max_data_length != null ? !max_data_length.equals(openwireDTO.max_data_length) : openwireDTO.max_data_length != null)
+ if (stack_trace_enabled != null ? !stack_trace_enabled.equals(that.stack_trace_enabled) : that.stack_trace_enabled != null)
return false;
- if (path_separator != null ? !path_separator.equals(openwireDTO.path_separator) : openwireDTO.path_separator != null)
+ if (tight_encoding_enabled != null ? !tight_encoding_enabled.equals(that.tight_encoding_enabled) : that.tight_encoding_enabled != null)
return false;
+ if (version != null ? !version.equals(that.version) : that.version != null) return false;
return true;
}
@Override
public int hashCode() {
- int result = (max_data_length != null ? max_data_length.hashCode() : 0);
- result = 31 * result + (destination_separator != null ? destination_separator.hashCode() : 0);
- result = 31 * result + (path_separator != null ? path_separator.hashCode() : 0);
- result = 31 * result + (any_child_wildcard != null ? any_child_wildcard.hashCode() : 0);
- result = 31 * result + (any_descendant_wildcard != null ? any_descendant_wildcard.hashCode() : 0);
+ int result = super.hashCode();
+ result = 31 * result + (max_data_length != null ? max_data_length.hashCode() : 0);
+ result = 31 * result + (version != null ? version.hashCode() : 0);
+ result = 31 * result + (stack_trace_enabled != null ? stack_trace_enabled.hashCode() : 0);
+ result = 31 * result + (cache_enabled != null ? cache_enabled.hashCode() : 0);
+ result = 31 * result + (cache_size != null ? cache_size.hashCode() : 0);
+ result = 31 * result + (tight_encoding_enabled != null ? tight_encoding_enabled.hashCode() : 0);
+ result = 31 * result + (size_prefix_disabled != null ? size_prefix_disabled.hashCode() : 0);
+ result = 31 * result + (max_inactivity_duration != null ? max_inactivity_duration.hashCode() : 0);
+ result = 31 * result + (max_inactivity_duration_initial_delay != null ? max_inactivity_duration_initial_delay.hashCode() : 0);
+ result = 31 * result + (max_frame_size != null ? max_frame_size.hashCode() : 0);
return result;
}
}