@Test public void testScanResponseTable() { int dummyId = 1; ResponseFuture responseFuture = new ResponseFuture(null,dummyId, -1000, new InvokeCallback() { @Override public void operationComplete(final ResponseFuture responseFuture) { } }, null); remotingAbstract.responseTable.putIfAbsent(dummyId, responseFuture); remotingAbstract.scanResponseTable(); assertNull(remotingAbstract.responseTable.get(dummyId)); }
public void scanResponseTable() { final List<ResponseFuture> rfList = new LinkedList<ResponseFuture>(); Iterator<Entry<Integer, ResponseFuture>> it = this.responseTable.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, ResponseFuture> next = it.next(); ResponseFuture rep = next.getValue(); if ((rep.getBeginTimestamp() + rep.getTimeoutMillis() + 1000) <= System.currentTimeMillis()) { rep.release(); it.remove(); rfList.add(rep); log.warn("remove timeout request, " + rep); } } for (ResponseFuture rf : rfList) { try { executeInvokeCallback(rf); } catch (Throwable e) { log.warn("scanResponseTable, operationComplete Exception", e); } } }
NettyRemotingAbstract { public void scanResponseTable() { final List<ResponseFuture> rfList = new LinkedList<ResponseFuture>(); Iterator<Entry<Integer, ResponseFuture>> it = this.responseTable.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, ResponseFuture> next = it.next(); ResponseFuture rep = next.getValue(); if ((rep.getBeginTimestamp() + rep.getTimeoutMillis() + 1000) <= System.currentTimeMillis()) { rep.release(); it.remove(); rfList.add(rep); log.warn("remove timeout request, " + rep); } } for (ResponseFuture rf : rfList) { try { executeInvokeCallback(rf); } catch (Throwable e) { log.warn("scanResponseTable, operationComplete Exception", e); } } } }
NettyRemotingAbstract { public void scanResponseTable() { final List<ResponseFuture> rfList = new LinkedList<ResponseFuture>(); Iterator<Entry<Integer, ResponseFuture>> it = this.responseTable.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, ResponseFuture> next = it.next(); ResponseFuture rep = next.getValue(); if ((rep.getBeginTimestamp() + rep.getTimeoutMillis() + 1000) <= System.currentTimeMillis()) { rep.release(); it.remove(); rfList.add(rep); log.warn("remove timeout request, " + rep); } } for (ResponseFuture rf : rfList) { try { executeInvokeCallback(rf); } catch (Throwable e) { log.warn("scanResponseTable, operationComplete Exception", e); } } } NettyRemotingAbstract(final int permitsOneway, final int permitsAsync); }
NettyRemotingAbstract { public void scanResponseTable() { final List<ResponseFuture> rfList = new LinkedList<ResponseFuture>(); Iterator<Entry<Integer, ResponseFuture>> it = this.responseTable.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, ResponseFuture> next = it.next(); ResponseFuture rep = next.getValue(); if ((rep.getBeginTimestamp() + rep.getTimeoutMillis() + 1000) <= System.currentTimeMillis()) { rep.release(); it.remove(); rfList.add(rep); log.warn("remove timeout request, " + rep); } } for (ResponseFuture rf : rfList) { try { executeInvokeCallback(rf); } catch (Throwable e) { log.warn("scanResponseTable, operationComplete Exception", e); } } } NettyRemotingAbstract(final int permitsOneway, final int permitsAsync); abstract ChannelEventListener getChannelEventListener(); void putNettyEvent(final NettyEvent event); void processMessageReceived(ChannelHandlerContext ctx, RemotingCommand msg); void processRequestCommand(final ChannelHandlerContext ctx, final RemotingCommand cmd); void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd); List<RPCHook> getRPCHooks(); abstract ExecutorService getCallbackExecutor(); void scanResponseTable(); RemotingCommand invokeSyncImpl(final Channel channel, final RemotingCommand request,
        final long timeoutMillis); void invokeAsyncImpl(final Channel channel, final RemotingCommand request, final long timeoutMillis,
        final InvokeCallback invokeCallback); void invokeOnewayImpl(final Channel channel, final RemotingCommand request, final long timeoutMillis); }
NettyRemotingAbstract { public void scanResponseTable() { final List<ResponseFuture> rfList = new LinkedList<ResponseFuture>(); Iterator<Entry<Integer, ResponseFuture>> it = this.responseTable.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, ResponseFuture> next = it.next(); ResponseFuture rep = next.getValue(); if ((rep.getBeginTimestamp() + rep.getTimeoutMillis() + 1000) <= System.currentTimeMillis()) { rep.release(); it.remove(); rfList.add(rep); log.warn("remove timeout request, " + rep); } } for (ResponseFuture rf : rfList) { try { executeInvokeCallback(rf); } catch (Throwable e) { log.warn("scanResponseTable, operationComplete Exception", e); } } } NettyRemotingAbstract(final int permitsOneway, final int permitsAsync); abstract ChannelEventListener getChannelEventListener(); void putNettyEvent(final NettyEvent event); void processMessageReceived(ChannelHandlerContext ctx, RemotingCommand msg); void processRequestCommand(final ChannelHandlerContext ctx, final RemotingCommand cmd); void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd); List<RPCHook> getRPCHooks(); abstract ExecutorService getCallbackExecutor(); void scanResponseTable(); RemotingCommand invokeSyncImpl(final Channel channel, final RemotingCommand request,
        final long timeoutMillis); void invokeAsyncImpl(final Channel channel, final RemotingCommand request, final long timeoutMillis,
        final InvokeCallback invokeCallback); void invokeOnewayImpl(final Channel channel, final RemotingCommand request, final long timeoutMillis);  }