public static SimpleString cachedAddressSimpleString(String address, CoreMessageObjectPools coreMessageObjectPools) { return SimpleString.toSimpleString(address, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressStringSimpleStringPool()); } }
private SimpleString.StringSimpleStringPool getPropertyKeysPool() { return coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesStringSimpleStringPools().getPropertyKeysPool(); }
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) { messageIDPosition = buffer.readerIndex(); messageID = buffer.readLong(); address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool()); if (buffer.readByte() == DataConstants.NOT_NULL) { byte[] bytes = new byte[16]; buffer.readBytes(bytes); userID = new UUID(UUID.TYPE_TIME_BASED, bytes); } else { userID = null; } type = buffer.readByte(); durable = buffer.readBoolean(); expiration = buffer.readLong(); timestamp = buffer.readLong(); priority = buffer.readByte(); if (lazyProperties) { properties = null; propertiesLocation = buffer.readerIndex(); } else { properties = new TypedProperties(); properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } }
/** * I am keeping this synchronized as the decode of the Properties is lazy */ protected TypedProperties checkProperties() { if (properties == null) { TypedProperties properties = new TypedProperties(); if (buffer != null && propertiesLocation >= 0) { final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation); properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } this.properties = properties; } return this.properties; }
@Override public CoreMessage setGroupID(String groupId) { return this.setGroupID(SimpleString.toSimpleString(groupId, coreMessageObjectPools == null ? null : coreMessageObjectPools.getGroupIdStringSimpleStringPool())); }
/** * I am keeping this synchronized as the decode of the Properties is lazy */ protected TypedProperties checkProperties() { if (properties == null) { TypedProperties properties = new TypedProperties(); if (buffer != null && propertiesLocation >= 0) { final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation); properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } this.properties = properties; } return this.properties; }
@Override public CoreMessage setGroupID(String groupId) { return this.setGroupID(SimpleString.toSimpleString(groupId, coreMessageObjectPools == null ? null : coreMessageObjectPools.getGroupIdStringSimpleStringPool())); }
@Override public CoreMessage setAddress(String address) { messageChanged(); this.address = SimpleString.toSimpleString(address, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressStringSimpleStringPool()); return this; }
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) { messageIDPosition = buffer.readerIndex(); messageID = buffer.readLong(); address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool()); if (buffer.readByte() == DataConstants.NOT_NULL) { byte[] bytes = new byte[16]; buffer.readBytes(bytes); userID = new UUID(UUID.TYPE_TIME_BASED, bytes); } else { userID = null; } type = buffer.readByte(); durable = buffer.readBoolean(); expiration = buffer.readLong(); timestamp = buffer.readLong(); priority = buffer.readByte(); if (lazyProperties) { properties = null; propertiesLocation = buffer.readerIndex(); } else { properties = new TypedProperties(INTERNAL_PROPERTY_NAMES_PREDICATE); properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } }
private SimpleString.StringSimpleStringPool getPropertyValuesPool() { return coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesStringSimpleStringPools().getPropertyValuesPool(); }
/** * I am keeping this synchronized as the decode of the Properties is lazy */ protected TypedProperties checkProperties() { try { if (properties == null) { synchronized (this) { if (properties == null) { TypedProperties properties = new TypedProperties(); if (buffer != null && propertiesLocation >= 0) { final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation); properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } this.properties = properties; } } } return this.properties; } catch (Throwable e) { ByteBuf duplicatebuffer = buffer.duplicate(); duplicatebuffer.readerIndex(0); // This is not an expected error, hence no specific logger created logger.warn("Could not decode properties for CoreMessage[messageID=" + messageID + ",durable=" + durable + ",userID=" + userID + ",priority=" + priority + ", timestamp=" + timestamp + ",expiration=" + expiration + ",address=" + address + ", propertiesLocation=" + propertiesLocation, e); logger.warn("Failed message has messageID=" + messageID + " and the following buffer:\n" + ByteBufUtil.prettyHexDump(duplicatebuffer)); throw new RuntimeException(e.getMessage(), e); } }
@Override public CoreMessage setGroupID(String groupId) { return this.setGroupID(SimpleString.toSimpleString(groupId, coreMessageObjectPools == null ? null : coreMessageObjectPools.getGroupIdStringSimpleStringPool())); }
public static SimpleString cachedAddressSimpleString(String address, CoreMessageObjectPools coreMessageObjectPools) { return SimpleString.toSimpleString(address, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressStringSimpleStringPool()); } }
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) { messageIDPosition = buffer.readerIndex(); messageID = buffer.readLong(); address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool()); if (buffer.readByte() == DataConstants.NOT_NULL) { byte[] bytes = new byte[16]; buffer.readBytes(bytes); userID = new UUID(UUID.TYPE_TIME_BASED, bytes); } else { userID = null; } type = buffer.readByte(); durable = buffer.readBoolean(); expiration = buffer.readLong(); timestamp = buffer.readLong(); priority = buffer.readByte(); if (lazyProperties) { properties = null; propertiesLocation = buffer.readerIndex(); } else { properties = new TypedProperties(); properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } }
private SimpleString.StringSimpleStringPool getPropertyValuesPool() { return coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesStringSimpleStringPools().getPropertyValuesPool(); } }
private synchronized TypedProperties getOrInitializeTypedProperties() { try { TypedProperties properties = this.properties; if (properties == null) { properties = new TypedProperties(INTERNAL_PROPERTY_NAMES_PREDICATE); if (buffer != null && propertiesLocation >= 0) { final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation); properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } this.properties = properties; } return properties; } catch (Throwable e) { throw onCheckPropertiesError(e); } }
@Override public SimpleString getGroupID() { ensureMessageDataScanned(); if (properties != null && properties.getGroupId() != null) { return SimpleString.toSimpleString(properties.getGroupId(), coreMessageObjectPools == null ? null : coreMessageObjectPools.getGroupIdStringSimpleStringPool()); } else { return null; } }
public static SimpleString cachedAddressSimpleString(String address, CoreMessageObjectPools coreMessageObjectPools) { return SimpleString.toSimpleString(address, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressStringSimpleStringPool()); } }
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) { messageIDPosition = buffer.readerIndex(); messageID = buffer.readLong(); address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool()); if (buffer.readByte() == DataConstants.NOT_NULL) { byte[] bytes = new byte[16]; buffer.readBytes(bytes); userID = new UUID(UUID.TYPE_TIME_BASED, bytes); } else { userID = null; } type = buffer.readByte(); durable = buffer.readBoolean(); expiration = buffer.readLong(); timestamp = buffer.readLong(); priority = buffer.readByte(); if (lazyProperties) { properties = null; propertiesLocation = buffer.readerIndex(); } else { properties = new TypedProperties(); properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } }
private SimpleString.StringSimpleStringPool getPropertyKeysPool() { return coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesStringSimpleStringPools().getPropertyKeysPool(); }