@Test public void testClear() { RpcInternalContext context = RpcInternalContext.getContext(); context.setRemoteAddress("127.0.0.1", 1234); context.setLocalAddress("127.0.0.1", 2345); context.setFuture(new ResponseFuture<String>() { @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; } @Override public boolean isCancelled() { return false; } @Override public boolean isDone() { return false; } @Override public String get() throws InterruptedException, ExecutionException { return null; } @Override public String get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return null; } @Override public ResponseFuture addListeners(List<SofaResponseCallback> sofaResponseCallbacks) { return null; } @Override public ResponseFuture addListener(SofaResponseCallback sofaResponseCallback) { return null; } }); context.setProviderInfo(ProviderHelper.toProviderInfo("127.0.0.1:80")); context.setAttachment("_xxxx", "yyyy"); context.clear(); Assert.assertNull(context.getRemoteAddress()); Assert.assertNull(context.getLocalAddress()); Assert.assertNull(context.getFuture()); Assert.assertFalse(context.isProviderSide()); Assert.assertFalse(context.isConsumerSide()); Assert.assertNull(context.getProviderInfo()); Assert.assertTrue(context.getAttachments().isEmpty()); Assert.assertNotNull(context.getStopWatch()); Assert.assertTrue(context.getStopWatch().read() == 0); Assert.assertNotNull(context.toString()); }
public void clear() { this.setRemoteAddress(null).setLocalAddress(null).setFuture(null).setProviderSide(null) .setProviderInfo(null); this.attachments = new ConcurrentHashMap<String, Object>(); this.stopWatch.reset(); }
RpcInternalContext implements Cloneable { public void clear() { this.setRemoteAddress(null).setLocalAddress(null).setFuture(null).setProviderSide(null) .setProviderInfo(null); this.attachments = new ConcurrentHashMap<String, Object>(); this.stopWatch.reset(); } }
RpcInternalContext implements Cloneable { public void clear() { this.setRemoteAddress(null).setLocalAddress(null).setFuture(null).setProviderSide(null) .setProviderInfo(null); this.attachments = new ConcurrentHashMap<String, Object>(); this.stopWatch.reset(); } protected  RpcInternalContext(); }
RpcInternalContext implements Cloneable { public void clear() { this.setRemoteAddress(null).setLocalAddress(null).setFuture(null).setProviderSide(null) .setProviderInfo(null); this.attachments = new ConcurrentHashMap<String, Object>(); this.stopWatch.reset(); } protected  RpcInternalContext(); static void setContext(RpcInternalContext context); static RpcInternalContext getContext(); static RpcInternalContext peekContext(); static void removeContext(); static void pushContext(); static void popContext(); static void removeAllContext(); static boolean isAttachmentEnable(); boolean isProviderSide(); RpcInternalContext setProviderSide(Boolean isProviderSide); boolean isConsumerSide(); @SuppressWarnings("unchecked") ResponseFuture<T> getFuture(); RpcInternalContext setFuture(ResponseFuture<?> future); RpcInternalContext setLocalAddress(InetSocketAddress address); @Deprecated RpcInternalContext setLocalAddress(String host, int port); InetSocketAddress getLocalAddress(); RpcInternalContext setRemoteAddress(InetSocketAddress address); RpcInternalContext setRemoteAddress(String host, int port); InetSocketAddress getRemoteAddress(); String getRemoteHostName(); Object getAttachment(String key); RpcInternalContext setAttachment(String key, Object value); Object removeAttachment(String key); Map<String, Object> getAttachments(); RpcInternalContext setAttachments(Map<String, Object> attachments); RpcInternalContext clearAttachments(); StopWatch getStopWatch(); void clear(); RpcInternalContext setProviderInfo(ProviderInfo providerInfo); ProviderInfo getProviderInfo(); @Override String toString(); @Override RpcInternalContext clone(); static boolean isValidInternalParamKey(String key); }
RpcInternalContext implements Cloneable { public void clear() { this.setRemoteAddress(null).setLocalAddress(null).setFuture(null).setProviderSide(null) .setProviderInfo(null); this.attachments = new ConcurrentHashMap<String, Object>(); this.stopWatch.reset(); } protected  RpcInternalContext(); static void setContext(RpcInternalContext context); static RpcInternalContext getContext(); static RpcInternalContext peekContext(); static void removeContext(); static void pushContext(); static void popContext(); static void removeAllContext(); static boolean isAttachmentEnable(); boolean isProviderSide(); RpcInternalContext setProviderSide(Boolean isProviderSide); boolean isConsumerSide(); @SuppressWarnings("unchecked") ResponseFuture<T> getFuture(); RpcInternalContext setFuture(ResponseFuture<?> future); RpcInternalContext setLocalAddress(InetSocketAddress address); @Deprecated RpcInternalContext setLocalAddress(String host, int port); InetSocketAddress getLocalAddress(); RpcInternalContext setRemoteAddress(InetSocketAddress address); RpcInternalContext setRemoteAddress(String host, int port); InetSocketAddress getRemoteAddress(); String getRemoteHostName(); Object getAttachment(String key); RpcInternalContext setAttachment(String key, Object value); Object removeAttachment(String key); Map<String, Object> getAttachments(); RpcInternalContext setAttachments(Map<String, Object> attachments); RpcInternalContext clearAttachments(); StopWatch getStopWatch(); void clear(); RpcInternalContext setProviderInfo(ProviderInfo providerInfo); ProviderInfo getProviderInfo(); @Override String toString(); @Override RpcInternalContext clone(); static boolean isValidInternalParamKey(String key);  }