DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f), model(0) { ui.setupUi(this); init(); connect(ui.tableView, SIGNAL(clicked(QModelIndex)), this, SLOT(tryRemove(QModelIndex))); }
void LipstickCompositorWindow::imageRelease(QQuickItem *item) { Q_ASSERT(m_refs.contains(item)); m_refs.remove(m_refs.indexOf(item)); Q_ASSERT(!m_refs.contains(item)); tryRemove(); }
void ReplicatedMergeTreeRestartingThread::activateReplica() { auto host_port = storage.context.getInterserverIOAddress(); auto zookeeper = storage.getZooKeeper(); /// Как другие реплики могут обращаться к данной. ReplicatedMergeTreeAddress address; address.host = host_port.first; address.replication_port = host_port.second; address.queries_port = storage.context.getTCPPort(); address.database = storage.database_name; address.table = storage.table_name; String is_active_path = storage.replica_path + "/is_active"; /** Если нода отмечена как активная, но отметка сделана в этом же экземпляре, удалим ее. * Такое возможно только при истечении сессии в ZooKeeper. */ String data; Stat stat; bool has_is_active = zookeeper->tryGet(is_active_path, data, &stat); if (has_is_active && data == active_node_identifier) { auto code = zookeeper->tryRemove(is_active_path, stat.version); if (code == ZBADVERSION) throw Exception("Another instance of replica " + storage.replica_path + " was created just now." " You shouldn't run multiple instances of same replica. You need to check configuration files.", ErrorCodes::REPLICA_IS_ALREADY_ACTIVE); if (code != ZOK && code != ZNONODE) throw zkutil::KeeperException(code, is_active_path); } /// Одновременно объявим, что эта реплика активна, и обновим хост. zkutil::Ops ops; ops.push_back(new zkutil::Op::Create(is_active_path, active_node_identifier, zookeeper->getDefaultACL(), zkutil::CreateMode::Ephemeral)); ops.push_back(new zkutil::Op::SetData(storage.replica_path + "/host", address.toString(), -1)); try { zookeeper->multi(ops); } catch (const zkutil::KeeperException & e) { if (e.code == ZNODEEXISTS) throw Exception("Replica " + storage.replica_path + " appears to be already active. If you're sure it's not, " "try again in a minute or remove znode " + storage.replica_path + "/is_active manually", ErrorCodes::REPLICA_IS_ALREADY_ACTIVE); throw; } /// current_zookeeper живёт в течение времени жизни replica_is_active_node, /// так как до изменения current_zookeeper, объект replica_is_active_node уничтожается в методе partialShutdown. storage.replica_is_active_node = zkutil::EphemeralNodeHolder::existing(is_active_path, *storage.current_zookeeper); }
void LipstickCompositorWindow::setDelayRemove(bool delay) { if (delay == m_delayRemove) return; m_delayRemove = delay; emit delayRemoveChanged(); tryRemove(); }
DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f), model(0) { ui.setupUi(this); init(); connect(ui.tableView, SIGNAL(clicked(QModelIndex)), this, SLOT(tryRemove(QModelIndex))); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); }
void LipstickCompositorWindow::setDelayRemove(bool delay) { if (delay == m_delayRemove) return; m_delayRemove = delay; if (m_delayRemove) disconnect(this, &QWaylandSurfaceItem::surfaceDestroyed, this, &QObject::deleteLater); else connect(this, &QWaylandSurfaceItem::surfaceDestroyed, this, &QObject::deleteLater); emit delayRemoveChanged(); tryRemove(); }
void LipstickCompositorWindow::imageRelease() { Q_ASSERT(m_ref); --m_ref; tryRemove(); }