Java Code Examples for io.vertx.core.shareddata.LocalMap#remove()

The following examples show how to use io.vertx.core.shareddata.LocalMap#remove() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MailClientImpl.java    From vertx-mail-client with Apache License 2.0 5 votes vote down vote up
private void removeFromMap(LocalMap<String, MailHolder> map, String dataSourceName) {
  synchronized (vertx) {
    map.remove(dataSourceName);
    if (map.isEmpty()) {
      map.close();
    }
  }
}
 
Example 2
Source File: MongoClientImpl.java    From vertx-mongo-client with Apache License 2.0 5 votes vote down vote up
private void removeFromMap(LocalMap<String, MongoHolder> map, String dataSourceName) {
  synchronized (vertx) {
    map.remove(dataSourceName);
    if (map.isEmpty()) {
      map.close();
    }
  }
}
 
Example 3
Source File: MQTTStoreManagerAsync.java    From vertx-mqtt-broker with Apache License 2.0 5 votes vote down vote up
public void deleteMessage(String topic) {
    String key = topic;
    LocalMap<String, byte[]> map = vertx.sharedData().getLocalMap(tenant);
    if(map.keySet().contains(key)) {
        map.remove(key);
    }
}
 
Example 4
Source File: MQTTStoreManagerAsync.java    From vertx-mqtt-broker with Apache License 2.0 5 votes vote down vote up
/** get and delete topic/message */
public void popMessage(String topic, String clientID, Handler<byte[]> handler) {
    String key  = clientID+topic;
    String k = ""+currentID(key);
    LocalMap<String, byte[]> set = vertx.sharedData().getLocalMap(tenant + key);
    if(set.keySet().contains(k)) {
        byte[] removed = set.remove(k);
        decrementID(key);
        handler.handle( removed );
    } else {
        handler.handle(null);
    }
}