Reformat code.

This commit is contained in:
akwizgran
2018-11-01 16:43:35 +00:00
parent e846a13f50
commit 52c778dce3
14 changed files with 91 additions and 89 deletions

View File

@@ -144,8 +144,8 @@ class ClientHelperImpl implements ClientHelper {
@Override
public BdfDictionary getMessageMetadataAsDictionary(MessageId m)
throws DbException, FormatException {
return db.transactionWithResult(true,
txn -> getMessageMetadataAsDictionary(txn, m));
return db.transactionWithResult(true, txn ->
getMessageMetadataAsDictionary(txn, m));
}
@Override
@@ -158,8 +158,8 @@ class ClientHelperImpl implements ClientHelper {
@Override
public Map<MessageId, BdfDictionary> getMessageMetadataAsDictionary(
GroupId g) throws DbException, FormatException {
return db.transactionWithResult(true,
txn -> getMessageMetadataAsDictionary(txn, g));
return db.transactionWithResult(true, txn ->
getMessageMetadataAsDictionary(txn, g));
}
@Override
@@ -176,8 +176,8 @@ class ClientHelperImpl implements ClientHelper {
public Map<MessageId, BdfDictionary> getMessageMetadataAsDictionary(
GroupId g, BdfDictionary query) throws DbException,
FormatException {
return db.transactionWithResult(true,
txn -> getMessageMetadataAsDictionary(txn, g, query));
return db.transactionWithResult(true, txn ->
getMessageMetadataAsDictionary(txn, g, query));
}
@Override

View File

@@ -79,8 +79,8 @@ class ContactManagerImpl implements ContactManager {
public ContactId addContact(Author remote, AuthorId local, SecretKey master,
long timestamp, boolean alice, boolean verified, boolean active)
throws DbException {
return db.transactionWithResult(false,
txn -> addContact(txn, remote, local, master, timestamp, alice,
return db.transactionWithResult(false, txn ->
addContact(txn, remote, local, master, timestamp, alice,
verified, active));
}
@@ -92,8 +92,8 @@ class ContactManagerImpl implements ContactManager {
@Override
public Contact getContact(AuthorId remoteAuthorId, AuthorId localAuthorId)
throws DbException {
return db.transactionWithResult(true,
txn -> getContact(txn, remoteAuthorId, localAuthorId));
return db.transactionWithResult(true, txn ->
getContact(txn, remoteAuthorId, localAuthorId));
}
@Override
@@ -155,8 +155,8 @@ class ContactManagerImpl implements ContactManager {
@Override
public boolean contactExists(AuthorId remoteAuthorId,
AuthorId localAuthorId) throws DbException {
return db.transactionWithResult(true,
txn -> contactExists(txn, remoteAuthorId, localAuthorId));
return db.transactionWithResult(true, txn ->
contactExists(txn, remoteAuthorId, localAuthorId));
}
@Override

View File

@@ -218,8 +218,8 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
@Override
public TransportProperties getRemoteProperties(ContactId c, TransportId t)
throws DbException {
return db.transactionWithResult(true,
txn -> getRemoteProperties(txn, db.getContact(txn, c), t));
return db.transactionWithResult(true, txn ->
getRemoteProperties(txn, db.getContact(txn, c), t));
}
@Override

View File

@@ -23,8 +23,8 @@ class SettingsManagerImpl implements SettingsManager {
@Override
public Settings getSettings(String namespace) throws DbException {
return db.transactionWithResult(true,
txn -> db.getSettings(txn, namespace));
return db.transactionWithResult(true, txn ->
db.getSettings(txn, namespace));
}
@Override

View File

@@ -230,8 +230,8 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
if (interrupted) return;
if (!generateAckQueued.getAndSet(false)) throw new AssertionError();
try {
Maybe<Ack> a = db.transactionWithResult(false,
txn -> new Maybe<>(db.generateAck(txn, contactId,
Maybe<Ack> a = db.transactionWithResult(false, txn ->
new Maybe<>(db.generateAck(txn, contactId,
MAX_MESSAGE_IDS)));
if (LOG.isLoggable(INFO))
LOG.info("Generated ack: " + a.isPresent());
@@ -357,8 +357,8 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
if (!generateRequestQueued.getAndSet(false))
throw new AssertionError();
try {
Maybe<Request> r = db.transactionWithResult(false,
txn -> new Maybe<>(db.generateRequest(txn, contactId,
Maybe<Request> r = db.transactionWithResult(false, txn ->
new Maybe<>(db.generateRequest(txn, contactId,
MAX_MESSAGE_IDS)));
if (LOG.isLoggable(INFO))
LOG.info("Generated request: " + r.isPresent());

View File

@@ -119,8 +119,8 @@ class IncomingSession implements SyncSession, EventListener {
@Override
public void run() {
try {
db.transaction(false,
txn -> db.receiveAck(txn, contactId, ack));
db.transaction(false, txn ->
db.receiveAck(txn, contactId, ack));
} catch (DbException e) {
logException(LOG, WARNING, e);
interrupt();
@@ -140,8 +140,8 @@ class IncomingSession implements SyncSession, EventListener {
@Override
public void run() {
try {
db.transaction(false,
txn -> db.receiveMessage(txn, contactId, message));
db.transaction(false, txn ->
db.receiveMessage(txn, contactId, message));
} catch (DbException e) {
logException(LOG, WARNING, e);
interrupt();
@@ -161,8 +161,8 @@ class IncomingSession implements SyncSession, EventListener {
@Override
public void run() {
try {
db.transaction(false,
txn -> db.receiveOffer(txn, contactId, offer));
db.transaction(false, txn ->
db.receiveOffer(txn, contactId, offer));
} catch (DbException e) {
logException(LOG, WARNING, e);
interrupt();
@@ -182,8 +182,8 @@ class IncomingSession implements SyncSession, EventListener {
@Override
public void run() {
try {
db.transaction(false,
txn -> db.receiveRequest(txn, contactId, request));
db.transaction(false, txn ->
db.receiveRequest(txn, contactId, request));
} catch (DbException e) {
logException(LOG, WARNING, e);
interrupt();

View File

@@ -129,8 +129,8 @@ class SimplexOutgoingSession implements SyncSession, EventListener {
public void run() {
if (interrupted) return;
try {
Maybe<Ack> a = db.transactionWithResult(false,
txn -> new Maybe<>(db.generateAck(txn, contactId,
Maybe<Ack> a = db.transactionWithResult(false, txn ->
new Maybe<>(db.generateAck(txn, contactId,
MAX_MESSAGE_IDS)));
if (LOG.isLoggable(INFO))
LOG.info("Generated ack: " + a.isPresent());

View File

@@ -434,8 +434,8 @@ class ValidationManagerImpl implements ValidationManager, Service,
@DatabaseExecutor
private void loadGroupAndValidate(Message m) {
try {
Group g = db.transactionWithResult(true,
txn -> db.getGroup(txn, m.getGroupId()));
Group g = db.transactionWithResult(true, txn ->
db.getGroup(txn, m.getGroupId()));
validateMessageAsync(m, g);
} catch (NoSuchGroupException e) {
LOG.info("Group removed before validation");

View File

@@ -137,8 +137,8 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
if (LOG.isLoggable(INFO)) LOG.info("No key manager for " + t);
return null;
}
return db.transactionWithResult(false,
txn -> m.getStreamContext(txn, c));
return db.transactionWithResult(false, txn ->
m.getStreamContext(txn, c));
}
@Override
@@ -149,8 +149,8 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
if (LOG.isLoggable(INFO)) LOG.info("No key manager for " + t);
return null;
}
return db.transactionWithResult(false,
txn -> m.getStreamContext(txn, tag));
return db.transactionWithResult(false, txn ->
m.getStreamContext(txn, tag));
}
@Override