本文整理汇总了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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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());
}
};
}
示例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() {
}
};
}
示例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() {
}
};
}
示例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);
};
}
示例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();
}
}
示例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());
}
};
}
示例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());
}
示例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());
}
};
}