Example usage for com.mongodb MongoClient isLocked

List of usage examples for com.mongodb MongoClient isLocked

Introduction

In this page you can find the example usage for com.mongodb MongoClient isLocked.

Prototype

@Deprecated
public boolean isLocked() 

Source Link

Document

Returns true if the database is locked (read-only), false otherwise.

Usage

From source file:com.edgytech.umongo.ServerPanel.java

License:Apache License

public void fsyncAndLock(ButtonBase button) {
    if (!UMongo.instance.getGlobalStore().confirmLockingOperation()) {
        return;//from   www .  j  a va2  s.c  o m
    }

    new DbJob() {

        @Override
        public Object doRun() throws IOException {
            MongoClient mongo = getServerNode().getServerMongoClient();
            boolean locked = mongo.isLocked();
            if (locked) {
                return mongo.unlock();
            }

            return mongo.fsyncAndLock();
        }

        @Override
        public String getNS() {
            return null;
        }

        @Override
        public String getShortName() {
            return "FSync And Lock";
        }

        @Override
        public void wrapUp(Object res) {
            try {
                // looks like the unlock doesnt take effect right away
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
            }

            super.wrapUp(res);
        }
    }.addJob();
}

From source file:org.apache.rya.indexing.external.PcjIntegrationTestingUtil.java

License:Apache License

public static void deleteCoreRyaTables(final MongoClient client, final String instance, final String collName) {
    final boolean bool = client.isLocked();
    client.getDatabase(instance).getCollection(collName).drop();
}