mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Removed unnecessary conditionals from logging statements.
Very important stuff.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package org.briarproject.db;
|
||||
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
|
||||
import java.util.TimerTask;
|
||||
@@ -39,11 +38,11 @@ class DatabaseCleanerImpl extends TimerTask implements DatabaseCleaner {
|
||||
if(callback == null) throw new IllegalStateException();
|
||||
try {
|
||||
if(callback.shouldCheckFreeSpace()) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Checking free space");
|
||||
LOG.info("Checking free space");
|
||||
callback.checkFreeSpaceAndClean();
|
||||
}
|
||||
} catch(DbClosedException e) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Database closed, exiting");
|
||||
LOG.info("Database closed, exiting");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
throw new Error(e); // Kill the application
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.briarproject.db;
|
||||
|
||||
import static java.sql.Types.BINARY;
|
||||
import static java.sql.Types.VARCHAR;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.api.Author.Status.ANONYMOUS;
|
||||
import static org.briarproject.api.Author.Status.UNKNOWN;
|
||||
@@ -544,8 +543,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
try {
|
||||
connections.wait();
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Interrupted while closing connections");
|
||||
LOG.warning("Interrupted while closing connections");
|
||||
interrupted = true;
|
||||
}
|
||||
for(Connection c : connections) c.close();
|
||||
|
||||
@@ -113,8 +113,7 @@ class AliceConnector extends Connector {
|
||||
tryToClose(conn, true);
|
||||
return;
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.warning("Interrupted while waiting for confirmation");
|
||||
LOG.warning("Interrupted while waiting for confirmation");
|
||||
group.remoteConfirmationFailed();
|
||||
tryToClose(conn, true);
|
||||
Thread.currentThread().interrupt();
|
||||
|
||||
@@ -113,8 +113,7 @@ class BobConnector extends Connector {
|
||||
tryToClose(conn, true);
|
||||
return;
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.warning("Interrupted while waiting for confirmation");
|
||||
LOG.warning("Interrupted while waiting for confirmation");
|
||||
group.remoteConfirmationFailed();
|
||||
tryToClose(conn, true);
|
||||
Thread.currentThread().interrupt();
|
||||
|
||||
@@ -310,7 +310,7 @@ abstract class Connector extends Thread {
|
||||
protected void tryToClose(DuplexTransportConnection conn,
|
||||
boolean exception) {
|
||||
try {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Closing connection");
|
||||
LOG.info("Closing connection");
|
||||
conn.dispose(exception, true);
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
|
||||
@@ -158,8 +158,7 @@ class ConnectorGroup extends Thread implements InvitationTask {
|
||||
try {
|
||||
for(Connector c : connectors) c.join();
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.warning("Interrupted while waiting for connectors");
|
||||
LOG.warning("Interrupted while waiting for connectors");
|
||||
}
|
||||
// If none of the threads connected, inform the listeners
|
||||
if(!connected.get()) {
|
||||
|
||||
@@ -53,7 +53,7 @@ class LifecycleManagerImpl implements LifecycleManager {
|
||||
|
||||
public boolean startServices() {
|
||||
try {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Starting");
|
||||
LOG.info("Starting");
|
||||
long start = clock.currentTimeMillis();
|
||||
boolean reopened = db.open();
|
||||
long duration = clock.currentTimeMillis() - start;
|
||||
@@ -92,7 +92,7 @@ class LifecycleManagerImpl implements LifecycleManager {
|
||||
|
||||
public void stopServices() {
|
||||
try {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Shutting down");
|
||||
LOG.info("Shutting down");
|
||||
for(Service s : services) {
|
||||
boolean stopped = s.stop();
|
||||
if(LOG.isLoggable(INFO)) {
|
||||
@@ -105,7 +105,7 @@ class LifecycleManagerImpl implements LifecycleManager {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info(executors.size() + " executors shut down");
|
||||
db.close();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Database closed");
|
||||
LOG.info("Database closed");
|
||||
shutdownLatch.countDown();
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
|
||||
@@ -162,58 +162,53 @@ abstract class DuplexConnection implements EventListener {
|
||||
try {
|
||||
InputStream in = createConnectionReader().getInputStream();
|
||||
PacketReader reader = packetReaderFactory.createPacketReader(in);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Starting to read");
|
||||
LOG.info("Starting to read");
|
||||
while(!reader.eof()) {
|
||||
if(reader.hasAck()) {
|
||||
Ack a = reader.readAck();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Received ack");
|
||||
LOG.info("Received ack");
|
||||
dbExecutor.execute(new ReceiveAck(a));
|
||||
} else if(reader.hasMessage()) {
|
||||
UnverifiedMessage m = reader.readMessage();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Received message");
|
||||
LOG.info("Received message");
|
||||
cryptoExecutor.execute(new VerifyMessage(m));
|
||||
} else if(reader.hasOffer()) {
|
||||
Offer o = reader.readOffer();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Received offer");
|
||||
LOG.info("Received offer");
|
||||
dbExecutor.execute(new ReceiveOffer(o));
|
||||
} else if(reader.hasRequest()) {
|
||||
Request r = reader.readRequest();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Received request");
|
||||
LOG.info("Received request");
|
||||
dbExecutor.execute(new ReceiveRequest(r));
|
||||
} else if(reader.hasRetentionAck()) {
|
||||
RetentionAck a = reader.readRetentionAck();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Received retention ack");
|
||||
LOG.info("Received retention ack");
|
||||
dbExecutor.execute(new ReceiveRetentionAck(a));
|
||||
} else if(reader.hasRetentionUpdate()) {
|
||||
RetentionUpdate u = reader.readRetentionUpdate();
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Received retention update");
|
||||
LOG.info("Received retention update");
|
||||
dbExecutor.execute(new ReceiveRetentionUpdate(u));
|
||||
} else if(reader.hasSubscriptionAck()) {
|
||||
SubscriptionAck a = reader.readSubscriptionAck();
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Received subscription ack");
|
||||
LOG.info("Received subscription ack");
|
||||
dbExecutor.execute(new ReceiveSubscriptionAck(a));
|
||||
} else if(reader.hasSubscriptionUpdate()) {
|
||||
SubscriptionUpdate u = reader.readSubscriptionUpdate();
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Received subscription update");
|
||||
LOG.info("Received subscription update");
|
||||
dbExecutor.execute(new ReceiveSubscriptionUpdate(u));
|
||||
} else if(reader.hasTransportAck()) {
|
||||
TransportAck a = reader.readTransportAck();
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Received transport ack");
|
||||
LOG.info("Received transport ack");
|
||||
dbExecutor.execute(new ReceiveTransportAck(a));
|
||||
} else if(reader.hasTransportUpdate()) {
|
||||
TransportUpdate u = reader.readTransportUpdate();
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Received transport update");
|
||||
LOG.info("Received transport update");
|
||||
dbExecutor.execute(new ReceiveTransportUpdate(u));
|
||||
} else {
|
||||
throw new FormatException();
|
||||
}
|
||||
}
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Finished reading");
|
||||
LOG.info("Finished reading");
|
||||
writerTasks.add(CLOSE);
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -227,7 +222,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
try {
|
||||
OutputStream out = createConnectionWriter().getOutputStream();
|
||||
writer = packetWriterFactory.createPacketWriter(out, true);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Starting to write");
|
||||
LOG.info("Starting to write");
|
||||
// Send the initial packets
|
||||
dbExecutor.execute(new GenerateTransportAcks());
|
||||
dbExecutor.execute(new GenerateTransportUpdates());
|
||||
@@ -242,13 +237,12 @@ abstract class DuplexConnection implements EventListener {
|
||||
// Main loop
|
||||
Runnable task = null;
|
||||
while(true) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Waiting for something to write");
|
||||
LOG.info("Waiting for something to write");
|
||||
task = writerTasks.take();
|
||||
if(task == CLOSE || task == DIE) break;
|
||||
task.run();
|
||||
}
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Finished writing");
|
||||
LOG.info("Finished writing");
|
||||
if(task == CLOSE) {
|
||||
writer.flush();
|
||||
writer.close();
|
||||
@@ -257,8 +251,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
dispose(true, true);
|
||||
}
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Interrupted while waiting for task");
|
||||
LOG.warning("Interrupted while waiting for task");
|
||||
dispose(true, true);
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -292,7 +285,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveAck(contactId, ack);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("DB received ack");
|
||||
LOG.info("DB received ack");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -311,7 +304,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
Message m = messageVerifier.verifyMessage(message);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Verified message");
|
||||
LOG.info("Verified message");
|
||||
dbExecutor.execute(new ReceiveMessage(m));
|
||||
} catch(GeneralSecurityException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -331,7 +324,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveMessage(contactId, message);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("DB received message");
|
||||
LOG.info("DB received message");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -350,7 +343,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveOffer(contactId, offer);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("DB received offer");
|
||||
LOG.info("DB received offer");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -369,7 +362,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveRequest(contactId, request);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("DB received request");
|
||||
LOG.info("DB received request");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -388,7 +381,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveRetentionAck(contactId, ack);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("DB received retention ack");
|
||||
LOG.info("DB received retention ack");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -407,8 +400,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveRetentionUpdate(contactId, update);
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("DB received retention update");
|
||||
LOG.info("DB received retention update");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -427,8 +419,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveSubscriptionAck(contactId, ack);
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("DB received subscription ack");
|
||||
LOG.info("DB received subscription ack");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -447,8 +438,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveSubscriptionUpdate(contactId, update);
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("DB received subscription update");
|
||||
LOG.info("DB received subscription update");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -467,7 +457,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveTransportAck(contactId, ack);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("DB received transport ack");
|
||||
LOG.info("DB received transport ack");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -486,8 +476,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.receiveTransportUpdate(contactId, update);
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("DB received transport update");
|
||||
LOG.info("DB received transport update");
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
@@ -524,7 +513,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
writer.writeAck(ack);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent ack");
|
||||
LOG.info("Sent ack");
|
||||
dbExecutor.execute(new GenerateAck());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -563,7 +552,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
for(byte[] raw : batch) writer.writeMessage(raw);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent batch");
|
||||
LOG.info("Sent batch");
|
||||
dbExecutor.execute(new GenerateBatch());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -602,7 +591,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
writer.writeOffer(offer);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent offer");
|
||||
LOG.info("Sent offer");
|
||||
dbExecutor.execute(new GenerateOffer());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -641,7 +630,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
writer.writeRequest(request);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent request");
|
||||
LOG.info("Sent request");
|
||||
dbExecutor.execute(new GenerateRequest());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -678,7 +667,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
writer.writeRetentionAck(ack);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent retention ack");
|
||||
LOG.info("Sent retention ack");
|
||||
dbExecutor.execute(new GenerateRetentionAck());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -716,7 +705,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
writer.writeRetentionUpdate(update);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent retention update");
|
||||
LOG.info("Sent retention update");
|
||||
dbExecutor.execute(new GenerateRetentionUpdate());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -753,7 +742,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
writer.writeSubscriptionAck(ack);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent subscription ack");
|
||||
LOG.info("Sent subscription ack");
|
||||
dbExecutor.execute(new GenerateSubscriptionAck());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -791,7 +780,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
writer.writeSubscriptionUpdate(update);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent subscription update");
|
||||
LOG.info("Sent subscription update");
|
||||
dbExecutor.execute(new GenerateSubscriptionUpdate());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -829,7 +818,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
for(TransportAck a : acks) writer.writeTransportAck(a);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent transport acks");
|
||||
LOG.info("Sent transport acks");
|
||||
dbExecutor.execute(new GenerateTransportAcks());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
@@ -867,7 +856,7 @@ abstract class DuplexConnection implements EventListener {
|
||||
assert writer != null;
|
||||
try {
|
||||
for(TransportUpdate u : updates) writer.writeTransportUpdate(u);
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Sent transport updates");
|
||||
LOG.info("Sent transport updates");
|
||||
dbExecutor.execute(new GenerateTransportUpdates());
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.briarproject.messaging.duplex;
|
||||
|
||||
import static java.util.logging.Level.WARNING;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -83,8 +81,7 @@ class DuplexConnectionFactoryImpl implements DuplexConnectionFactory {
|
||||
DuplexTransportConnection transport) {
|
||||
ConnectionContext ctx = keyManager.getConnectionContext(c, t);
|
||||
if(ctx == null) {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.warning("Could not create outgoing connection context");
|
||||
LOG.warning("Could not create outgoing connection context");
|
||||
return;
|
||||
}
|
||||
final DuplexConnection conn = new OutgoingDuplexConnection(dbExecutor,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.briarproject.messaging.simplex;
|
||||
|
||||
import static java.util.logging.Level.WARNING;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -77,8 +75,7 @@ class SimplexConnectionFactoryImpl implements SimplexConnectionFactory {
|
||||
SimplexTransportWriter w) {
|
||||
ConnectionContext ctx = keyManager.getConnectionContext(c, t);
|
||||
if(ctx == null) {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.warning("Could not create outgoing connection context");
|
||||
LOG.warning("Could not create outgoing connection context");
|
||||
return;
|
||||
}
|
||||
final OutgoingSimplexConnection conn = new OutgoingSimplexConnection(db,
|
||||
|
||||
@@ -82,14 +82,14 @@ class PluginManagerImpl implements PluginManager {
|
||||
|
||||
public synchronized boolean start() {
|
||||
// Instantiate and start the simplex plugins
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Starting simplex plugins");
|
||||
LOG.info("Starting simplex plugins");
|
||||
Collection<SimplexPluginFactory> sFactories =
|
||||
simplexPluginConfig.getFactories();
|
||||
final CountDownLatch sLatch = new CountDownLatch(sFactories.size());
|
||||
for(SimplexPluginFactory factory : sFactories)
|
||||
pluginExecutor.execute(new SimplexPluginStarter(factory, sLatch));
|
||||
// Instantiate and start the duplex plugins
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Starting duplex plugins");
|
||||
LOG.info("Starting duplex plugins");
|
||||
Collection<DuplexPluginFactory> dFactories =
|
||||
duplexPluginConfig.getFactories();
|
||||
final CountDownLatch dLatch = new CountDownLatch(dFactories.size());
|
||||
@@ -100,13 +100,12 @@ class PluginManagerImpl implements PluginManager {
|
||||
sLatch.await();
|
||||
dLatch.await();
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.warning("Interrupted while starting plugins");
|
||||
LOG.warning("Interrupted while starting plugins");
|
||||
Thread.currentThread().interrupt();
|
||||
return false;
|
||||
}
|
||||
// Start the poller
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Starting poller");
|
||||
LOG.info("Starting poller");
|
||||
List<Plugin> start = new ArrayList<Plugin>(plugins.values());
|
||||
poller.start(Collections.unmodifiableList(start));
|
||||
return true;
|
||||
@@ -114,15 +113,15 @@ class PluginManagerImpl implements PluginManager {
|
||||
|
||||
public synchronized boolean stop() {
|
||||
// Stop the poller
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Stopping poller");
|
||||
LOG.info("Stopping poller");
|
||||
poller.stop();
|
||||
final CountDownLatch latch = new CountDownLatch(plugins.size());
|
||||
// Stop the simplex plugins
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Stopping simplex plugins");
|
||||
LOG.info("Stopping simplex plugins");
|
||||
for(SimplexPlugin plugin : simplexPlugins)
|
||||
pluginExecutor.execute(new PluginStopper(plugin, latch));
|
||||
// Stop the duplex plugins
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Stopping duplex plugins");
|
||||
LOG.info("Stopping duplex plugins");
|
||||
for(DuplexPlugin plugin : duplexPlugins)
|
||||
pluginExecutor.execute(new PluginStopper(plugin, latch));
|
||||
plugins.clear();
|
||||
@@ -132,8 +131,7 @@ class PluginManagerImpl implements PluginManager {
|
||||
try {
|
||||
latch.await();
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.warning("Interrupted while stopping plugins");
|
||||
LOG.warning("Interrupted while stopping plugins");
|
||||
Thread.currentThread().interrupt();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class PollerImpl implements Poller, Runnable {
|
||||
while(true) {
|
||||
synchronized(this) {
|
||||
if(pollTimes.isEmpty()) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Finished polling");
|
||||
LOG.info("Finished polling");
|
||||
return;
|
||||
}
|
||||
long now = clock.currentTimeMillis();
|
||||
@@ -83,8 +83,7 @@ class PollerImpl implements Poller, Runnable {
|
||||
try {
|
||||
wait(p.time - now);
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Interrupted while waiting to poll");
|
||||
LOG.warning("Interrupted while waiting to poll");
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ abstract class TcpPlugin implements DuplexPlugin {
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Could not bind server socket");
|
||||
LOG.info("Could not bind server socket");
|
||||
return;
|
||||
}
|
||||
if(!running) {
|
||||
|
||||
@@ -70,8 +70,7 @@ class ReliabilityLayerImpl implements ReliabilityLayer, WriteHandler {
|
||||
}
|
||||
}
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.warning("Interrupted while waiting to write");
|
||||
LOG.warning("Interrupted while waiting to write");
|
||||
Thread.currentThread().interrupt();
|
||||
running = false;
|
||||
} catch(IOException e) {
|
||||
|
||||
@@ -42,7 +42,7 @@ class ConnectionRegistryImpl implements ConnectionRegistry {
|
||||
}
|
||||
|
||||
public void registerConnection(ContactId c, TransportId t) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Connection registered");
|
||||
LOG.info("Connection registered");
|
||||
boolean firstConnection = false;
|
||||
synchronized(this) {
|
||||
Map<ContactId, Integer> m = connections.get(t);
|
||||
@@ -62,13 +62,13 @@ class ConnectionRegistryImpl implements ConnectionRegistry {
|
||||
}
|
||||
}
|
||||
if(firstConnection) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Contact connected");
|
||||
LOG.info("Contact connected");
|
||||
for(ConnectionListener l : listeners) l.contactConnected(c);
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterConnection(ContactId c, TransportId t) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Connection unregistered");
|
||||
LOG.info("Connection unregistered");
|
||||
boolean lastConnection = false;
|
||||
synchronized(this) {
|
||||
Map<ContactId, Integer> m = connections.get(t);
|
||||
@@ -90,7 +90,7 @@ class ConnectionRegistryImpl implements ConnectionRegistry {
|
||||
}
|
||||
}
|
||||
if(lastConnection) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Contact disconnected");
|
||||
LOG.info("Contact disconnected");
|
||||
for(ConnectionListener l : listeners) l.contactDisconnected(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.briarproject.transport;
|
||||
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.api.transport.TransportConstants.MAX_CLOCK_DIFFERENCE;
|
||||
|
||||
@@ -116,7 +115,7 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener {
|
||||
// Discard the secret if the transport has been removed
|
||||
Long maxLatency = maxLatencies.get(s.getTransportId());
|
||||
if(maxLatency == null) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Discarding obsolete secret");
|
||||
LOG.info("Discarding obsolete secret");
|
||||
ByteUtils.erase(s.getSecret());
|
||||
continue;
|
||||
}
|
||||
@@ -234,14 +233,14 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener {
|
||||
TransportId t) {
|
||||
TemporarySecret s = currentSecrets.get(new EndpointKey(c, t));
|
||||
if(s == null) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("No secret for endpoint");
|
||||
LOG.info("No secret for endpoint");
|
||||
return null;
|
||||
}
|
||||
long connection;
|
||||
try {
|
||||
connection = db.incrementConnectionCounter(c, t, s.getPeriod());
|
||||
if(connection == -1) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("No counter for period");
|
||||
LOG.info("No counter for period");
|
||||
return null;
|
||||
}
|
||||
} catch(DbException e) {
|
||||
|
||||
Reference in New Issue
Block a user