Java Code Examples for com.alibaba.otter.canal.common.utils.JsonUtils#unmarshalFromByte()
The following examples show how to use
com.alibaba.otter.canal.common.utils.JsonUtils#unmarshalFromByte() .
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: ZooKeeperMetaManager.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
public Position getCursor(ClientIdentity clientIdentity) throws CanalMetaManagerException { String path = ZookeeperPathUtils.getCursorPath(clientIdentity.getDestination(), clientIdentity.getClientId()); byte[] data = zkClientx.readData(path, true); if (data == null || data.length == 0) { return null; } return JsonUtils.unmarshalFromByte(data, Position.class); }
Example 2
Source File: ZooKeeperMetaManager.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
public PositionRange getBatch(ClientIdentity clientIdentity, Long batchId) throws CanalMetaManagerException { String path = ZookeeperPathUtils .getBatchMarkWithIdPath(clientIdentity.getDestination(), clientIdentity.getClientId(), batchId); byte[] data = zkClientx.readData(path, true); if (data == null) { return null; } PositionRange positionRange = JsonUtils.unmarshalFromByte(data, PositionRange.class); return positionRange; }
Example 3
Source File: ClusterNodeAccessStrategy.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
private void initRunning(Object data) { if (data == null) { return; } ServerRunningData runningData = JsonUtils.unmarshalFromByte((byte[]) data, ServerRunningData.class); String[] strs = StringUtils.split(runningData.getAddress(), ':'); if (strs.length == 2) { runningAddress = new InetSocketAddress(strs[0], Integer.valueOf(strs[1])); } }
Example 4
Source File: ZooKeeperLogPositionManager.java From canal-1.1.3 with Apache License 2.0 | 5 votes |
@Override public LogPosition getLatestIndexBy(String destination) { String path = ZookeeperPathUtils.getParsePath(destination); byte[] data = zkClientx.readData(path, true); if (data == null || data.length == 0) { return null; } return JsonUtils.unmarshalFromByte(data, LogPosition.class); }
Example 5
Source File: ZooKeeperMetaManager.java From canal with Apache License 2.0 | 5 votes |
public Position getCursor(ClientIdentity clientIdentity) throws CanalMetaManagerException { String path = ZookeeperPathUtils.getCursorPath(clientIdentity.getDestination(), clientIdentity.getClientId()); byte[] data = zkClientx.readData(path, true); if (data == null || data.length == 0) { return null; } return JsonUtils.unmarshalFromByte(data, Position.class); }
Example 6
Source File: ZooKeeperMetaManager.java From canal with Apache License 2.0 | 5 votes |
public PositionRange getBatch(ClientIdentity clientIdentity, Long batchId) throws CanalMetaManagerException { String path = ZookeeperPathUtils .getBatchMarkWithIdPath(clientIdentity.getDestination(), clientIdentity.getClientId(), batchId); byte[] data = zkClientx.readData(path, true); if (data == null) { return null; } PositionRange positionRange = JsonUtils.unmarshalFromByte(data, PositionRange.class); return positionRange; }
Example 7
Source File: ClusterNodeAccessStrategy.java From canal with Apache License 2.0 | 5 votes |
private void initRunning(Object data) { if (data == null) { return; } ServerRunningData runningData = JsonUtils.unmarshalFromByte((byte[]) data, ServerRunningData.class); String[] strs = StringUtils.split(runningData.getAddress(), ':'); if (strs.length == 2) { runningAddress = new InetSocketAddress(strs[0], Integer.valueOf(strs[1])); } }
Example 8
Source File: ZooKeeperLogPositionManager.java From canal with Apache License 2.0 | 5 votes |
@Override public LogPosition getLatestIndexBy(String destination) { String path = ZookeeperPathUtils.getParsePath(destination); byte[] data = zkClientx.readData(path, true); if (data == null || data.length == 0) { return null; } return JsonUtils.unmarshalFromByte(data, LogPosition.class); }