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


Java ObjectDataOutput类代码示例

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


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

示例1: writeData

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
@Override
public void writeData(ObjectDataOutput out) throws IOException {
	out.writeUTF(clientId);
	out.writeUTF(ip);
	out.writeInt(port);
	out.writeBoolean(isConnected);
	out.writeInt(currentMessageId);

	out.writeBoolean(will != null);
	if (will != null) {
		will.writeData(out);
	}

	out.writeBoolean(cleanSession);
	out.writeInt(keepAliveSeconds);
	out.writeLong(createTime != null ? createTime.getTime() : Long.MIN_VALUE);
	out.writeLong(lastIncomingTime != null ? lastIncomingTime.getTime() : Long.MIN_VALUE);
}
 
开发者ID:anyflow,项目名称:lannister,代码行数:19,代码来源:Session.java

示例2: writeData

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
@Override
public void writeData(ObjectDataOutput out) throws IOException {
  try {
    //out.writeDouble(getIterationError());
    //out.writeDouble(getMeanAbsErr());
    //out.writeDouble(getRootMeanSqErr());
    //out.writeDouble(getPctIncorrect());
    //out.writeInt(getFolds());
    out.writeUTF(getName());
    out.writeUTF(classifierImpl);
    out.writeUTF(serializeClassifierAsJson());
    out.writeLong(murmurHash);
    out.writeUTF(md5Hex);
    out.writeLong(getGeneratedOn());
  } catch (Exception e) {
    throw new IOException(e);
  }
  
}
 
开发者ID:javanotes,项目名称:reactive-data,代码行数:20,代码来源:RegressionModel.java

示例3: write

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
@Override
public void write(final ObjectDataOutput out, final CacheEntry object)
        throws IOException {

    try {
        out.writeBoolean(object.isReferenceEntry());
        if (object.isReferenceEntry()) {
            // Reference entries are not disassembled. Instead, to be serialized, they rely entirely on
            // the entity itself being Serializable. This is not a common thing (Hibernate is currently
            // very restrictive about what can be cached by reference), so it may not be worth dealing
            // with at all. This is just a naive implementation relying on the entity's serialization.
            writeReference(out, object);
        } else {
            writeDisassembled(out, object);
        }
    } catch (Exception e) {
        throw rethrow(e);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate5,代码行数:20,代码来源:Hibernate51CacheEntrySerializer.java

示例4: write

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
@Override
public void write(ObjectDataOutput out, CacheKey object)
        throws IOException {

    try {
        Object key = UNSAFE.getObject(object, KEY_OFFSET);
        Type type = (Type) UNSAFE.getObject(object, TYPE_OFFSET);
        String entityOrRoleName = (String) UNSAFE.getObject(object, ENTITY_OR_ROLE_NAME_OFFSET);
        String tenantId = (String) UNSAFE.getObject(object, TENANT_ID_OFFSET);
        int hashCode = UNSAFE.getInt(object, HASH_CODE_OFFSET);

        out.writeObject(key);
        out.writeObject(type);
        out.writeUTF(entityOrRoleName);
        out.writeUTF(tenantId);
        out.writeInt(hashCode);

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

示例5: write

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
@Override
public void write(ObjectDataOutput out, CacheEntry object)
        throws IOException {

    try {
        Serializable[] disassembledState = (Serializable[]) UNSAFE.getObject(object, DISASSEMBLED_STATE_OFFSET);
        String subclass = (String) UNSAFE.getObject(object, SUBCLASS_OFFSET);
        boolean lazyPropertiesAreUnfetched = UNSAFE.getBoolean(object, LAZY_PROPERTIES_ARE_UNFETCHED);
        Object version = UNSAFE.getObject(object, VERSION_OFFSET);

        out.writeInt(disassembledState.length);
        for (Serializable state : disassembledState) {
            out.writeObject(state);
        }
        out.writeUTF(subclass);
        out.writeBoolean(lazyPropertiesAreUnfetched);
        out.writeObject(version);

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

示例6: write

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
@Override
public void write(ObjectDataOutput out, CacheEntry object)
        throws IOException {

    try {
        out.writeBoolean(object.isReferenceEntry());
        if (object.isReferenceEntry()) {
            // Reference entries are not disassembled. Instead, to be serialized, they rely entirely on
            // the entity itself being Serializable. This is not a common thing (Hibernate is currently
            // very restrictive about what can be cached by reference), so it may not be worth dealing
            // with at all. This is just a naive implementation relying on the entity's serialization.
            writeReference(out, object);
        } else {
            writeDisassembled(out, object);
        }
    } catch (Exception e) {
        throw rethrow(e);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-hibernate,代码行数:20,代码来源:Hibernate42CacheEntrySerializer.java

示例7: write

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
@Override
public void write(ObjectDataOutput out, CacheKey object)
        throws IOException {

    try {
        Object key = UNSAFE.getObject(object, KEY_OFFSET);
        Type type = (Type) UNSAFE.getObject(object, TYPE_OFFSET);
        String entityOrRoleName = (String) UNSAFE.getObject(object, ENTITY_OR_ROLE_NAME_OFFSET);
        EntityMode entityMode = (EntityMode) UNSAFE.getObject(object, ENTITY_MODE_OFFSET);
        int hashCode = UNSAFE.getInt(object, HASH_CODE_OFFSET);

        out.writeObject(key);
        out.writeObject(type);
        out.writeUTF(entityOrRoleName);
        out.writeUTF(entityMode.toString());
        out.writeInt(hashCode);

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

示例8: createSerializer

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的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.ObjectDataOutput; //导入依赖的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.ObjectDataOutput; //导入依赖的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: createFlowControlPacket

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
private byte[] createFlowControlPacket(Address member) throws IOException {
    final ObjectDataOutput out = createObjectDataOutput(nodeEngine);
    final boolean[] hasData = {false};
    Map<Long, ExecutionContext> executionContexts = jobExecutionService.getExecutionContexts();
    out.writeInt(executionContexts.size());
    executionContexts.forEach((execId, exeCtx) -> uncheckRun(() -> {
        if (!exeCtx.hasParticipant(member)) {
            return;
        }
        out.writeLong(execId);
        out.writeInt(exeCtx.receiverMap().values().stream().mapToInt(Map::size).sum());
        exeCtx.receiverMap().forEach((vertexId, ordinalToSenderToTasklet) ->
                ordinalToSenderToTasklet.forEach((ordinal, senderToTasklet) -> uncheckRun(() -> {
                    out.writeInt(vertexId);
                    out.writeInt(ordinal);
                    out.writeInt(senderToTasklet.get(member).updateAndGetSendSeqLimitCompressed());
                    hasData[0] = true;
                })));
    }));
    return hasData[0] ? out.toByteArray() : EMPTY_BYTES;
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:22,代码来源:Networking.java

示例12: createSerializer

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的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

示例13: createSerializer

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的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

示例14: writeData

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
@Test
public void writeData() throws IOException {
    // Given
    DistributedIntSummaryStatistics stats = new DistributedIntSummaryStatistics();
    stats.accept(1);
    stats.accept(3);
    ObjectDataOutput out = mock(ObjectDataOutput.class);

    // When
    stats.writeData(out);

    // Then
    verify(out).writeLong(stats.getCount());
    verify(out).writeLong(stats.getSum());
    verify(out).writeInt(stats.getMin());
    verify(out).writeInt(stats.getMax());
    verifyNoMoreInteractions(out);
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:19,代码来源:DistributedIntSummaryStatisticsTest.java

示例15: writeData

import com.hazelcast.nio.ObjectDataOutput; //导入依赖的package包/类
@Test
public void writeData() throws IOException {
    // Given
    DistributedLongSummaryStatistics stats = new DistributedLongSummaryStatistics();
    stats.accept(1);
    stats.accept(3);
    ObjectDataOutput out = mock(ObjectDataOutput.class);

    // When
    stats.writeData(out);

    // Then
    verify(out).writeLong(stats.getCount());
    verify(out).writeLong(stats.getSum());
    verify(out).writeLong(stats.getMin());
    verify(out).writeLong(stats.getMax());
    verifyNoMoreInteractions(out);
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:19,代码来源:DistributedLongSummaryStatisticsTest.java


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