Package org.vertx.java.core.json

Examples of org.vertx.java.core.json.JsonObject


  }

  @Override
  public void add(final T value, final Handler<AsyncResult<Boolean>> doneHandler) {
    checkAddress();
    JsonObject message = new JsonObject()
        .putString("action", "add")
        .putString("type", "set")
        .putString("name", name)
        .putValue("value", value);
    eventBus.sendWithTimeout(address, message, 30000, new Handler<AsyncResult<Message<JsonObject>>>() {
View Full Code Here


  }

  @Override
  public void remove(final T value, final Handler<AsyncResult<Boolean>> doneHandler) {
    checkAddress();
    JsonObject message = new JsonObject()
        .putString("action", "remove")
        .putString("type", "set")
        .putString("name", name)
        .putValue("value", value);
    eventBus.sendWithTimeout(address, message, 30000, new Handler<AsyncResult<Message<JsonObject>>>() {
View Full Code Here

  }

  @Override
  public void contains(final Object value, final Handler<AsyncResult<Boolean>> resultHandler) {
    checkAddress();
    JsonObject message = new JsonObject()
        .putString("action", "contains")
        .putString("type", "set")
        .putString("name", name)
        .putValue("value", value);
    eventBus.sendWithTimeout(address, message, 30000, new Handler<AsyncResult<Message<JsonObject>>>() {
View Full Code Here

  }

  @Override
  public void size(final Handler<AsyncResult<Integer>> resultHandler) {
    checkAddress();
    JsonObject message = new JsonObject()
        .putString("action", "size")
        .putString("type", "set")
        .putString("name", name);
    eventBus.sendWithTimeout(address, message, 30000, new Handler<AsyncResult<Message<JsonObject>>>() {
      @Override
View Full Code Here

  }

  @Override
  public void isEmpty(final Handler<AsyncResult<Boolean>> resultHandler) {
    checkAddress();
    JsonObject message = new JsonObject()
        .putString("action", "empty")
        .putString("type", "set")
        .putString("name", name);
    eventBus.sendWithTimeout(address, message, 30000, new Handler<AsyncResult<Message<JsonObject>>>() {
      @Override
View Full Code Here

  }

  @Override
  public void clear(final Handler<AsyncResult<Void>> doneHandler) {
    checkAddress();
    JsonObject message = new JsonObject()
        .putString("action", "clear")
        .putString("type", "set")
        .putString("name", name);
    eventBus.sendWithTimeout(address, message, 30000, new Handler<AsyncResult<Message<JsonObject>>>() {
      @Override
View Full Code Here

  @Override
  public void put(final K key, final V value, final Handler<AsyncResult<V>> doneHandler) {
    map.put(key, value, new Handler<AsyncResult<V>>() {
      @Override
      public void handle(AsyncResult<V> result) {
        eventBus.publish(String.format("%s.%s.%s", map.name(), key, MapEvent.Type.CHANGE.toString()), new JsonObject()
            .putString("type", MapEvent.Type.CHANGE.toString())
            .putValue("key", key)
            .putValue("value", value));
        String event = result.result() == null ? MapEvent.Type.CREATE.toString() : MapEvent.Type.UPDATE.toString();
        eventBus.publish(String.format("%s.%s.%s", map.name(), key, event), new JsonObject()
            .putString("type", event)
            .putValue("key", key)
            .putValue("value", value));
        if (doneHandler != null) {
          doneHandler.handle(result);
View Full Code Here

  @Override
  public void remove(final K key, final Handler<AsyncResult<V>> resultHandler) {
    map.remove(key, new Handler<AsyncResult<V>>() {
      @Override
      public void handle(AsyncResult<V> result) {
        eventBus.publish(String.format("%s.%s.%s", map.name(), key, MapEvent.Type.CHANGE.toString()), new JsonObject()
            .putString("type", MapEvent.Type.CHANGE.toString())
            .putValue("key", key)
            .putValue("value", result.result()));
        eventBus.publish(String.format("%s.%s.%s", map.name(), key, MapEvent.Type.DELETE.toString()), new JsonObject()
            .putString("type", MapEvent.Type.DELETE.toString())
            .putValue("key", key)
            .putValue("value", result.result()));
        if (resultHandler != null) {
          resultHandler.handle(result);
View Full Code Here

  }

  @Override
  public void get(final Handler<AsyncResult<Long>> doneHandler) {
    checkAddress();
    JsonObject message = new JsonObject()
        .putString("action", "get")
        .putString("type", "counter")
        .putString("name", name);
    eventBus.sendWithTimeout(address, message, 30000, new Handler<AsyncResult<Message<JsonObject>>>() {
      @Override
View Full Code Here

  }

  @Override
  public void increment(final Handler<AsyncResult<Void>> doneHandler) {
    checkAddress();
    JsonObject message = new JsonObject()
        .putString("action", "increment")
        .putString("type", "counter")
        .putString("name", name);
    eventBus.sendWithTimeout(address, message, 30000, new Handler<AsyncResult<Message<JsonObject>>>() {
      @Override
View Full Code Here

TOP

Related Classes of org.vertx.java.core.json.JsonObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.