com.bagri.server.hazelcast.task.node.NodeCreator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bagri-server-hazelcast Show documentation
Show all versions of bagri-server-hazelcast Show documentation
Bagri DB Cache: Hazelcast implementation
The newest version!
package com.bagri.server.hazelcast.task.node;
import static com.bagri.server.hazelcast.serialize.TaskSerializationFactory.cli_CreateNodeTask;
import java.io.IOException;
import java.util.Date;
import java.util.Properties;
import java.util.Map.Entry;
import com.bagri.core.system.Node;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
public class NodeCreator extends NodeProcessor implements IdentifiedDataSerializable {
private String name;
private Properties options;
public NodeCreator() {
//
}
public NodeCreator(String admin, String name, Properties options) {
super(1, admin);
this.name = name;
this.options = options;
}
@Override
public Object process(Entry entry) {
logger.debug("process.enter; entry: {}", entry);
if (entry.getValue() == null) {
String nodeId = entry.getKey();
Node node = new Node(getVersion(), new Date(), getAdmin(), name, options);
entry.setValue(node);
auditEntity(AuditType.create, node);
return node;
}
return null;
}
@Override
public int getId() {
return cli_CreateNodeTask;
}
@Override
public void readData(ObjectDataInput in) throws IOException {
super.readData(in);
name = in.readUTF();
options = in.readObject();
}
@Override
public void writeData(ObjectDataOutput out) throws IOException {
super.writeData(out);
out.writeUTF(name);
out.writeObject(options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy