Nickname is all one word.

This commit is contained in:
akwizgran
2016-11-01 17:05:32 +00:00
parent 88272c5d61
commit c85767d2a0
13 changed files with 28 additions and 39 deletions

View File

@@ -25,7 +25,7 @@ class IdentityManagerImpl implements IdentityManager {
private static final Logger LOG =
Logger.getLogger(IdentityManagerImpl.class.getName());
// Make sure that this variable is immutable
// The local author is immutable so we can cache it
private volatile LocalAuthor cachedAuthor;
@Inject
@@ -40,7 +40,7 @@ class IdentityManagerImpl implements IdentityManager {
db.addLocalAuthor(txn, localAuthor);
txn.setComplete();
cachedAuthor = localAuthor;
LOG.info("Local Author created");
LOG.info("Local author registered");
} finally {
db.endTransaction(txn);
}
@@ -52,7 +52,7 @@ class IdentityManagerImpl implements IdentityManager {
Transaction txn = db.startTransaction(true);
try {
cachedAuthor = loadLocalAuthor(txn);
LOG.info("Author loaded from db");
LOG.info("Local author loaded");
txn.setComplete();
} finally {
db.endTransaction(txn);
@@ -66,6 +66,7 @@ class IdentityManagerImpl implements IdentityManager {
public LocalAuthor getLocalAuthor(Transaction txn) throws DbException {
if (cachedAuthor == null) {
cachedAuthor = loadLocalAuthor(txn);
LOG.info("Local author loaded");
}
return cachedAuthor;
}
@@ -87,10 +88,7 @@ class IdentityManagerImpl implements IdentityManager {
@Override
public Status getAuthorStatus(Transaction txn, AuthorId authorId)
throws DbException {
// Compare to the IDs of the user's identity
if (getLocalAuthor(txn).getId().equals(authorId)) return OURSELVES;
Collection<Contact> contacts = db.getContactsByAuthorId(txn, authorId);
if (contacts.isEmpty()) return UNKNOWN;
for (Contact c : contacts) {

View File

@@ -305,8 +305,7 @@ class IntroduceeManager {
boolean alice = comp < 0;
// get our local author
LocalAuthor author =
identityManager.getLocalAuthor(txn);
LocalAuthor author = identityManager.getLocalAuthor(txn);
SecretKey secretKey;
byte[] privateKeyBytes = localState.getRaw(OUR_PRIVATE_KEY);

View File

@@ -93,7 +93,7 @@ class LifecycleManagerImpl implements LifecycleManager {
.createLocalAuthor(nickname, publicKey, privateKey);
long duration = System.currentTimeMillis() - now;
if (LOG.isLoggable(INFO))
LOG.info("Identity creation took " + duration + " ms");
LOG.info("Creating local author took " + duration + " ms");
return localAuthor;
}
@@ -102,12 +102,11 @@ class LifecycleManagerImpl implements LifecycleManager {
identityManager.registerLocalAuthor(author);
long duration = System.currentTimeMillis() - now;
if (LOG.isLoggable(INFO))
LOG.info("Author registration took " + duration +
" ms");
LOG.info("Registering local author took " + duration + " ms");
}
@Override
public StartResult startServices(@Nullable String authorNick) {
public StartResult startServices(@Nullable String nickname) {
if (!startStopSemaphore.tryAcquire()) {
LOG.info("Already starting or stopping");
return ALREADY_RUNNING;
@@ -124,8 +123,8 @@ class LifecycleManagerImpl implements LifecycleManager {
else LOG.info("Creating database took " + duration + " ms");
}
if (authorNick != null) {
registerLocalAuthor(createLocalAuthor(authorNick));
if (nickname != null) {
registerLocalAuthor(createLocalAuthor(nickname));
}
dbLatch.countDown();