List of usage examples for io.netty.channel ChannelId ChannelId
ChannelId
From source file:net.anyflow.lannister.TestUtil.java
License:Apache License
static public ChannelId newChannelId(String clientId, boolean newChannelId) { return new ChannelId() { private static final long serialVersionUID = 3931333967922160660L; Long idPostfix = Hazelcast.SELF.generator().getIdGenerator("unittest_embeddedchannel").newId(); @Override/* w w w . j a v a 2s. c o m*/ public int compareTo(ChannelId o) { return this.asLongText().equals(o.asLongText()) ? 0 : 1; } @Override public String asShortText() { return asLongText(); } @Override public String asLongText() { if (newChannelId) { return clientId + idPostfix.toString(); } else { return clientId; } } @Override public int hashCode() { if (newChannelId) { return (clientId + idPostfix.toString()).hashCode(); } else { return clientId.hashCode(); } } @Override public String toString() { return asLongText(); } }; }