Examples of WriteResult


Examples of com.mongodb.WriteResult

        Role role = getRole(roleName);
        if (role == null) {
            return null;
        }

        WriteResult result = coll.remove(getTemplateObject(role));

        if (result.getLastError() != null) {
            result.getLastError().throwOnError();
        }

        return role;
    }
View Full Code Here

Examples of net.sf.joafip.store.entity.objectio.manager.WriteResult

    final WithObjectField withObjectField = new WithObjectField();
    final ObjectAndPersistInfo objectAndPersistInfo = createObjectAndItsPersistInfo(withObjectField);
    /* initial write */
    Integer fieldValue = Integer.valueOf(0);
    withObjectField.setObject(fieldValue);
    WriteResult writeResult = write(objectAndPersistInfo);
    assertValueChangeForFirstWrite(writeResult);
    assertReferencedSons(new Class[] { Object.class },
        new Class[] { Integer.class }, new Object[] { fieldValue },
        writeResult);
    assertReferenceChange(objectAndPersistInfo, new Class[] { null },
View Full Code Here

Examples of net.sf.joafip.store.entity.objectio.serialize.WriteResult

    final ClassInfo classInfo = classInfoFactory
        .getNoProxyClassInfo(toSerialize.getClass());
    Object[] referenceds = toSerializeAndReferenced.getReferenceds();

    // initial write
    WriteResult writeResult = write(toSerialize, classInfo);
    ObjectClassInfoAndDeclared[] sons = writeResult.getSons();
    ObjectAndPersistInfo objectAndPersistInfo = writeResult
        .getObjectAndPersistInfo();
    final byte[] binary = writeResult.getBinary();

    // check sons wrote
    assertSons(toSerialize, sons, referenceds);
    ObjectClassInfoAndDeclared[] originalValue = objectAndPersistInfo.originalValue;
    assertSons(toSerialize, originalValue, referenceds);
    // dummy data record identifier for object
    final DataRecordIdentifier dataRecordIdentifier =
    /**/getOrCreateDataRecordIdentifierAssociatedToObject(objectAndPersistInfo);

    // create the object by reading
    final IObjectInput objectInput = new ObjectInputImmediateSerializable(
        this, classInfoFactory, proxyManager2, helperBinaryConversion);

    final StorageInfo storageInfo = new StorageInfo();
    // storageInfo.setHeaderDataSize(0);
    ObjectAndPersistInfo unserializedAndPersistInfo = objectInput
        .createObject(dataRecordIdentifier, binary, classInfo,
            storageInfo);
    originalValue = unserializedAndPersistInfo.originalValue;
    assertSons(toSerialize, originalValue, referenceds);
    final Object unserialized = unserializedAndPersistInfo.getObject();
    if (testEquals) {
      assertEquals("read and wrote must have the same value",
          toSerialize, unserialized);
    }
    assertUnserialized(unserialized);

    // check modification
    referenceds = modifyObjectToSerialize(unserialized);
    // write
    writeResult = write(unserialized, classInfo);
    sons = writeResult.getSons();
    unserializedAndPersistInfo = writeResult.getObjectAndPersistInfo();
    // check sons wrote
    assertSons(toSerialize, sons, referenceds);
    originalValue = unserializedAndPersistInfo.originalValue;
    assertSons(toSerialize, originalValue, referenceds);

    // modify wrote object
    referenceds = modifyObjectToSerialize(toSerialize);
    // write modification
    writeResult = write(toSerialize, classInfo);
    sons = writeResult.getSons();
    objectAndPersistInfo = writeResult.getObjectAndPersistInfo();
    // check sons wrote
    assertSons(toSerialize, sons, referenceds);
    originalValue = objectAndPersistInfo.originalValue;
    assertSons(toSerialize, originalValue, referenceds);

View Full Code Here

Examples of org.glassfish.grizzly.WriteResult

                record.notifyCompleteAndRecycle();
                written += EMPTY_RECORD_SPACE_VALUE;
                continue;
            }

            final WriteResult firstResult = record.getCurrentResult();
            final Buffer firstMessage = record.getMessage();
            final long firstMessageRemaining =
                    record.getInitialMessageSize() - firstResult.getWrittenSize();

            if (remainder >= firstMessageRemaining) {
                remainder -= firstMessageRemaining;
                queue.removeFirst();
                firstResult.setWrittenSize(record.getInitialMessageSize());
                firstMessage.position(firstMessage.limit());
               
                ((TCPNIOConnection) connection).onWrite(firstMessage, firstMessageRemaining);
                               
                record.notifyCompleteAndRecycle();
            } else {
                firstMessage.position(firstMessage.position() + remainder);
                firstResult.setWrittenSize(
                        firstResult.getWrittenSize() + remainder);
               
                ((TCPNIOConnection) connection).onWrite(firstMessage, remainder);
                return written;
            }
        }
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.