Java Code Examples for org.apache.catalina.tribes.io.XByteBuffer#deserialize()

The following examples show how to use org.apache.catalina.tribes.io.XByteBuffer#deserialize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractReplicatedMap.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * apply a diff, or an entire object
 * @param data byte[]
 * @param offset int
 * @param length int
 * @param diff boolean
 * @throws IOException IO error
 * @throws ClassNotFoundException Deserialization error
 */
@SuppressWarnings("unchecked")
public void apply(byte[] data, int offset, int length, boolean diff) throws IOException, ClassNotFoundException {
    if (isDiffable() && diff) {
        ReplicatedMapEntry rentry = (ReplicatedMapEntry) value;
        rentry.lock();
        try {
            rentry.applyDiff(data, offset, length);
        } finally {
            rentry.unlock();
        }
    } else if (length == 0) {
        value = null;
        proxy = true;
    } else {
        value = (V) XByteBuffer.deserialize(data, offset, length);
    }
}
 
Example 2
Source File: AbstractReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * apply a diff, or an entire object
 * @param data byte[]
 * @param offset int
 * @param length int
 * @param diff boolean
 * @throws IOException
 * @throws ClassNotFoundException
 */
@SuppressWarnings("unchecked")
public void apply(byte[] data, int offset, int length, boolean diff) throws IOException, ClassNotFoundException {
    if (isDiffable() && diff) {
        ReplicatedMapEntry rentry = (ReplicatedMapEntry) value;
        rentry.lock();
        try {
            rentry.applyDiff(data, offset, length);
        } finally {
            rentry.unlock();
        }
    } else if (length == 0) {
        value = null;
        proxy = true;
    } else {
        value = (V) XByteBuffer.deserialize(data, offset, length);
    }
}
 
Example 3
Source File: AbstractReplicatedMap.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * apply a diff, or an entire object
 * @param data byte[]
 * @param offset int
 * @param length int
 * @param diff boolean
 * @throws IOException
 * @throws ClassNotFoundException
 */
@SuppressWarnings("unchecked")
public void apply(byte[] data, int offset, int length, boolean diff) throws IOException, ClassNotFoundException {
    if (isDiffable() && diff) {
        ReplicatedMapEntry rentry = (ReplicatedMapEntry) value;
        rentry.lock();
        try {
            rentry.applyDiff(data, offset, length);
        } finally {
            rentry.unlock();
        }
    } else if (length == 0) {
        value = null;
        proxy = true;
    } else {
        value = (V) XByteBuffer.deserialize(data, offset, length);
    }
}
 
Example 4
Source File: AbstractReplicatedMap.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public Serializable key(ClassLoader[] cls) throws IOException, ClassNotFoundException {
    if ( key!=null ) return key;
    if ( keydata == null || keydata.length == 0 ) return null;
    key = XByteBuffer.deserialize(keydata,0,keydata.length,cls);
    keydata = null;
    return key;
}
 
Example 5
Source File: AbstractReplicatedMap.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public Serializable value(ClassLoader[] cls) throws IOException, ClassNotFoundException  {
    if ( value!=null ) return value;
    if ( valuedata == null || valuedata.length == 0 ) return null;
    value = XByteBuffer.deserialize(valuedata,0,valuedata.length,cls);
    valuedata = null;
    return value;
}
 
Example 6
Source File: AbstractReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public Serializable key(ClassLoader[] cls) throws IOException, ClassNotFoundException {
    if ( key!=null ) return key;
    if ( keydata == null || keydata.length == 0 ) return null;
    key = XByteBuffer.deserialize(keydata,0,keydata.length,cls);
    keydata = null;
    return key;
}
 
Example 7
Source File: AbstractReplicatedMap.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public Serializable value(ClassLoader[] cls) throws IOException, ClassNotFoundException  {
    if ( value!=null ) return value;
    if ( valuedata == null || valuedata.length == 0 ) return null;
    value = XByteBuffer.deserialize(valuedata,0,valuedata.length,cls);
    valuedata = null;
    return value;
}
 
Example 8
Source File: AbstractReplicatedMap.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public Serializable key(ClassLoader[] cls) throws IOException, ClassNotFoundException {
    if ( key!=null ) return key;
    if ( keydata == null || keydata.length == 0 ) return null;
    key = XByteBuffer.deserialize(keydata,0,keydata.length,cls);
    keydata = null;
    return key;
}
 
Example 9
Source File: AbstractReplicatedMap.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public Serializable value(ClassLoader[] cls) throws IOException, ClassNotFoundException  {
    if ( value!=null ) return value;
    if ( valuedata == null || valuedata.length == 0 ) return null;
    value = XByteBuffer.deserialize(valuedata,0,valuedata.length,cls);
    valuedata = null;
    return value;
}