com.hazelcast.nio.ObjectDataInput Java Examples

The following examples show how to use com.hazelcast.nio.ObjectDataInput. 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: Session.java    From lannister with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #2
Source File: LogicalNodeTable.java    From snowcast with Apache License 2.0 6 votes vote down vote up
@Nonnull
static LogicalNodeTable readLogicalNodeTable(@Nonnegative int partitionId, @Nonnull ObjectDataInput in)
        throws IOException {

    SequencerDefinition definition = in.readObject();
    short size = in.readShort();

    Object[] assignmentTable = new Object[definition.getBoundedMaxLogicalNodeCount()];
    for (int i = 0; i < size; i++) {
        short index = in.readShort();
        Address address = new Address();
        address.readData(in);
        assignmentTable[index] = address;
    }
    return new LogicalNodeTable(partitionId, definition, assignmentTable);
}
 
Example #3
Source File: UpdateSegmentsTask.java    From lumongo with Apache License 2.0 6 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
	hazelcastPort = in.readInt();
	indexName = in.readUTF();
	newMemberToSegmentMap = new HashMap<>();
	int count = in.readInt();

	for (int i = 0; i < count; i++) {
		MemberImpl mi = new MemberImpl();
		mi.readData(in);
		Set<Integer> segments = new HashSet<>();
		int segCount = in.readInt();
		for (int j = 0; j < segCount; j++) {
			segments.add(in.readInt());
		}
		newMemberToSegmentMap.put(mi, segments);
	}

}
 
Example #4
Source File: MapOperationCounter.java    From hazelcast-simulator with Apache License 2.0 6 votes vote down vote up
public void readData(ObjectDataInput in) throws IOException {
    putCount = in.readObject();
    putAsyncCount = in.readObject();

    putTTLCount = in.readObject();
    putAsyncTTLCount = in.readObject();

    putTransientCount = in.readObject();
    putIfAbsentCount = in.readObject();

    replaceCount = in.readObject();

    getCount = in.readObject();
    getAsyncCount = in.readObject();

    removeCount = in.readObject();
    removeAsyncCount = in.readObject();

    deleteCount = in.readObject();
    destroyCount = in.readObject();
}
 
Example #5
Source File: Client.java    From light-oauth2 with Apache License 2.0 6 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
  this.clientId = in.readUTF();
  this.clientSecret = in.readUTF();
  this.clientType = Client.ClientTypeEnum.fromValue(in.readUTF());
  this.clientProfile = Client.ClientProfileEnum.fromValue(in.readUTF());
  this.clientName = in.readUTF();
  this.clientDesc = in.readUTF();
  this.ownerId = in.readUTF();
  this.host = in.readUTF();
  this.scope = in.readUTF();
  this.customClaim = in.readUTF();
  this.redirectUri = in.readUTF();
  this.authenticateClass = in.readUTF();
  this.derefClientId = in.readUTF();
}
 
Example #6
Source File: BackupAttachLogicalNodeOperation.java    From snowcast with Apache License 2.0 6 votes vote down vote up
@Override
protected void readInternal(ObjectDataInput in)
        throws IOException {

    super.readInternal(in);
    logicalNodeId = in.readInt();
    address = new Address();
    address.readData(in);

    long epochOffset = in.readLong();
    int maxLogicalNodeCount = in.readInt();
    short backupCount = in.readShort();

    SnowcastEpoch epoch = SnowcastEpoch.byTimestamp(epochOffset);
    definition = new SequencerDefinition(getSequencerName(), epoch, maxLogicalNodeCount, backupCount);
}
 
Example #7
Source File: BackupDetachLogicalNodeOperation.java    From snowcast with Apache License 2.0 6 votes vote down vote up
@Override
protected void readInternal(ObjectDataInput in)
        throws IOException {

    super.readInternal(in);
    logicalNodeId = in.readInt();
    address = new Address();
    address.readData(in);

    long epochOffset = in.readLong();
    int maxLogicalNodeCount = in.readInt();
    short backupCount = in.readShort();

    SnowcastEpoch epoch = SnowcastEpoch.byTimestamp(epochOffset);
    definition = new SequencerDefinition(getSequencerName(), epoch, maxLogicalNodeCount, backupCount);
}
 
