io.vertx.core.Context.remove()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中io.vertx.core.Context.remove()方法的一些代码示例,展示了Context.remove()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.remove()方法的具体详情如下:
包路径:io.vertx.core.Context
类名称:Context
方法名:remove

Context.remove介绍

[英]Remove some data from the context.
[中]从上下文中删除一些数据。

代码示例

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testPutGetRemoveData() throws Exception {
 SomeObject obj = new SomeObject();
 vertx.runOnContext(v -> {
  Context ctx = Vertx.currentContext();
  ctx.put("foo", obj);
  ctx.runOnContext(v2 -> {
   assertEquals(obj, ctx.get("foo"));
   assertTrue(ctx.remove("foo"));
   ctx.runOnContext(v3 -> {
    assertNull(ctx.get("foo"));
    testComplete();
   });
  });
 });
 await();
}

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * Remove some data from the context.
 * @param key the key to remove
 * @return true if removed successfully, false otherwise
 */
public boolean remove(String key) { 
 boolean ret = delegate.remove(key);
 return ret;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * Remove some data from the context.
 * @param key the key to remove
 * @return true if removed successfully, false otherwise
 */
public boolean remove(String key) { 
 boolean ret = delegate.remove(key);
 return ret;
}

代码示例来源:origin: vert-x3/vertx-sync

/**
 * Remove the scheduler for the current context
 */
@Suspendable
public static void removeContextScheduler() {
 Context context = Vertx.currentContext();
 if (context != null) {
  context.remove(FIBER_SCHEDULER_CONTEXT_KEY);
 }
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testPutGetRemoveData() throws Exception {
 SomeObject obj = new SomeObject();
 vertx.runOnContext(v -> {
  Context ctx = Vertx.currentContext();
  ctx.put("foo", obj);
  ctx.runOnContext(v2 -> {
   assertEquals(obj, ctx.get("foo"));
   assertTrue(ctx.remove("foo"));
   ctx.runOnContext(v3 -> {
    assertNull(ctx.get("foo"));
    testComplete();
   });
  });
 });
 await();
}

相关文章