public TopologyMemberImpl(String nodeId, final String backupGroupName, final String scaleDownGroupName, final TransportConfiguration a, final TransportConfiguration b) { this.nodeId = nodeId; this.backupGroupName = backupGroupName; this.scaleDownGroupName = scaleDownGroupName; this.connector = new Pair<>(a, b); uniqueEventID = System.currentTimeMillis(); }
public static Pair<SimpleString, EnumSet<RoutingType>> getAddressAndRoutingTypes(SimpleString address, EnumSet<RoutingType> defaultRoutingTypes, Map<SimpleString, RoutingType> prefixes) { for (Map.Entry<SimpleString, RoutingType> entry : prefixes.entrySet()) { if (address.startsWith(entry.getKey())) { return new Pair<>(removePrefix(address, entry.getKey()), EnumSet.of(entry.getValue())); } } return new Pair<>(address, defaultRoutingTypes); }
public static void addIgnore(String className, String propertyName) { logger.trace("Adding ignore on " + className + "/" + propertyName); ignores.add(new Pair<>(className, propertyName)); }
public static boolean isIgnored(String className, String propertyName) { return ignores.contains(new Pair<>(className, propertyName)); }
/** * Utility for reading bytes out of streaming. * It will return remainingBytes, bytesRead * * @param remainingBytes remaining Bytes from previous read. Send it to 0 if it was the first call for the message * @param buff * @return a pair of remaining bytes and bytes read */ public static Pair<Integer, Integer> streamReadBytes(ActiveMQBuffer buff, int remainingBytes, byte[] value) { if (remainingBytes == -1) { return new Pair<>(0, -1); } else if (remainingBytes == 0) { byte type = buff.readByte(); if (type != DataConstants.BYTES) { throw new IllegalStateException("Invalid conversion"); } remainingBytes = buff.readInt(); } int read = Math.min(value.length, remainingBytes); buff.readBytes(value, 0, read); remainingBytes -= read; if (remainingBytes == 0) { remainingBytes = -1; } return new Pair<>(remainingBytes, read); }
Pair<String, String> pair = new Pair<>(parts[0].toString(), parts[1].toString());
public static Pair<TransportConfiguration, TransportConfiguration> checkTCPPairConversion(int clientIncrementingVersion, TopologyMember member) { if (clientIncrementingVersion < INITIAL_ACTIVEMQ_INCREMENTING_VERSION) { return new Pair<>(convertTransport(member.getLive()), convertTransport(member.getBackup())); } return new Pair<>(member.getLive(), member.getBackup()); }
private void internalUpdateArray(long time) { synchronized (topologyArrayGuard) { Collection<TopologyMemberImpl> membersCopy = topology.getMembers(); Pair<TransportConfiguration, TransportConfiguration>[] topologyArrayLocal = (Pair<TransportConfiguration, TransportConfiguration>[]) Array.newInstance(Pair.class, membersCopy.size()); int count = 0; for (TopologyMemberImpl pair : membersCopy) { Pair<TransportConfiguration, TransportConfiguration> transportConfigs = pair.getConnector(); topologyArrayLocal[count++] = new Pair<>(protocolManagerFactory.adaptTransportConfiguration(transportConfigs.getA()), protocolManagerFactory.adaptTransportConfiguration(transportConfigs.getB())); } this.topologyArray = topologyArrayLocal; } }
@Override public void decodeRest(final ActiveMQBuffer buffer) { exit = buffer.readBoolean(); nodeID = buffer.readString(); if (!exit) { boolean hasLive = buffer.readBoolean(); TransportConfiguration a; if (hasLive) { a = new TransportConfiguration(); a.decode(buffer); } else { a = null; } boolean hasBackup = buffer.readBoolean(); TransportConfiguration b; if (hasBackup) { b = new TransportConfiguration(); b.decode(buffer); } else { b = null; } pair = new Pair<>(a, b); last = buffer.readBoolean(); } }
Pair<TransportConfiguration, TransportConfiguration> transportConfig = topMessage.getPair(); if (transportConfig.getA() == null && transportConfig.getB() == null) { transportConfig = new Pair<>(conn.getTransportConnection().getConnectorConfig(), null);
@Override public void decodeRest(final ActiveMQBuffer buffer) { exit = buffer.readBoolean(); nodeID = buffer.readString(); uniqueEventID = buffer.readLong(); if (!exit) { boolean hasLive = buffer.readBoolean(); TransportConfiguration a; if (hasLive) { a = new TransportConfiguration(); a.decode(buffer); } else { a = null; } boolean hasBackup = buffer.readBoolean(); TransportConfiguration b; if (hasBackup) { b = new TransportConfiguration(); b.decode(buffer); } else { b = null; } pair = new Pair<>(a, b); last = buffer.readBoolean(); } if (buffer.readableBytes() > 0) { backupGroupName = buffer.readNullableString(); } }
public TopologyMemberImpl(String nodeId, final String backupGroupName, final String scaleDownGroupName, final TransportConfiguration a, final TransportConfiguration b) { this.nodeId = nodeId; this.backupGroupName = backupGroupName; this.scaleDownGroupName = scaleDownGroupName; this.connector = new Pair<>(a, b); uniqueEventID = System.currentTimeMillis(); }
public void publishReleasedSent(int mqttId, long serverMessageId) { synchronized (dataStoreLock) { mqttToServerIds.put(mqttId, new Pair<>(serverMessageId, 0L)); } }
public static Pair<SimpleString, EnumSet<RoutingType>> getAddressAndRoutingTypes(SimpleString address, EnumSet<RoutingType> defaultRoutingTypes, Map<SimpleString, RoutingType> prefixes) { for (Map.Entry<SimpleString, RoutingType> entry : prefixes.entrySet()) { if (address.startsWith(entry.getKey())) { return new Pair<>(removePrefix(address, entry.getKey()), EnumSet.of(entry.getValue())); } } return new Pair<>(address, defaultRoutingTypes); }
public static Pair<SimpleString, EnumSet<RoutingType>> getAddressAndRoutingTypes(SimpleString address, EnumSet<RoutingType> defaultRoutingTypes, Map<SimpleString, RoutingType> prefixes) { for (Map.Entry<SimpleString, RoutingType> entry : prefixes.entrySet()) { if (address.startsWith(entry.getKey())) { return new Pair<>(removePrefix(address, entry.getKey()), EnumSet.of(entry.getValue())); } } return new Pair<>(address, defaultRoutingTypes); }
public static Pair<TransportConfiguration, TransportConfiguration> checkTCPPairConversion(int clientIncrementingVersion, TopologyMember member) { if (clientIncrementingVersion < INITIAL_ACTIVEMQ_INCREMENTING_VERSION) { return new Pair<>(convertTransport(member.getLive()), convertTransport(member.getBackup())); } return new Pair<>(member.getLive(), member.getBackup()); }
@Override public void run() { String nodeId = server.getNodeID().toString(); Pair<TransportConfiguration, TransportConfiguration> emptyConfig = new Pair<>(null, null); if (channel0.supports(PacketImpl.CLUSTER_TOPOLOGY_V2)) { channel0.send(new ClusterTopologyChangeMessage_V2(System.currentTimeMillis(), nodeId, null, emptyConfig, true)); } else { channel0.send(new ClusterTopologyChangeMessage(nodeId, emptyConfig, true)); } } });
@Override public void nodeUP(TopologyMember topologyMember, boolean last) { Pair<TransportConfiguration, TransportConfiguration> connectorPair = new Pair<>(topologyMember.getLive(), topologyMember.getBackup()); nodes.put(topologyMember.getBackupGroupName(), connectorPair); }