From ddd79cf61c1f45de9652ad85b917dc5a9d7e8313 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Tue, 18 Nov 2014 21:34:51 +0000 Subject: [PATCH] HCOLL-134 creates a new map based on the details that are sent to the map of builders --- .../chronicle/map/ReplicationHubFindByName.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/map/ReplicationHubFindByName.java b/src/main/java/net/openhft/chronicle/map/ReplicationHubFindByName.java index 2571481a1..523f477fd 100644 --- a/src/main/java/net/openhft/chronicle/map/ReplicationHubFindByName.java +++ b/src/main/java/net/openhft/chronicle/map/ReplicationHubFindByName.java @@ -70,19 +70,23 @@ class ReplicationHubFindByName implements FindByName { @Override void onPut(ChronicleMap map, Bytes entry, int metaDataBytes, boolean added, CharSequence key, - ChronicleMapBuilderWithChannelId builder, ChronicleMapBuilderWithChannelId + ChronicleMapBuilderWithChannelId replaced, ChronicleMapBuilderWithChannelId value, long pos, SharedSegment segment) { - super.onPut(map, entry, metaDataBytes, added, key, builder, value, pos, segment); + super.onPut(map, entry, metaDataBytes, added, key, replaced, value, pos, segment); - if (!added) + if (!added || value == null) return; // establish the new map based on this channel ID - LOG.info("create new map for name=" + builder.chronicleMapBuilder.name() - + ",channelId=" + builder.channelId); + LOG.info("create new map for name=" + value.chronicleMapBuilder.name() + + ",channelId=" + value.channelId); try { - toReplicatedViaChannel(builder.chronicleMapBuilder, builder.channelId).create(); + toReplicatedViaChannel(value.chronicleMapBuilder, value.channelId).create(); + } catch (IllegalStateException e) { + // channel is already created + LOG.debug("while creating channel for name=" + value.chronicleMapBuilder.name() + + ",channelId=" + value.channelId, e); } catch (IOException e) { LOG.error("", e); }