Converting printStackTrace statements to slf4j so that exceptions
are logged properly
This commit is contained in:
Christopher L. Shannon (cshannon) 2015-08-05 16:23:22 +00:00
parent ff9aae69f9
commit 457dbd8b64
7 changed files with 70 additions and 34 deletions

View File

@ -715,7 +715,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
try { try {
cs.addSession(info); cs.addSession(info);
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
e.printStackTrace(); LOG.warn("Failed to add session: {}", info.getSessionId(), e);
broker.removeSession(cs.getContext(), info); broker.removeSession(cs.getContext(), info);
} }
} }
@ -1199,7 +1199,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
LOG.debug("Cleaning up connection resources: {}", getRemoteAddress()); LOG.debug("Cleaning up connection resources: {}", getRemoteAddress());
processRemoveConnection(cs.getInfo().getConnectionId(), RemoveInfo.LAST_DELIVERED_UNKNOWN); processRemoveConnection(cs.getInfo().getConnectionId(), RemoveInfo.LAST_DELIVERED_UNKNOWN);
} catch (Throwable ignore) { } catch (Throwable ignore) {
ignore.printStackTrace(); LOG.debug("Exception caught removing connection {}. This exception is ignored.", cs.getInfo().getConnectionId(), ignore);
} }
} }
} }

View File

@ -169,6 +169,7 @@ public class DestinationView implements DestinationViewMBean {
/** /**
* @return the average size of a message (bytes) * @return the average size of a message (bytes)
*/ */
@Override
public long getAverageMessageSize() { public long getAverageMessageSize() {
// we are okay with the size without decimals so cast to long // we are okay with the size without decimals so cast to long
return (long) destination.getDestinationStatistics().getMessageSize().getAverageSize(); return (long) destination.getDestinationStatistics().getMessageSize().getAverageSize();
@ -177,6 +178,7 @@ public class DestinationView implements DestinationViewMBean {
/** /**
* @return the max size of a message (bytes) * @return the max size of a message (bytes)
*/ */
@Override
public long getMaxMessageSize() { public long getMaxMessageSize() {
return destination.getDestinationStatistics().getMessageSize().getMaxSize(); return destination.getDestinationStatistics().getMessageSize().getMaxSize();
} }
@ -184,6 +186,7 @@ public class DestinationView implements DestinationViewMBean {
/** /**
* @return the min size of a message (bytes) * @return the min size of a message (bytes)
*/ */
@Override
public long getMinMessageSize() { public long getMinMessageSize() {
return destination.getDestinationStatistics().getMessageSize().getMinSize(); return destination.getDestinationStatistics().getMessageSize().getMinSize();
} }
@ -226,10 +229,6 @@ public class DestinationView implements DestinationViewMBean {
} }
} catch (Throwable e) { } catch (Throwable e) {
// TODO DELETE ME
System.out.println(e);
e.printStackTrace();
// TODO DELETE ME
LOG.warn("exception browsing destination", e); LOG.warn("exception browsing destination", e);
} }
} }

View File

@ -114,7 +114,7 @@ public class DiscoveryTransport extends TransportFilter implements DiscoveryList
try { try {
((Suspendable)discoveryAgent).suspend(); ((Suspendable)discoveryAgent).suspend();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); LOG.warn("Exception suspending discoverAgent: ", discoveryAgent);
} }
} }
super.transportResumed(); super.transportResumed();
@ -126,7 +126,7 @@ public class DiscoveryTransport extends TransportFilter implements DiscoveryList
try { try {
((Suspendable)discoveryAgent).resume(); ((Suspendable)discoveryAgent).resume();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); LOG.warn("Exception resuming discoverAgent: ", discoveryAgent);
} }
} }
super.transportInterupted(); super.transportInterupted();

View File

@ -57,10 +57,10 @@ import static javax.xml.bind.DatatypeConverter.printBase64Binary;
* <ul> * <ul>
* <li></li> * <li></li>
* </ul> * </ul>
* *
* @org.apache.xbean.XBean element="defaultJDBCAdapter" * @org.apache.xbean.XBean element="defaultJDBCAdapter"
* *
* *
*/ */
public class DefaultJDBCAdapter implements JDBCAdapter { public class DefaultJDBCAdapter implements JDBCAdapter {
private static final Logger LOG = LoggerFactory.getLogger(DefaultJDBCAdapter.class); private static final Logger LOG = LoggerFactory.getLogger(DefaultJDBCAdapter.class);
@ -81,6 +81,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
return rs.getBytes(index); return rs.getBytes(index);
} }
@Override
public void doCreateTables(TransactionContext c) throws SQLException, IOException { public void doCreateTables(TransactionContext c) throws SQLException, IOException {
Statement s = null; Statement s = null;
cleanupExclusiveLock.writeLock().lock(); cleanupExclusiveLock.writeLock().lock();
@ -136,6 +137,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public void doDropTables(TransactionContext c) throws SQLException, IOException { public void doDropTables(TransactionContext c) throws SQLException, IOException {
Statement s = null; Statement s = null;
cleanupExclusiveLock.writeLock().lock(); cleanupExclusiveLock.writeLock().lock();
@ -168,6 +170,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public long doGetLastMessageStoreSequenceId(TransactionContext c) throws SQLException, IOException { public long doGetLastMessageStoreSequenceId(TransactionContext c) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
ResultSet rs = null; ResultSet rs = null;
@ -195,7 +198,8 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
close(s); close(s);
} }
} }
@Override
public byte[] doGetMessageById(TransactionContext c, long storeSequenceId) throws SQLException, IOException { public byte[] doGetMessageById(TransactionContext c, long storeSequenceId) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
ResultSet rs = null; ResultSet rs = null;
@ -220,6 +224,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
/** /**
* A non null xid indicated the op is part of 2pc prepare, so ops are flagged pending outcome * A non null xid indicated the op is part of 2pc prepare, so ops are flagged pending outcome
*/ */
@Override
public void doAddMessage(TransactionContext c, long sequence, MessageId messageID, ActiveMQDestination destination, byte[] data, public void doAddMessage(TransactionContext c, long sequence, MessageId messageID, ActiveMQDestination destination, byte[] data,
long expiration, byte priority, XATransactionId xid) throws SQLException, IOException { long expiration, byte priority, XATransactionId xid) throws SQLException, IOException {
PreparedStatement s = c.getAddMessageStatement(); PreparedStatement s = c.getAddMessageStatement();
@ -281,6 +286,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
@Override
public void doAddMessageReference(TransactionContext c, long sequence, MessageId messageID, ActiveMQDestination destination, public void doAddMessageReference(TransactionContext c, long sequence, MessageId messageID, ActiveMQDestination destination,
long expirationTime, String messageRef) throws SQLException, IOException { long expirationTime, String messageRef) throws SQLException, IOException {
PreparedStatement s = c.getAddMessageStatement(); PreparedStatement s = c.getAddMessageStatement();
@ -311,6 +317,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public long[] getStoreSequenceId(TransactionContext c, ActiveMQDestination destination, MessageId messageID) throws SQLException, IOException { public long[] getStoreSequenceId(TransactionContext c, ActiveMQDestination destination, MessageId messageID) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
ResultSet rs = null; ResultSet rs = null;
@ -332,6 +339,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public byte[] doGetMessage(TransactionContext c, MessageId id) throws SQLException, IOException { public byte[] doGetMessage(TransactionContext c, MessageId id) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
ResultSet rs = null; ResultSet rs = null;
@ -352,6 +360,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public String doGetMessageReference(TransactionContext c, long seq) throws SQLException, IOException { public String doGetMessageReference(TransactionContext c, long seq) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
ResultSet rs = null; ResultSet rs = null;
@ -374,6 +383,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
/** /**
* A non null xid indicated the op is part of 2pc prepare, so ops are flagged pending outcome * A non null xid indicated the op is part of 2pc prepare, so ops are flagged pending outcome
*/ */
@Override
public void doRemoveMessage(TransactionContext c, long seq, XATransactionId xid) throws SQLException, IOException { public void doRemoveMessage(TransactionContext c, long seq, XATransactionId xid) throws SQLException, IOException {
PreparedStatement s = c.getRemovedMessageStatement(); PreparedStatement s = c.getRemovedMessageStatement();
cleanupExclusiveLock.readLock().lock(); cleanupExclusiveLock.readLock().lock();
@ -407,6 +417,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public void doRecover(TransactionContext c, ActiveMQDestination destination, JDBCMessageRecoveryListener listener) public void doRecover(TransactionContext c, ActiveMQDestination destination, JDBCMessageRecoveryListener listener)
throws Exception { throws Exception {
PreparedStatement s = null; PreparedStatement s = null;
@ -436,7 +447,8 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
public void doMessageIdScan(TransactionContext c, int limit, @Override
public void doMessageIdScan(TransactionContext c, int limit,
JDBCMessageIdScanListener listener) throws SQLException, IOException { JDBCMessageIdScanListener listener) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
ResultSet rs = null; ResultSet rs = null;
@ -462,7 +474,8 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
close(s); close(s);
} }
} }
@Override
public void doSetLastAckWithPriority(TransactionContext c, ActiveMQDestination destination, XATransactionId xid, String clientId, public void doSetLastAckWithPriority(TransactionContext c, ActiveMQDestination destination, XATransactionId xid, String clientId,
String subscriptionName, long seq, long priority) throws SQLException, IOException { String subscriptionName, long seq, long priority) throws SQLException, IOException {
PreparedStatement s = c.getUpdateLastAckStatement(); PreparedStatement s = c.getUpdateLastAckStatement();
@ -501,6 +514,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
@Override
public void doSetLastAck(TransactionContext c, ActiveMQDestination destination, XATransactionId xid, String clientId, public void doSetLastAck(TransactionContext c, ActiveMQDestination destination, XATransactionId xid, String clientId,
String subscriptionName, long seq, long priority) throws SQLException, IOException { String subscriptionName, long seq, long priority) throws SQLException, IOException {
PreparedStatement s = c.getUpdateLastAckStatement(); PreparedStatement s = c.getUpdateLastAckStatement();
@ -535,7 +549,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
cleanupExclusiveLock.readLock().unlock(); cleanupExclusiveLock.readLock().unlock();
if (!this.batchStatements) { if (!this.batchStatements) {
close(s); close(s);
} }
} }
} }
@ -568,6 +582,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public void doRecoverSubscription(TransactionContext c, ActiveMQDestination destination, String clientId, public void doRecoverSubscription(TransactionContext c, ActiveMQDestination destination, String clientId,
String subscriptionName, JDBCMessageRecoveryListener listener) throws Exception { String subscriptionName, JDBCMessageRecoveryListener listener) throws Exception {
// dumpTables(c, // dumpTables(c,
@ -601,9 +616,10 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, String clientId, public void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, String clientId,
String subscriptionName, long seq, long priority, int maxReturned, JDBCMessageRecoveryListener listener) throws Exception { String subscriptionName, long seq, long priority, int maxReturned, JDBCMessageRecoveryListener listener) throws Exception {
PreparedStatement s = null; PreparedStatement s = null;
ResultSet rs = null; ResultSet rs = null;
cleanupExclusiveLock.readLock().lock(); cleanupExclusiveLock.readLock().lock();
@ -636,6 +652,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public void doRecoverNextMessagesWithPriority(TransactionContext c, ActiveMQDestination destination, String clientId, public void doRecoverNextMessagesWithPriority(TransactionContext c, ActiveMQDestination destination, String clientId,
String subscriptionName, long seq, long priority, int maxReturned, JDBCMessageRecoveryListener listener) throws Exception { String subscriptionName, long seq, long priority, int maxReturned, JDBCMessageRecoveryListener listener) throws Exception {
@ -672,6 +689,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public int doGetDurableSubscriberMessageCount(TransactionContext c, ActiveMQDestination destination, public int doGetDurableSubscriberMessageCount(TransactionContext c, ActiveMQDestination destination,
String clientId, String subscriptionName, boolean isPrioritizedMessages) throws SQLException, IOException { String clientId, String subscriptionName, boolean isPrioritizedMessages) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
@ -682,7 +700,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
if (isPrioritizedMessages) { if (isPrioritizedMessages) {
s = c.getConnection().prepareStatement(this.statements.getDurableSubscriberMessageCountStatementWithPriority()); s = c.getConnection().prepareStatement(this.statements.getDurableSubscriberMessageCountStatementWithPriority());
} else { } else {
s = c.getConnection().prepareStatement(this.statements.getDurableSubscriberMessageCountStatement()); s = c.getConnection().prepareStatement(this.statements.getDurableSubscriberMessageCountStatement());
} }
s.setString(1, destination.getQualifiedName()); s.setString(1, destination.getQualifiedName());
s.setString(2, clientId); s.setString(2, clientId);
@ -700,12 +718,13 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
/** /**
* @param c * @param c
* @param info * @param info
* @param retroactive * @param retroactive
* @throws SQLException * @throws SQLException
* @throws IOException * @throws IOException
*/ */
@Override
public void doSetSubscriberEntry(TransactionContext c, SubscriptionInfo info, boolean retroactive, boolean isPrioritizedMessages) public void doSetSubscriberEntry(TransactionContext c, SubscriptionInfo info, boolean retroactive, boolean isPrioritizedMessages)
throws SQLException, IOException { throws SQLException, IOException {
// dumpTables(c, destination.getQualifiedName(), clientId, // dumpTables(c, destination.getQualifiedName(), clientId,
@ -753,6 +772,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public SubscriptionInfo doGetSubscriberEntry(TransactionContext c, ActiveMQDestination destination, public SubscriptionInfo doGetSubscriberEntry(TransactionContext c, ActiveMQDestination destination,
String clientId, String subscriptionName) throws SQLException, IOException { String clientId, String subscriptionName) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
@ -782,6 +802,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public SubscriptionInfo[] doGetAllSubscriptions(TransactionContext c, ActiveMQDestination destination) public SubscriptionInfo[] doGetAllSubscriptions(TransactionContext c, ActiveMQDestination destination)
throws SQLException, IOException { throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
@ -810,6 +831,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public void doRemoveAllMessages(TransactionContext c, ActiveMQDestination destinationName) throws SQLException, public void doRemoveAllMessages(TransactionContext c, ActiveMQDestination destinationName) throws SQLException,
IOException { IOException {
PreparedStatement s = null; PreparedStatement s = null;
@ -828,6 +850,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public void doDeleteSubscription(TransactionContext c, ActiveMQDestination destination, String clientId, public void doDeleteSubscription(TransactionContext c, ActiveMQDestination destination, String clientId,
String subscriptionName) throws SQLException, IOException { String subscriptionName) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
@ -845,6 +868,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
char priorityIterator = 0; // unsigned char priorityIterator = 0; // unsigned
@Override
public void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException { public void doDeleteOldMessages(TransactionContext c) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
cleanupExclusiveLock.writeLock().lock(); cleanupExclusiveLock.writeLock().lock();
@ -862,6 +886,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public long doGetLastAckedDurableSubscriberMessageId(TransactionContext c, ActiveMQDestination destination, public long doGetLastAckedDurableSubscriberMessageId(TransactionContext c, ActiveMQDestination destination,
String clientId, String subscriberName) throws SQLException, IOException { String clientId, String subscriberName) throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
@ -902,6 +927,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public Set<ActiveMQDestination> doGetDestinations(TransactionContext c) throws SQLException, IOException { public Set<ActiveMQDestination> doGetDestinations(TransactionContext c) throws SQLException, IOException {
HashSet<ActiveMQDestination> rc = new HashSet<ActiveMQDestination>(); HashSet<ActiveMQDestination> rc = new HashSet<ActiveMQDestination>();
PreparedStatement s = null; PreparedStatement s = null;
@ -958,6 +984,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
this.batchStatments = batchStatments; this.batchStatments = batchStatments;
} }
@Override
public void setUseExternalMessageReferences(boolean useExternalMessageReferences) { public void setUseExternalMessageReferences(boolean useExternalMessageReferences) {
this.statements.setUseExternalMessageReferences(useExternalMessageReferences); this.statements.setUseExternalMessageReferences(useExternalMessageReferences);
} }
@ -969,10 +996,12 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
return this.statements; return this.statements;
} }
@Override
public void setStatements(Statements statements) { public void setStatements(Statements statements) {
this.statements = statements; this.statements = statements;
} }
@Override
public int getMaxRows() { public int getMaxRows() {
return maxRows; return maxRows;
} }
@ -980,6 +1009,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
/** /**
* the max value for statement maxRows, used to limit jdbc queries * the max value for statement maxRows, used to limit jdbc queries
*/ */
@Override
public void setMaxRows(int maxRows) { public void setMaxRows(int maxRows) {
this.maxRows = maxRows; this.maxRows = maxRows;
} }
@ -1066,6 +1096,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
@Override
public int doGetMessageCount(TransactionContext c, ActiveMQDestination destination) throws SQLException, public int doGetMessageCount(TransactionContext c, ActiveMQDestination destination) throws SQLException,
IOException { IOException {
PreparedStatement s = null; PreparedStatement s = null;
@ -1087,6 +1118,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
return result; return result;
} }
@Override
public void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, long[] lastRecoveredEntries, public void doRecoverNextMessages(TransactionContext c, ActiveMQDestination destination, long[] lastRecoveredEntries,
long maxSeq, int maxReturned, boolean isPrioritizedMessages, JDBCMessageRecoveryListener listener) throws Exception { long maxSeq, int maxReturned, boolean isPrioritizedMessages, JDBCMessageRecoveryListener listener) throws Exception {
PreparedStatement s = null; PreparedStatement s = null;
@ -1131,7 +1163,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); LOG.warn("Exception recovering next messages", e);
} finally { } finally {
cleanupExclusiveLock.readLock().unlock(); cleanupExclusiveLock.readLock().unlock();
close(rs); close(rs);
@ -1139,6 +1171,7 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
} }
@Override
public long doGetLastProducerSequenceId(TransactionContext c, ProducerId id) public long doGetLastProducerSequenceId(TransactionContext c, ProducerId id)
throws SQLException, IOException { throws SQLException, IOException {
PreparedStatement s = null; PreparedStatement s = null;
@ -1161,13 +1194,13 @@ public class DefaultJDBCAdapter implements JDBCAdapter {
} }
public static void dumpTables(Connection c, String destinationName, String clientId, String public static void dumpTables(Connection c, String destinationName, String clientId, String
subscriptionName) throws SQLException { subscriptionName) throws SQLException {
printQuery(c, "Select * from ACTIVEMQ_MSGS", System.out); printQuery(c, "Select * from ACTIVEMQ_MSGS", System.out);
printQuery(c, "Select * from ACTIVEMQ_ACKS", System.out); printQuery(c, "Select * from ACTIVEMQ_ACKS", System.out);
PreparedStatement s = c.prepareStatement("SELECT M.ID, D.LAST_ACKED_ID FROM " PreparedStatement s = c.prepareStatement("SELECT M.ID, D.LAST_ACKED_ID FROM "
+ "ACTIVEMQ_MSGS M, " +"ACTIVEMQ_ACKS D " + "ACTIVEMQ_MSGS M, " +"ACTIVEMQ_ACKS D "
+ "WHERE D.CONTAINER=? AND D.CLIENT_ID=? AND D.SUB_NAME=?" + "WHERE D.CONTAINER=? AND D.CLIENT_ID=? AND D.SUB_NAME=?"
+ " AND M.CONTAINER=D.CONTAINER AND M.ID > D.LAST_ACKED_ID" + " AND M.CONTAINER=D.CONTAINER AND M.ID > D.LAST_ACKED_ID"
+ " ORDER BY M.ID"); + " ORDER BY M.ID");
s.setString(1,destinationName); s.setString(2,clientId); s.setString(3,subscriptionName); s.setString(1,destinationName); s.setString(2,clientId); s.setString(3,subscriptionName);
printQuery(s,System.out); } printQuery(s,System.out); }

View File

@ -19,8 +19,11 @@ package org.apache.activemq.store.kahadb.disk.journal;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
import org.apache.activemq.store.kahadb.AbstractKahaDBStore;
import org.apache.activemq.util.ByteSequence; import org.apache.activemq.util.ByteSequence;
import org.apache.activemq.util.RecoverableRandomAccessFile; import org.apache.activemq.util.RecoverableRandomAccessFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Optimized Store reader and updater. Single threaded and synchronous. Use in * Optimized Store reader and updater. Single threaded and synchronous. Use in
@ -30,6 +33,7 @@ import org.apache.activemq.util.RecoverableRandomAccessFile;
*/ */
final class DataFileAccessor { final class DataFileAccessor {
private static final Logger LOG = LoggerFactory.getLogger(DataFileAccessor.class);
private final DataFile dataFile; private final DataFile dataFile;
private final Map<Journal.WriteKey, Journal.WriteCommand> inflightWrites; private final Map<Journal.WriteKey, Journal.WriteCommand> inflightWrites;
private final RecoverableRandomAccessFile file; private final RecoverableRandomAccessFile file;
@ -58,7 +62,7 @@ final class DataFileAccessor {
try { try {
dataFile.closeRandomAccessFile(file); dataFile.closeRandomAccessFile(file);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOG.warn("Failed to close file", e);
} }
} }

View File

@ -160,13 +160,13 @@ public class MQTTProtocolConverter {
try { try {
handler.onResponse(this, new Response()); handler.onResponse(this, new Response());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOG.warn("Failed to send command " + command, e);
} }
} }
return; return;
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOG.warn("Failed to send command " + command, e);
} }
} }

View File

@ -143,7 +143,7 @@ public class MQTTTransportFilter extends TransportFilter implements MQTTTranspor
default: return frame.toString(); default: return frame.toString();
} }
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); LOG.warn(e.getMessage(), e);
return frame.toString(); return frame.toString();
} }
} }