public void create(Store store, UTF8Buffer client_id) {
}
@Override
public void update(final Task cb) {
StoreUOW uow = store.create_uow();
SessionPB.Bean session_pb = new SessionPB.Bean();
session_pb.setClientId(client_id);
for (Short id : received_message_ids) {
session_pb.addReceivedMessageIds(id.intValue());
}
for (Tuple2<Topic, BindAddress> entry : subscriptions.values()) {
Topic topic = entry._1();
BindAddress address = entry._2();
TopicPB.Bean topic_pb = new TopicPB.Bean();
topic_pb.setName(topic.name());
topic_pb.setQos(topic.qos().ordinal());
topic_pb.setAddress(new UTF8Buffer(address.toString()));
session_pb.addSubscriptions(topic_pb);
}
uow.put(session_key, session_pb.freeze().toUnframedBuffer());
final DispatchQueue current = Dispatch.getCurrentQueue();
uow.on_complete(Scala2Java.toScala(new UnitFn0() {
@Override
public void call() {
current.execute(new Task() {
@Override
public void run() {
cb.run();
}
});
}
}));
uow.release();
}