Package org.drasyl.peer.connection
Class PeerChannelGroup
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<io.netty.channel.Channel>
-
- io.netty.channel.group.DefaultChannelGroup
-
- org.drasyl.peer.connection.PeerChannelGroup
-
- All Implemented Interfaces:
io.netty.channel.group.ChannelGroup
,Comparable<io.netty.channel.group.ChannelGroup>
,Iterable<io.netty.channel.Channel>
,Collection<io.netty.channel.Channel>
,Set<io.netty.channel.Channel>
public class PeerChannelGroup extends io.netty.channel.group.DefaultChannelGroup
Special type ofChannelGroup
, which has a lookup complexity of O(1) instead of O(n) for lookups byCompressedPublicKey
.
-
-
Field Summary
Fields Modifier and Type Field Description static io.netty.util.AttributeKey<CompressedPublicKey>
ATTRIBUTE_PUBLIC_KEY
-
Constructor Summary
Constructors Constructor Description PeerChannelGroup()
PeerChannelGroup(io.netty.util.concurrent.EventExecutor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(io.netty.channel.Channel channel)
boolean
add(CompressedPublicKey identity, io.netty.channel.Channel channel)
boolean
equals(Object o)
io.netty.channel.Channel
find(CompressedPublicKey identity)
int
hashCode()
boolean
remove(Object o)
io.netty.channel.ChannelFuture
writeAndFlush(CompressedPublicKey identity, Object message)
-
Methods inherited from class io.netty.channel.group.DefaultChannelGroup
clear, close, close, compareTo, contains, deregister, deregister, disconnect, disconnect, find, flush, flush, flushAndWrite, flushAndWrite, isEmpty, iterator, name, newCloseFuture, newCloseFuture, size, toArray, toArray, toString, write, write, write, writeAndFlush, writeAndFlush, writeAndFlush
-
Methods inherited from class java.util.AbstractSet
removeAll
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
addAll, containsAll, removeAll, retainAll, spliterator
-
-
-
-
Field Detail
-
ATTRIBUTE_PUBLIC_KEY
public static final io.netty.util.AttributeKey<CompressedPublicKey> ATTRIBUTE_PUBLIC_KEY
-
-
Method Detail
-
writeAndFlush
public io.netty.channel.ChannelFuture writeAndFlush(CompressedPublicKey identity, Object message)
- Throws:
IllegalArgumentException
- if no channel with given identity could be found
-
find
public io.netty.channel.Channel find(CompressedPublicKey identity)
-
add
public boolean add(io.netty.channel.Channel channel)
- Specified by:
add
in interfaceCollection<io.netty.channel.Channel>
- Specified by:
add
in interfaceSet<io.netty.channel.Channel>
- Overrides:
add
in classio.netty.channel.group.DefaultChannelGroup
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<io.netty.channel.Channel>
- Specified by:
remove
in interfaceSet<io.netty.channel.Channel>
- Overrides:
remove
in classio.netty.channel.group.DefaultChannelGroup
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<io.netty.channel.Channel>
- Specified by:
hashCode
in interfaceSet<io.netty.channel.Channel>
- Overrides:
hashCode
in classio.netty.channel.group.DefaultChannelGroup
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceCollection<io.netty.channel.Channel>
- Specified by:
equals
in interfaceSet<io.netty.channel.Channel>
- Overrides:
equals
in classio.netty.channel.group.DefaultChannelGroup
-
add
public boolean add(CompressedPublicKey identity, io.netty.channel.Channel channel)
-
-