mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-08 14:57:30 +07:00
Removed functions from Endpoint.IdResolver
In my use-cases there should be a preexisting struct already IdResolver should just be an accessor to that struct and not a mutator
This commit is contained in:
@ -11,7 +11,5 @@ public interface Endpoint<T> {
|
||||
|
||||
interface IdResolver<R> {
|
||||
R get(int id);
|
||||
R put(int id, R ch);
|
||||
R remove(int id);
|
||||
}
|
||||
}
|
||||
|
@ -75,16 +75,6 @@ public class Server implements PacketProcessor {
|
||||
return clients[id].channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Channel put(int id, Channel ch) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Channel remove(int id) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ArrayUtils.toString(clients);
|
||||
|
@ -4,6 +4,11 @@ import io.netty.channel.Channel;
|
||||
|
||||
import com.riiablo.nnet.Endpoint;
|
||||
|
||||
/**
|
||||
* Not used anymore -- prefer to use anonymous implementations of {@link Endpoint.IdResolver} which
|
||||
* wrap preexisting data structures.
|
||||
*/
|
||||
@Deprecated
|
||||
public class ChannelIdResolver implements Endpoint.IdResolver<Channel> {
|
||||
private final Channel[] channels;
|
||||
|
||||
@ -15,16 +20,4 @@ public class ChannelIdResolver implements Endpoint.IdResolver<Channel> {
|
||||
public Channel get(int id) {
|
||||
return channels[id];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Channel put(int id, Channel ch) {
|
||||
Channel oldValue = channels[id];
|
||||
channels[id] = ch;
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Channel remove(int id) {
|
||||
return put(id, null);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user