当前位置: 首页>>代码示例>>Java>>正文


Java ObjectDataInput类代码示例

本文整理汇总了Java中com.hazelcast.nio.ObjectDataInput的典型用法代码示例。如果您正苦于以下问题:Java ObjectDataInput类的具体用法?Java ObjectDataInput怎么用?Java ObjectDataInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ObjectDataInput类属于com.hazelcast.nio包,在下文中一共展示了ObjectDataInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
   @Override
   public MutableRepositoryItemExt read(ObjectDataInput in) throws IOException {
try {
    
    String gsonString = in.readUTF();  
    System.out.println("MutableRepositoryItemExtHazelcastSerializer deserialize " + System.currentTimeMillis() + " "  + gsonString);
	  
    Gson gson = new GsonBuilder().enableComplexMapKeySerialization().create();
 	    Map<String, Object> cache = gson.fromJson(gsonString, Map.class);

    String javaClassName = (String) cache.get("__class");
    String repositoryId = (String) cache.get("__repositoryId");
  
    Class beanClass = Class.forName(javaClassName);
    MutableRepositoryItemExt mutableRepositoryItemExt = ConstructorUtils.invokeExactConstructor(beanClass, null);
    mutableRepositoryItemExt.setRepositoryId(repositoryId);
    mutableRepositoryItemExt.setCachedData(cache);

    return mutableRepositoryItemExt;
} catch (Exception e) {
    throw new RuntimeException(e);
}
   }
 
开发者ID:varelma,项目名称:atg-generics,代码行数:25,代码来源:MutableRepositoryItemExtHazelcastSerializer.java

