use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class BridgeImpl method stop.
@Override
public void stop() throws Exception {
if (stopping) {
return;
}
stopping = true;
if (logger.isDebugEnabled()) {
logger.debug("Bridge " + this.name + " being stopped");
}
if (futureScheduledReconnection != null) {
futureScheduledReconnection.cancel(true);
}
executor.execute(new StopRunnable());
if (notificationService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeUUID.toString(), CoreNotificationType.BRIDGE_STOPPED, props);
try {
notificationService.sendNotification(notification);
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.broadcastBridgeStoppedError(e);
}
}
}
use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class BroadcastGroupImpl method start.
@Override
public synchronized void start() throws Exception {
if (started) {
return;
}
endpoint.openBroadcaster();
started = true;
if (notificationService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name));
Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.BROADCAST_GROUP_STARTED, props);
notificationService.sendNotification(notification);
}
activate();
}
use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class ClusterConnectionImpl method stop.
@Override
public void stop() throws Exception {
if (!started) {
return;
}
stopping = true;
if (logger.isDebugEnabled()) {
logger.debug(this + "::stopping ClusterConnection");
}
if (serverLocator != null) {
serverLocator.removeClusterTopologyListener(this);
}
logger.debug("Cluster connection being stopped for node" + nodeManager.getNodeId() + ", server = " + this.server + " serverLocator = " + serverLocator);
synchronized (this) {
for (MessageFlowRecord record : records.values()) {
try {
record.close();
} catch (Exception ignore) {
}
}
}
if (managementService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.CLUSTER_CONNECTION_STOPPED, props);
managementService.sendNotification(notification);
}
executor.execute(new Runnable() {
@Override
public void run() {
synchronized (ClusterConnectionImpl.this) {
closeLocator(serverLocator);
serverLocator = null;
}
}
});
started = false;
}
use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class TypedPropertiesTest method setUp.
@Before
public void setUp() throws Exception {
props = new TypedProperties();
key = RandomUtil.randomSimpleString();
}
use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class TypedPropertiesTest method testEncodeDecode.
@Test
public void testEncodeDecode() throws Exception {
props.putByteProperty(RandomUtil.randomSimpleString(), RandomUtil.randomByte());
props.putBytesProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBytes());
props.putBytesProperty(RandomUtil.randomSimpleString(), null);
props.putBooleanProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBoolean());
props.putShortProperty(RandomUtil.randomSimpleString(), RandomUtil.randomShort());
props.putIntProperty(RandomUtil.randomSimpleString(), RandomUtil.randomInt());
props.putLongProperty(RandomUtil.randomSimpleString(), RandomUtil.randomLong());
props.putFloatProperty(RandomUtil.randomSimpleString(), RandomUtil.randomFloat());
props.putDoubleProperty(RandomUtil.randomSimpleString(), RandomUtil.randomDouble());
props.putCharProperty(RandomUtil.randomSimpleString(), RandomUtil.randomChar());
props.putSimpleStringProperty(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString());
props.putSimpleStringProperty(RandomUtil.randomSimpleString(), null);
SimpleString keyToRemove = RandomUtil.randomSimpleString();
props.putSimpleStringProperty(keyToRemove, RandomUtil.randomSimpleString());
ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(1024);
props.encode(buffer.byteBuf());
Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
TypedProperties decodedProps = new TypedProperties();
decodedProps.decode(buffer.byteBuf());
TypedPropertiesTest.assertEqualsTypeProperties(props, decodedProps);
buffer.clear();
// After removing a property, you should still be able to encode the Property
props.removeProperty(keyToRemove);
props.encode(buffer.byteBuf());
Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
}
Aggregations