Apache Ignite - Java Тонкий клиент прекращен - PullRequest
0 голосов
/ 09 марта 2020

Я использую apache Воспламенить 2.8.0. это мой код для подключения тонкого клиента Java к серверу,

ClientConfiguration cfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");
try (IgniteClient igniteClient = Ignition.startClient(cfg)) {

    System.out.println("Thin client started.");
    final String CACHE_NAME = "sample";
    ClientCache<Integer, Object > cache = igniteClient.getOrCreateCache(CACHE_NAME);
    cache.put(1,"JP");
    System.out.println(cache.get(1));  

  } //main method



 } //class

он успешно печатает JP, но после этого мой тонкий клиент завершает работу. Есть ли способ сохранить мой тонкий клиент? это мое исключение ..

    [21:48:34,942][SEVERE][grid-nio-worker-client-listener-0-#30][ClientListenerProcessor] Failed to process selector key [ses=GridSelectorNioSessionImpl [worker=ByteBufferNioClientWorker [readBuf=java.nio.HeapByteBuffer[pos=0 lim=8192 cap=8192], super=AbstractNioClientWorker [idx=0, bytesRcvd=0, bytesSent=0, bytesRcvd0=0, bytesSent0=0, select=true, super=GridWorker [name=grid-nio-worker-client-listener-0, igniteInstanceName=null, finished=false, heartbeatTs=1583770713875, hashCode=1387062740, interrupted=false, runner=grid-nio-worker-client-listener-0-#30]]], writeBuf=null, readBuf=null, inRecovery=null, outRecovery=null, closeSocket=true, outboundMessagesQueueSizeMetric=null, super=GridNioSessionImpl [locAddr=/127.0.0.1:10800, rmtAddr=/127.0.0.1:51279, createTime=1583770713811, closeTime=0, bytesSent=83, bytesRcvd=92, bytesSent0=83, bytesRcvd0=92, sndSchedTime=1583770713875, lastSndTime=1583770713875, lastRcvTime=1583770713875, readsPaused=false, filterChain=FilterChain[filters=[GridNioAsyncNotifyFilter, GridNioCodecFilter [parser=ClientListenerBufferedParser, directMode=false]], accepted=true, markedForClose=false]]]
java.io.IOException: An existing connection was forcibly closed by the remote host
    at java.base/sun.nio.ch.SocketDispatcher.read0(Native Method)
    at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
    at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
    at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:245)
    at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
    at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358)
    at org.apache.ignite.internal.util.nio.GridNioServer$ByteBufferNioClientWorker.processRead(GridNioServer.java:1162)
    at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.processSelectedKeysOptimized(GridNioServer.java:2449)
    at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.bodyInternal(GridNioServer.java:2216)
    at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.body(GridNioServer.java:1857)
    at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
    at java.base/java.lang.Thread.run(Thread.java:834)

Ответы [ 2 ]

0 голосов
/ 10 марта 2020

Это похоже на известную и исправленную проблему IGNITE-12032 . Пожалуйста, сверьтесь с выпуском 2.8.0 (доступно для загрузки на Apache Ignite website и в других местах), чтобы узнать, действительно ли оно исчезнет.

0 голосов
/ 09 марта 2020

Вы пробовали следующий код:

ClientConfiguration cfg = new ClientConfiguration().setAddresses("127.0.0.1:10800");

IgniteClient igniteClient = Ignition.startClient(cfg);

System.out.println("Thin client started.");
final String CACHE_NAME = "sample";
ClientCache<Integer, Object > cache = igniteClient.getOrCreateCache(CACHE_NAME);
cache.put(1,"JP");
System.out.println(cache.get(1));

//here your client will be alive  
...