Example #8
Source File: RefreshToken.java    From light-oauth2 with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
  this.refreshToken = in.readUTF();
  this.userId = in.readUTF();
  this.userType = in.readUTF();
  this.roles = in.readUTF();
  this.clientId = in.readUTF();
  this.scope = in.readUTF();
  this.remember = in.readUTF();
}
 
Example #9
Source File: WorkUnit.java    From telekom-workflow-engine with MIT License 5 votes vote down vote up
@Override
public void readData( ObjectDataInput objectDataInput ) throws IOException{
    woinRefNum = objectDataInput.readLong();
    type = WorkType.valueOf( objectDataInput.readUTF() );
    woitRefNum = objectDataInput.readLong();
    if( woitRefNum == 0 ){
        woitRefNum = null;
    }
}
 
Example #10
Source File: RemoteCommandSerialiser.java    From concursus with MIT License 5 votes vote down vote up
@Override
public RemoteCommand read(ObjectDataInput objectDataInput) throws IOException {
    String commandJson = objectDataInput.readUTF();
    return CommandJson.fromString(commandJson, commandTypeMatcher, objectMapper)
            .map(RemoteCommand::processing)
            .orElseThrow(() -> new IllegalArgumentException("No command type matcher found for command " + commandJson));
}
 
Example #11
Source File: EntryListenerImpl.java    From hazelcast-simulator with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
    addCount = in.readObject();
    removeCount = in.readObject();
    updateCount = in.readObject();
    evictCount = in.readObject();

    minDelayMs = in.readInt();
    maxDelayMs = in.readInt();
}
 
Example #12
Source File: CreateSequencerDefinitionOperation.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Override
protected void readInternal(ObjectDataInput in)
        throws IOException {

    super.readInternal(in);

    long epochOffset = in.readLong();
    int maxLogicalNodeCount = in.readInt();
    short backupCount = in.readShort();

    SnowcastEpoch epoch = SnowcastEpoch.byTimestamp(epochOffset);
    definition = new SequencerDefinition(getSequencerName(), epoch, maxLogicalNodeCount, backupCount);
}
 
Example #13
Source File: Message.java    From lannister with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
	id = in.readInt();
	topicName = in.readUTF();
	publisherId = in.readUTF();
	message = in.readByteArray();

	int rawInt = in.readInt();
	qos = rawInt != Byte.MIN_VALUE ? MqttQoS.valueOf(rawInt) : null;

	isRetain = in.readBoolean();
}
 
Example #14
Source File: CarSerializer.java    From code-examples with MIT License 5 votes vote down vote up
@Override
public Car read(ObjectDataInput in) throws IOException {
    return Car.builder()
            .name(in.readUTF())
            .number(in.readUTF())
            .build();
}
 
Example #15
Source File: DataSerializableDomainObject.java    From hazelcast-simulator with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
    key = in.readUTF();
    stringVal = in.readUTF();
    doubleVal = in.readDouble();
    longVal = in.readLong();
    intVal = in.readInt();
}
 
Example #16
Source File: Provider.java    From light-oauth2 with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
  this.providerId = in.readUTF();
  this.serverUrl = in.readUTF();
  this.uri = in.readUTF();
  this.providerName = in.readUTF();
}
 
Example #17
Source File: Service.java    From light-oauth2 with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
  this.serviceId = in.readUTF();
  this.serviceType = Service.ServiceTypeEnum.fromValue(in.readUTF());
  this.serviceName = in.readUTF();
  this.serviceDesc = in.readUTF();
  this.ownerId = in.readUTF();
  this.host = in.readUTF();
  this.scope = in.readUTF();
}
 
Example #18
Source File: InboundMessageStatus.java    From lannister with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
	super.readData(in);

	byte rawByte = in.readByte();
	status = rawByte != Byte.MIN_VALUE ? Status.valueOf(rawByte) : null;
}
 
Example #19
Source File: BackupCreateSequencerDefinitionOperation.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Override
protected void readInternal(ObjectDataInput in)
        throws IOException {

    super.readInternal(in);

    long epochOffset = in.readLong();
    int maxLogicalNodeCount = in.readInt();
    short backupCount = in.readShort();

    SnowcastEpoch epoch = SnowcastEpoch.byTimestamp(epochOffset);
    definition = new SequencerDefinition(getSequencerName(), epoch, maxLogicalNodeCount, backupCount);
}
 
Example #20
Source File: TopicSubscription.java    From lannister with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput in) throws IOException {
	clientId = in.readUTF();
	topicFilter = in.readUTF();

	int rawInt = in.readInt();
	qos = rawInt != Integer.MIN_VALUE ? MqttQoS.valueOf(rawInt) : null;
}
 
