use of org.neo4j.com.TxExtractor in project graphdb by neo4j-attic.
the class SlaveTxIdGenerator method generate.
public long generate(final XaDataSource dataSource, final int identifier) {
try {
final int eventIdentifier = txManager.getEventIdentifier();
Response<Long> response = broker.getMaster().first().commitSingleResourceTransaction(receiver.getSlaveContext(eventIdentifier), dataSource.getName(), new TxExtractor() {
public void extract(LogBuffer buffer) {
try {
dataSource.getPreparedTransaction(identifier, buffer);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public ReadableByteChannel extract() {
try {
return dataSource.getPreparedTransaction(identifier);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
return receiver.receive(response);
} catch (ZooKeeperException e) {
receiver.newMaster(null, e);
throw e;
} catch (ComException e) {
receiver.newMaster(null, e);
throw e;
}
}
Aggregations