01: package vicazh.hyperpool.stream.net;
02:
03: import java.io.*;
04: import vicazh.hyperpool.stream.*;
05:
06: /**
07: * The clients selector
08: *
09: * @author Victor Zhigunov
10: * @version 0.4.0
11: */
12: public class ClientsSelector extends ControlListSelector implements
13: ClientsSelectorMBean {
14: public OutputStream get(OutputStream outputstream)
15: throws IOException {
16: Stream stream = (Stream) super .get(outputstream);
17: Socket socket = ((Stream) stream.connection.getServer())
18: .getSocket();
19: int i;
20: if (socket == null)
21: i = getDef();
22: else {
23: Object object = socket.getInetAddress()
24: .getCanonicalHostName().toLowerCase();
25: sendAttribute(ControlListSelectorMBean.SEEK, object);
26: i = getIndex(object);
27: }
28: stream.connection.getClient().outputstream = get(
29: stream.connection.getServer(), i);
30: ((ClientsConnection) stream.connection).priority = (Priority) getList()
31: .get(i);
32: return stream;
33: }
34:
35: public Connection getConnection() {
36: return new ClientsConnection(this);
37: }
38:
39: }
|