@Override public CoreMessage putStringProperty(final SimpleString key, final SimpleString value) { messageChanged(); checkProperties(); properties.putSimpleStringProperty(key, value); return this; }
@Override public JMSProducer setProperty(String name, String value) { checkName(name); SimpleString key = new SimpleString(name); properties.putSimpleStringProperty(key, new SimpleString(value)); stringPropertyNames.add(key); return this; }
@Override public void setString(final String name, final String value) throws JMSException { checkName(name); map.putSimpleStringProperty(new SimpleString(name), value == null ? null : new SimpleString(value)); invalid = true; }
@Override public CoreMessage putStringProperty(final SimpleString key, final String value) { messageChanged(); checkProperties(); properties.putSimpleStringProperty(key, SimpleString.toSimpleString(value, getPropertyValuesPool())); return this; }
@Override public synchronized void start() throws Exception { if (started) { return; } endpoint.openClient(); started = true; thread = new Thread(new DiscoveryRunnable(), "activemq-discovery-group-thread-" + name); thread.setDaemon(true); thread.start(); if (notificationService != null) { TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name)); Notification notification = new Notification(nodeID, CoreNotificationType.DISCOVERY_GROUP_STARTED, props); notificationService.sendNotification(notification); } }
@Override public CoreMessage putStringProperty(final String key, final String value) { messageChanged(); checkProperties(); properties.putSimpleStringProperty(SimpleString.toSimpleString(key, getPropertyKeysPool()), SimpleString.toSimpleString(value, getPropertyValuesPool())); return this; }
props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name)); Notification notification = new Notification(nodeID, CoreNotificationType.DISCOVERY_GROUP_STOPPED, props); try {
properties.putDoubleProperty(key, (Double) value); } else if (value instanceof String) { properties.putSimpleStringProperty(key, new SimpleString((String) value)); } else if (value instanceof SimpleString) { properties.putSimpleStringProperty(key, (SimpleString) value); } else if (value instanceof byte[]) { properties.putBytesProperty(key, (byte[]) value);
private Notification createProposalNotification(SimpleString groupId, SimpleString clusterName) { TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, groupId); props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, clusterName); props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address); props.putIntProperty(ManagementHelper.HDR_DISTANCE, 0); return new Notification(null, CoreNotificationType.PROPOSAL, props); }
@Override public CoreMessage putStringProperty(final SimpleString key, final SimpleString value) { messageChanged(); getProperties().putSimpleStringProperty(key, value); return this; }
@Override public CoreMessage putStringProperty(final SimpleString key, final SimpleString value) { messageChanged(); getProperties().putSimpleStringProperty(key, value); return this; }
@Override public Response receive(final Proposal proposal, final int distance) throws Exception { TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, proposal.getGroupId()); props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, proposal.getClusterName()); props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address); props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance); Notification notification = new Notification(null, CoreNotificationType.PROPOSAL, props); managementService.sendNotification(notification); return null; }
@Override public JMSProducer setProperty(String name, String value) { checkName(name); SimpleString key = new SimpleString(name); properties.putSimpleStringProperty(key, new SimpleString(value)); stringPropertyNames.add(key); return this; }
@Override public void setString(final String name, final String value) throws JMSException { checkName(name); map.putSimpleStringProperty(new SimpleString(name), value == null ? null : new SimpleString(value)); invalid = true; }
@Override public void setString(final String name, final String value) throws JMSException { checkName(name); map.putSimpleStringProperty(new SimpleString(name), value == null ? null : new SimpleString(value)); invalid = true; }
private void sendNotification(JMSNotificationType type, String message) { TypedProperties prop = new TypedProperties(); prop.putSimpleStringProperty(JMSNotificationType.MESSAGE, SimpleString.toSimpleString(message)); Notification notif = new Notification(null, type, prop); try { server.getManagementService().sendNotification(notif); } catch (Exception e) { ActiveMQJMSServerLogger.LOGGER.failedToSendNotification(notif.toString()); } }
@Test public void testSimpleStringProperty() throws Exception { SimpleString strVal = RandomUtil.randomSimpleString(); props.putSimpleStringProperty(key, strVal); Assert.assertEquals(strVal, props.getSimpleStringProperty(key)); }
@Test public void testNullProperty() throws Exception { props.putSimpleStringProperty(key, null); Assert.assertTrue(props.containsProperty(key)); Assert.assertNull(props.getProperty(key)); }
@Test public void testMemoryOffsetAfterClearIsSameAsNewTypedProperties() throws Exception { TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(SimpleString.toSimpleString("helllllloooooo"), SimpleString.toSimpleString("raaaaaaaaaaaaaaaaaaaaaaaa")); props.clear(); assertEquals(new TypedProperties().getMemoryOffset(), props.getMemoryOffset()); } }
@Test public void testEncodedSizeAfterClearIsSameAsNewTypedProperties() throws Exception { TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(SimpleString.toSimpleString("helllllloooooo"), SimpleString.toSimpleString("raaaaaaaaaaaaaaaaaaaaaaaa")); props.clear(); assertEquals(new TypedProperties().getEncodeSize(), props.getEncodeSize()); }