|
3 | 3 | /*************************************************************************** |
4 | 4 | * Copyright (C) 2016 iObserve Project (https://www.iobserve-devops.net) |
5 | 5 | * |
6 | | - * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | | - * you may not use this file except in compliance with the License. |
8 | | - * You may obtain a copy of the License at |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
| 7 | + * in compliance with the License. You may obtain a copy of the License at |
9 | 8 | * |
10 | | - * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
11 | 10 | * |
12 | | - * Unless required by applicable law or agreed to in writing, software |
13 | | - * distributed under the License is distributed on an "AS IS" BASIS, |
14 | | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | | - * See the License for the specific language governing permissions and |
16 | | - * limitations under the License. |
| 11 | + * Unless required by applicable law or agreed to in writing, software distributed under the License |
| 12 | + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 13 | + * or implied. See the License for the specific language governing permissions and limitations under |
| 14 | + * the License. |
17 | 15 | ***************************************************************************/ |
18 | 16 |
|
19 | 17 | import java.nio.ByteBuffer; |
20 | 18 | import java.nio.channels.SocketChannel; |
21 | | - |
22 | 19 | import kieker.common.record.io.BinaryValueDeserializer; |
23 | 20 | import kieker.common.record.io.IValueDeserializer; |
24 | | -import kieker.common.util.registry.IRegistry; |
25 | | - |
26 | | -import teetime.stage.io.network.util.GetValueAdapter; |
27 | | -import teetime.stage.io.network.util.ReaderRegistry; |
| 21 | +import kieker.common.registry.reader.ReaderRegistry; |
28 | 22 |
|
29 | 23 | /** |
30 | 24 | * Represents one connection to read records from. |
|
34 | 28 | */ |
35 | 29 | public class Connection { |
36 | 30 |
|
37 | | - /** String registry for one connection. */ |
38 | | - private final ReaderRegistry<String> registry = new ReaderRegistry<>(); |
39 | | - /** The connection channel for in and output. */ |
40 | | - private final SocketChannel channel; |
41 | | - /** String registy wrapper. */ |
42 | | - private final IRegistry<String> stringRegistryWrapper; |
43 | | - /** Byte buffer for reading the channel. */ |
44 | | - private final ByteBuffer buffer; |
45 | | - /** Deserializer setup. */ |
46 | | - private final IValueDeserializer deserializer; |
| 31 | + /** The connection channel for in and output. */ |
| 32 | + private final SocketChannel channel; |
| 33 | + /** String registy wrapper. */ |
| 34 | + private final ReaderRegistry<String> registry = new ReaderRegistry<>(); |
| 35 | + /** Byte buffer for reading the channel. */ |
| 36 | + private final ByteBuffer buffer; |
| 37 | + /** Deserializer setup. */ |
| 38 | + private final IValueDeserializer deserializer; |
47 | 39 |
|
48 | | - /** |
49 | | - * Create a connection for the given channel and utilizing the specified buffer |
50 | | - * size. |
51 | | - * |
52 | | - * @param channel |
53 | | - * connection channel used to read data |
54 | | - * @param bufferSize |
55 | | - * buffer size for reading information |
56 | | - */ |
57 | | - public Connection(final SocketChannel channel, final int bufferSize) { |
58 | | - this.channel = channel; |
59 | | - this.stringRegistryWrapper = new GetValueAdapter<>(this.registry); |
60 | | - this.buffer = ByteBuffer.allocateDirect(bufferSize); |
61 | | - this.deserializer = BinaryValueDeserializer.create(this.buffer, this.stringRegistryWrapper); |
62 | | - } |
| 40 | + /** |
| 41 | + * Create a connection for the given channel and utilizing the specified buffer size. |
| 42 | + * |
| 43 | + * @param channel connection channel used to read data |
| 44 | + * @param bufferSize buffer size for reading information |
| 45 | + */ |
| 46 | + public Connection(final SocketChannel channel, final int bufferSize) { |
| 47 | + this.channel = channel; |
| 48 | + this.buffer = ByteBuffer.allocateDirect(bufferSize); |
| 49 | + this.deserializer = BinaryValueDeserializer.create(this.buffer, this.registry); |
| 50 | + } |
63 | 51 |
|
64 | | - public ReaderRegistry<String> getRegistry() { |
65 | | - return this.registry; |
66 | | - } |
| 52 | + public ReaderRegistry<String> getRegistry() { |
| 53 | + return this.registry; |
| 54 | + } |
67 | 55 |
|
68 | | - public SocketChannel getChannel() { |
69 | | - return this.channel; |
70 | | - } |
| 56 | + public SocketChannel getChannel() { |
| 57 | + return this.channel; |
| 58 | + } |
71 | 59 |
|
72 | | - public ByteBuffer getBuffer() { |
73 | | - return this.buffer; |
74 | | - } |
| 60 | + public ByteBuffer getBuffer() { |
| 61 | + return this.buffer; |
| 62 | + } |
75 | 63 |
|
76 | | - public IValueDeserializer getValueDeserializer() { |
77 | | - return this.deserializer; |
78 | | - } |
| 64 | + public IValueDeserializer getValueDeserializer() { |
| 65 | + return this.deserializer; |
| 66 | + } |
79 | 67 |
|
80 | 68 | } |
0 commit comments