示例2: readData

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public void readData(ObjectDataInput in) throws IOException {
	clientId = in.readUTF();
	ip = in.readUTF();
	port = in.readInt();
	isConnected = in.readBoolean();
	currentMessageId = in.readInt();

	if (in.readBoolean()) {
		will = new Message(in);
	}

	cleanSession = in.readBoolean();
	keepAliveSeconds = in.readInt();

	long rawLong = in.readLong();
	createTime = rawLong != Long.MIN_VALUE ? new Date(rawLong) : null;

	rawLong = in.readLong();
	lastIncomingTime = rawLong != Long.MIN_VALUE ? new Date(rawLong) : null;

	disposeLock = ClusterDataFactory.INSTANCE.createLock("Session_disposeLock_" + clientId);
	messageSender = new MessageSender(this);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:25,代码来源:Session.java

示例3: readData

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public void readData(ObjectDataInput in) throws IOException {
  
  try 
  {
    //setIterationError(in.readDouble());
    //setMeanAbsErr(in.readDouble());
    //setRootMeanSqErr(in.readDouble());
    //setPctIncorrect(in.readDouble());
    //setFolds(in.readInt());
    setName(in.readUTF());
    classifierImpl = in.readUTF();
    deserializeClassifierFromJson(in.readUTF());
    setLongId(in.readLong());
    setStringId(in.readUTF());
    setGeneratedOn(in.readLong());
  } catch (Exception e) {
    throw new IOException(e);
  }
}
 
开发者ID:javanotes,项目名称:reactive-data,代码行数:21,代码来源:RegressionModel.java

示例4: read

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public CacheKey read(ObjectDataInput in)
        throws IOException {

    try {
        Object key = in.readObject();
        Type type = in.readObject();
        String entityOrRoleName = in.readUTF();
        String tenantId = in.readUTF();
        int hashCode = in.readInt();

        CacheKey cacheKey = (CacheKey) UNSAFE.allocateInstance(CacheKey.class);
        UNSAFE.putObjectVolatile(cacheKey, KEY_OFFSET, key);
        UNSAFE.putObjectVolatile(cacheKey, TYPE_OFFSET, type);
        UNSAFE.putObjectVolatile(cacheKey, ENTITY_OR_ROLE_NAME_OFFSET, entityOrRoleName);
        UNSAFE.putObjectVolatile(cacheKey, TENANT_ID_OFFSET, tenantId);
        UNSAFE.putIntVolatile(cacheKey, HASH_CODE_OFFSET, hashCode);
        return cacheKey;

    } catch (Exception e) {
        if (e instanceof IOException) {
            throw (IOException) e;
        }
        throw new IOException(e);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:27,代码来源:Hibernate4CacheKeySerializer.java

示例5: read

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public CacheEntry read(ObjectDataInput in)
        throws IOException {

    try {
        int length = in.readInt();
        Serializable[] disassembledState = new Serializable[length];
        for (int i = 0; i < length; i++) {
            disassembledState[i] = in.readObject();
        }
        String subclass = in.readUTF();
        boolean lazyPropertiesAreUnfetched = in.readBoolean();
        Object version = in.readObject();

        return CACHE_ENTRY_CONSTRUCTOR.newInstance(disassembledState, subclass, lazyPropertiesAreUnfetched, version);

    } catch (Exception e) {
        if (e instanceof IOException) {
            throw (IOException) e;
        }
        throw new IOException(e);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:24,代码来源:Hibernate41CacheEntrySerializer.java

示例6: read

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public CacheKey read(ObjectDataInput in)
        throws IOException {

    try {
        Object key = in.readObject();
        Type type = in.readObject();
        String entityOrRoleName = in.readUTF();
        EntityMode entityMode = EntityMode.parse(in.readUTF());
        int hashCode = in.readInt();

        CacheKey cacheKey = (CacheKey) UNSAFE.allocateInstance(CacheKey.class);
        UNSAFE.putObjectVolatile(cacheKey, KEY_OFFSET, key);
        UNSAFE.putObjectVolatile(cacheKey, TYPE_OFFSET, type);
        UNSAFE.putObjectVolatile(cacheKey, ENTITY_OR_ROLE_NAME_OFFSET, entityOrRoleName);
        UNSAFE.putObjectVolatile(cacheKey, ENTITY_MODE_OFFSET, entityMode);
        UNSAFE.putIntVolatile(cacheKey, HASH_CODE_OFFSET, hashCode);
        return cacheKey;

    } catch (Exception e) {
        if (e instanceof IOException) {
            throw (IOException) e;
        }
        throw new IOException(e);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:27,代码来源:Hibernate3CacheKeySerializer.java

示例7: readData

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public void readData(ObjectDataInput objectDataInput) throws IOException {
    this.creationTime = objectDataInput.readLong();
    this.lastAccessedTime = objectDataInput.readLong();
    this.maxInactiveInterval = objectDataInput.readInt();
    this.isNew = objectDataInput.readBoolean();
    this.isValid = objectDataInput.readBoolean();
    this.thisAccessedTime = objectDataInput.readLong();
    this.id = objectDataInput.readObject();

    setAttributes(deserializeMap(objectDataInput, true));

    this.notes = deserializeMap(objectDataInput, false);

    if (this.listeners == null) {
        this.listeners = new ArrayList();
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-tomcat-sessionmanager,代码行数:19,代码来源:HazelcastSession.java

示例8: createSerializer

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<LongAccumulator>() {
        @Override
        public int getTypeId() {
            return SerializerHookConstants.LONG_ACC;
        }

        @Override
        public void destroy() {

        }

        @Override
        public void write(ObjectDataOutput out, LongAccumulator object) throws IOException {
            out.writeLong(object.get());
        }

        @Override
        public LongAccumulator read(ObjectDataInput in) throws IOException {
            return new LongAccumulator(in.readLong());
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:25,代码来源:AccumulatorSerializerHooks.java

示例9: createSerializer

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<Tuple2>() {
        @Override
        public void write(ObjectDataOutput out, Tuple2 t) throws IOException {
            out.writeObject(t.f0());
            out.writeObject(t.f1());
        }

        @Override
        public Tuple2 read(ObjectDataInput in) throws IOException {
            return tuple2(in.readObject(), in.readObject());
        }

        @Override
        public int getTypeId() {
            return SerializerHookConstants.TUPLE2;
        }

        @Override
        public void destroy() {
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:25,代码来源:DataModelSerializerHooks.java

示例10: createSerializer

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<Entry>() {
        @Override
        public int getTypeId() {
            return SerializerHookConstants.MAP_ENTRY;
        }

        @Override
        public void write(ObjectDataOutput out, Entry object) throws IOException {
            out.writeObject(object.getKey());
            out.writeObject(object.getValue());
        }

        @Override
        public Entry read(ObjectDataInput in) throws IOException {
            return entry(in.readObject(), in.readObject());
        }

        @Override
        public void destroy() {
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:25,代码来源:MapEntryHook.java

示例11: readInternal

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
    super.readInternal(in);

    jobId = in.readLong();
    executionId = in.readLong();
    coordinatorMemberListVersion = in.readInt();
    int count = in.readInt();
    participants = new HashSet<>();
    for (int i = 0; i < count; i++) {
        MemberInfo participant = new MemberInfo();
        participant.readData(in);
        participants.add(participant);
    }

    final Data planBlob = in.readData();
    planSupplier = () -> {
        JetService service = getService();
        ClassLoader cl = service.getClassLoader(jobId);
        return deserializeWithCustomClassLoader(getNodeEngine().getSerializationService(), cl, planBlob);
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:23,代码来源:InitExecutionOperation.java

示例12: readData

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public void readData(ObjectDataInput in) throws IOException {
    size = in.readInt();
    if (size > starts.length) {
        // round to next power of 2
        @SuppressWarnings("checkstyle:magicnumber")
        int newSize = 1 << (32 - Integer.numberOfLeadingZeros(size - 1));
        starts = new long[newSize];
        ends = new long[newSize];
        accs = (A[]) new Object[newSize];
    }

    for (int i = 0; i < size; i++) {
        starts[i] = in.readLong();
        ends[i] = in.readLong();
        accs[i] = in.readObject();
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:19,代码来源:SessionWindowP.java

示例13: createSerializer

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<SnapshotBarrier>() {
        @Override
        public int getTypeId() {
            return SerializerHookConstants.SNAPSHOT_BARRIER;
        }

        @Override
        public void destroy() {
        }

        @Override
        public void write(ObjectDataOutput out, SnapshotBarrier object) throws IOException {
            out.writeLong(object.snapshotId());
        }

        @Override
        public SnapshotBarrier read(ObjectDataInput in) throws IOException {
            return new SnapshotBarrier(in.readLong());
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:24,代码来源:ExecutionSerializerHooks.java

示例14: readData

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public void readData(ObjectDataInput in) throws IOException {
    int vertexCount = in.readInt();

    for (int i = 0; i < vertexCount; i++) {
        String key = in.readObject();
        Vertex value = in.readObject();
        nameToVertex.put(key, value);
    }

    int edgeCount = in.readInt();

    for (int i = 0; i < edgeCount; i++) {
        Edge edge = in.readObject();
        edge.restoreSourceAndDest(nameToVertex);
        edges.add(edge);
    }

    verticesByIdentity.addAll(nameToVertex.values());
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:21,代码来源:DAG.java

示例15: createSerializer

import com.hazelcast.nio.ObjectDataInput; //导入依赖的package包/类
@Override
public Serializer createSerializer() {
    return new StreamSerializer<Watermark>() {
        @Override
        public int getTypeId() {
            return SerializerHookConstants.WATERMARK;
        }

        @Override
        public void destroy() {
        }

        @Override
        public void write(ObjectDataOutput out, Watermark object) throws IOException {
            out.writeLong(object.timestamp());
        }

        @Override
        public Watermark read(ObjectDataInput in) throws IOException {
            return new Watermark(in.readLong());
        }
    };
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:24,代码来源:CoreSerializerHooks.java


注:本文中的com.hazelcast.nio.ObjectDataInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。