Package org.apache.commons.lang.mutable

Examples of org.apache.commons.lang.mutable.MutableBoolean.booleanValue()


        new DatanodeInfo(cluster.getDataNodes().get(0).getDatanodeId());
    // Allocating the first shm slot requires using up a peer.
    Slot slot = cache.allocShmSlot(datanode, peer, usedPeer,
                    blockId, "testAllocShm_client");
    Assert.assertNotNull(slot);
    Assert.assertTrue(usedPeer.booleanValue());
    cache.getDfsClientShmManager().visit(new Visitor() {
      @Override
      public void visit(HashMap<DatanodeInfo, PerDatanodeVisitorInfo> info)
          throws IOException {
        // The ClientShmManager starts off empty
View Full Code Here


            }
          });
        } catch (IOException e) {
          LOG.error("error running visitor", e);
        }
        return done.booleanValue();
      }
    }, 10, 60000);
    cluster.shutdown();
  }
View Full Code Here

        MutableBoolean didPrune = new MutableBoolean(false);
        List<Versioned<byte[]>> prunedVals = VersionedPutPruneJob.pruneNonReplicaEntries(vals,
                                                                                         keyReplicas,
                                                                                         didPrune);
        assertEquals("Must have pruned some versions", true, didPrune.booleanValue());
        assertEquals("Not pruned properly", TestUtils.getClock(0, 1, 2), prunedVals.get(0)
                                                                                   .getVersion());
        assertEquals("Not pruned properly", TestUtils.getClock(), prunedVals.get(1).getVersion());
        assertEquals("Not pruned properly", TestUtils.getClock(0, 1), prunedVals.get(2)
                                                                                .getVersion());
View Full Code Here

        vals.add(new Versioned<byte[]>(key, fetchedClock));
        vals.add(new Versioned<byte[]>(key, onlineClock));
        MutableBoolean didPrune = new MutableBoolean();

        vals = pruneAndResolve(vals, didPrune);
        assertEquals("Must have pruned something", true, didPrune.booleanValue());
        assertEquals("Must have one winning version", 1, vals.size());
        assertEquals("Must resolve to onlineClock", onlineClock, vals.get(0).getVersion());

        // case where key has not received any writes before the prune job
        vals = new ArrayList<Versioned<byte[]>>();
View Full Code Here

        vals = new ArrayList<Versioned<byte[]>>();
        vals.add(new Versioned<byte[]>(key, fetchedClock));
        didPrune = new MutableBoolean();

        vals = pruneAndResolve(vals, didPrune);
        assertEquals("Must have pruned something", true, didPrune.booleanValue());
        assertEquals("Must have one winning version", 1, vals.size());
        assertEquals("Must resolve to [0:ts] clock",
                     TestUtils.getVersionedPutClock(now, -1, 0),
                     vals.get(0).getVersion());
        VectorClock nextOnlineClock = TestUtils.getVersionedPutClock(now + Time.MS_PER_SECOND,
View Full Code Here

        vals.add(new Versioned<byte[]>(key, fetchedClock2));
        vals.add(new Versioned<byte[]>(key, onlineClock2));
        MutableBoolean didPrune = new MutableBoolean();

        vals = pruneAndResolve(vals, didPrune);
        assertEquals("Must have pruned something", true, didPrune.booleanValue());
        assertEquals("Must have two winning versions", 2, vals.size());
        assertEquals("Must have onlineClock1", onlineClock1, vals.get(0).getVersion());
        assertEquals("Must have onlineClock2", onlineClock2, vals.get(1).getVersion());

        // case where key has not received any writes before the prune job
View Full Code Here

        vals.add(new Versioned<byte[]>(key, fetchedClock1));
        vals.add(new Versioned<byte[]>(key, fetchedClock2));
        didPrune = new MutableBoolean();

        vals = pruneAndResolve(vals, didPrune);
        assertEquals("Must have pruned something", true, didPrune.booleanValue());
        // Note that since 0 is not a master in both fetched clocks, there will
        // be one version. If 0 were to be a master, there will be one version,
        // since master clock will trump non-master clock
        assertEquals("Must have one winning version", 1, vals.size());
        assertEquals("Must resolve to [0:ts] clock",
View Full Code Here

                    List<Versioned<byte[]>> prunedVals = pruneNonReplicaEntries(vals,
                                                                                keyReplicas,
                                                                                didPrune);
                    // Only write something back if some pruning actually
                    // happened. Optimization to reduce load on storage
                    if(didPrune.booleanValue()) {
                        List<Versioned<byte[]>> resolvedVals = VectorClockUtils.resolveVersions(prunedVals);
                        // TODO this is only implemented for BDB for now
                        lockHandle.setValues(resolvedVals);
                        engine.putAndUnlock(key, lockHandle);
                        numPrunedKeys = this.numKeysUpdatedThisRun.incrementAndGet();
View Full Code Here

        private static Collection<Binding> wire(final Bound bound, final BindingContext context, final Field field) {
            final MutableBoolean didBind = new MutableBoolean();
            final List<Binding> bindings = Lists.newArrayList();
            Reflections.visitClassHierarchy(field.getType(), new Visitor<Class<?>>() {
                public void visit(Class<?> klass){
                    if (didBind.booleanValue()) {
                        return;
                    }
                    WiringHarness<Bound, Field> wiringHarness = wiringHarnesses.get(klass);
                    if (wiringHarness == null) {
                        return;
View Full Code Here

                    } catch (Exception e) {
                        throw Throwables.throwUncheckedException(e);
                    }
                }
            });
            if (!didBind.booleanValue()) {
                throw new BindingException("don't know how to wire up @Bound field: " + field.getName());
            }
            return bindings;
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.