Mercurial > lbo > hg > clusterrpc-java
view src/main/java/net/borgac/clusterrpc/client/PeerHandle.java @ 5:117cb812e28a
Implement several lower-level classes (networking/framing)
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Fri, 23 Sep 2016 22:01:17 +0200 |
parents | |
children |
line wrap: on
line source
package net.borgac.clusterrpc.client; /** * A PeerHandle identifies a server that a ClientChannel is connected to. * * It can be used to disconnect from that peer. * * @author lbo */ public class PeerHandle { long associatedChannel; int index; PeerHandle(long channelId, int index) { this.associatedChannel = channelId; this.index = index; } @Override public int hashCode() { return new Long(index + associatedChannel).hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PeerHandle other = (PeerHandle) obj; if (this.associatedChannel != other.associatedChannel) { return false; } if (this.index != other.index) { return false; } return true; } }