4
4
import com .nanosai .gridops .ion .write .IonWriter ;
5
5
import com .nanosai .gridops .tcp .TcpMessage ;
6
6
import com .nanosai .gridops .tcp .TcpSocket ;
7
- import com .nanosai .gridops .tcp .TcpSocketsPort ;
7
+ import com .nanosai .gridops .tcp .TcpMessagePort ;
8
8
9
9
import java .io .IOException ;
10
10
import java .net .InetSocketAddress ;
@@ -19,7 +19,7 @@ public static void main(String[] args) throws IOException {
19
19
20
20
SocketChannel socketChannel = SocketChannel .open (new InetSocketAddress ("localhost" , 1111 ));
21
21
22
- final TcpSocketsPort socketsPort = GridOps .tcpSocketsPortBuilder ().build ();
22
+ final TcpMessagePort socketsPort = GridOps .tcpMessagePortBuilder ().build ();
23
23
24
24
TcpSocket tcpSocket = socketsPort .addSocket (socketChannel );
25
25
@@ -31,7 +31,7 @@ public static void main(String[] args) throws IOException {
31
31
//todo convenience method for MemoryBlock's as destination
32
32
ionWriter .setDestination (request .memoryAllocator .data , request .startIndex );
33
33
34
- int ionObjectStartIndex = ionWriter .destIndex ;
34
+ int ionObjectStartIndex = ionWriter .index ;
35
35
ionWriter .writeObjectBegin (1 );
36
36
37
37
ionWriter .writeKeyShort ("field1" );
@@ -40,19 +40,19 @@ public static void main(String[] args) throws IOException {
40
40
ionWriter .writeKeyShort ("field2" );
41
41
ionWriter .writeInt64 (456 );
42
42
43
- int ionObjectBodyLength = ionWriter .destIndex - ionObjectStartIndex - 1 -1 ; // -1 for lead byte, -1 for length byte.
43
+ int ionObjectBodyLength = ionWriter .index - ionObjectStartIndex - 1 -1 ; // -1 for lead byte, -1 for length byte.
44
44
ionWriter .writeObjectEnd (ionObjectStartIndex , 1 , ionObjectBodyLength );
45
45
46
- request .writeIndex = ionWriter .destIndex ;
46
+ request .writeIndex = ionWriter .index ;
47
47
48
48
//todo missing what socket the message should be sent to. Must be a TCPSocket - not a SocketChannel.
49
49
request .tcpSocket = tcpSocket ;
50
50
51
- socketsPort .enqueue (request );
51
+ socketsPort .writeNowOrEnqueue (request );
52
52
53
53
// make sure all written messages are flushed out - although a single call to writeToSockets()
54
54
// does not guarantee that.
55
- socketsPort .writeToSockets ();
55
+ socketsPort .writeNow ();
56
56
57
57
58
58
0 commit comments