Example #21
Source File: SequencerReplicationOperation.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Override
protected void readInternal(ObjectDataInput in)
        throws IOException {

    super.readInternal(in);
    partitionReplication = in.readObject();
}
 
Example #22
Source File: AttachLogicalNodeOperation.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Override
protected void readInternal(ObjectDataInput in)
        throws IOException {

    super.readInternal(in);

    long epochOffset = in.readLong();
    int maxLogicalNodeCount = in.readInt();
    short backupCount = in.readShort();

    SnowcastEpoch epoch = SnowcastEpoch.byTimestamp(epochOffset);
    definition = new SequencerDefinition(getSequencerName(), epoch, maxLogicalNodeCount, backupCount);
}
 
Example #23
Source File: AbstractSequencerOperation.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Override
protected void readInternal(ObjectDataInput in)
        throws IOException {

    super.readInternal(in);
    sequencerName = in.readUTF();
}
 
Example #24
Source File: PredicateOperationCounter.java    From hazelcast-simulator with Apache License 2.0 5 votes vote down vote up
public void readData(ObjectDataInput in) throws IOException {
    predicateBuilderCount = in.readLong();
    sqlStringCount = in.readLong();
    pagePredicateCount = in.readLong();
    updateEmployeeCount = in.readLong();
    destroyCount = in.readLong();
}
 
Example #25
Source File: DetachLogicalNodeOperation.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Override
protected void readInternal(ObjectDataInput in)
        throws IOException {

    super.readInternal(in);
    logicalNodeId = in.readInt();

    long epochOffset = in.readLong();
    int maxLogicalNodeCount = in.readInt();
    short backupCount = in.readShort();

    SnowcastEpoch epoch = SnowcastEpoch.byTimestamp(epochOffset);
    definition = new SequencerDefinition(getSequencerName(), epoch, maxLogicalNodeCount, backupCount);
}
 
Example #26
Source File: PartitionReplication.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(@Nonnull ObjectDataInput in)
        throws IOException {

    partitionId = in.readInt();
    int size = in.readInt();
    logicalNodeTables = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        LogicalNodeTable logicalNodeTable = LogicalNodeTable.readLogicalNodeTable(partitionId, in);
        logicalNodeTables.add(logicalNodeTable);
    }
}
 
Example #27
Source File: DataSerializer.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object read(ObjectDataInput objectDataInput) throws IOException {
    Kryo kryo = new Kryo();
    byte [] buffer = objectDataInput.readByteArray();

    Input input = new Input(buffer);

    Object data = kryo.readClassAndObject(input);

    return data;
}
 
Example #28
Source File: SequencerDefinitionSerializerHook.java    From snowcast with Apache License 2.0 5 votes vote down vote up
@Override
public SequencerDefinition read(@Nonnull ObjectDataInput in)
        throws IOException {

    String sequencerName = in.readUTF();
    long epochOffset = in.readLong();
    int maxLogicalNodeCount = in.readInt();
    short backupCount = in.readShort();

    SnowcastEpoch epoch = SnowcastEpoch.byTimestamp(epochOffset);
    return new SequencerDefinition(sequencerName, epoch, maxLogicalNodeCount, backupCount);
}
 
Example #29
Source File: ConversionUtils.java    From vertx-hazelcast with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput objectDataInput) throws IOException {
  String className = objectDataInput.readUTF();
  int length = objectDataInput.readInt();
  byte[] bytes = new byte[length];
  objectDataInput.readFully(bytes);
  try {
    Class<?> clazz = loadClass(className);
    clusterSerializable = (ClusterSerializable) clazz.newInstance();
    clusterSerializable.readFromBuffer(0, Buffer.buffer(bytes));
  } catch (Exception e) {
    throw new IOException("Failed to load class " + className, e);
  }
}
 
Example #30
Source File: HazelcastNodeInfo.java    From vertx-hazelcast with Apache License 2.0 5 votes vote down vote up
@Override
public void readData(ObjectDataInput dataInput) throws IOException {
  String host = dataInput.readUTF();
  int port = dataInput.readInt();
  byte[] bytes = dataInput.readByteArray();
  nodeInfo = new NodeInfo(host, port, bytes != null ? new JsonObject(Buffer.buffer(bytes)) : null);
}