This source file includes following definitions.
- get
- getInvalidatorClientName
- setPreferredClientNameGenerator
package org.chromium.sync.notifier;
public class InvalidationClientNameProvider {
private static final Object LOCK = new Object();
private static InvalidationClientNameProvider sInstance;
private final Object mLock;
private InvalidationClientNameGenerator mGenerator;
private byte[] mUniqueId;
public static InvalidationClientNameProvider get() {
synchronized (LOCK) {
if (sInstance == null) {
sInstance = new InvalidationClientNameProvider();
}
return sInstance;
}
}
InvalidationClientNameProvider() {
mLock = new Object();
mGenerator = new RandomizedInvalidationClientNameGenerator();
}
public byte[] getInvalidatorClientName() {
synchronized (mLock) {
if (mUniqueId == null) {
mUniqueId = mGenerator.generateInvalidatorClientName();
}
return mUniqueId;
}
}
public void setPreferredClientNameGenerator(InvalidationClientNameGenerator generator) {
mGenerator = generator;
}
}