[Minor] More logging in CommunicationConnection
This commit is contained in:
parent
5ecfb9d722
commit
5230b3ea52
|
@ -187,7 +187,8 @@ public class CommunicationConnection implements Runnable {
|
||||||
if (this.queueThread != null) {
|
if (this.queueThread != null) {
|
||||||
logger.warn(MessageFormat.format("{0}: Already connected!", this.id)); //$NON-NLS-1$
|
logger.warn(MessageFormat.format("{0}: Already connected!", this.id)); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
logger.info(MessageFormat.format("Starting Connection {0} to {1}...", this.id, getRemoteUri())); //$NON-NLS-1$
|
logger.info(MessageFormat
|
||||||
|
.format("Starting Connection {0} to {1}...", this.id, getRemoteUri())); //$NON-NLS-1$
|
||||||
this.run = true;
|
this.run = true;
|
||||||
this.queueThread = new Thread(this, MessageFormat.format("{0}_OUT", this.id)); //$NON-NLS-1$
|
this.queueThread = new Thread(this, MessageFormat.format("{0}_OUT", this.id)); //$NON-NLS-1$
|
||||||
this.queueThread.start();
|
this.queueThread.start();
|
||||||
|
@ -244,7 +245,8 @@ public class CommunicationConnection implements Runnable {
|
||||||
/**
|
/**
|
||||||
* Called by the underlying endpoint when a new message has been received and parsed
|
* Called by the underlying endpoint when a new message has been received and parsed
|
||||||
*
|
*
|
||||||
* @param message the message to handle
|
* @param message
|
||||||
|
* the message to handle
|
||||||
*/
|
*/
|
||||||
public void handleNewMessage(IoMessage message) {
|
public void handleNewMessage(IoMessage message) {
|
||||||
ConnectionMessages.assertConfigured(this, "Can not be notified of new message yet!"); //$NON-NLS-1$
|
ConnectionMessages.assertConfigured(this, "Can not be notified of new message yet!"); //$NON-NLS-1$
|
||||||
|
@ -259,6 +261,11 @@ public class CommunicationConnection implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyObservers(IoMessage message) {
|
public void notifyObservers(IoMessage message) {
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"Notifying observers for key " + message.getKey() + " with message " + message.getId() + " / " + message
|
||||||
|
.getState());
|
||||||
|
|
||||||
List<ConnectionObserver> observers;
|
List<ConnectionObserver> observers;
|
||||||
synchronized (this.connectionObservers) {
|
synchronized (this.connectionObservers) {
|
||||||
List<ConnectionObserver> list = this.connectionObservers.getList(message.getKey());
|
List<ConnectionObserver> list = this.connectionObservers.getList(message.getKey());
|
||||||
|
@ -270,6 +277,7 @@ public class CommunicationConnection implements Runnable {
|
||||||
|
|
||||||
for (ConnectionObserver observer : observers) {
|
for (ConnectionObserver observer : observers) {
|
||||||
try {
|
try {
|
||||||
|
logger.info("Notifying observer " + observer.getClass().getSimpleName());
|
||||||
observer.notify(message.getKey(), message);
|
observer.notify(message.getKey(), message);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String msg = "Failed to notify observer for key {0} on message with id {1}"; //$NON-NLS-1$
|
String msg = "Failed to notify observer for key {0} on message with id {1}"; //$NON-NLS-1$
|
||||||
|
@ -335,7 +343,8 @@ public class CommunicationConnection implements Runnable {
|
||||||
* Called when an outgoing message has been handled. This method logs the message state and then notifies all
|
* Called when an outgoing message has been handled. This method logs the message state and then notifies all
|
||||||
* observers
|
* observers
|
||||||
*
|
*
|
||||||
* @param message the message which is done
|
* @param message
|
||||||
|
* the message which is done
|
||||||
*/
|
*/
|
||||||
public void done(IoMessage message) {
|
public void done(IoMessage message) {
|
||||||
ConnectionMessages.assertConfigured(this, "Can not notify observers yet!"); //$NON-NLS-1$
|
ConnectionMessages.assertConfigured(this, "Can not notify observers yet!"); //$NON-NLS-1$
|
||||||
|
@ -390,7 +399,8 @@ public class CommunicationConnection implements Runnable {
|
||||||
* Send the message using the underlying endpoint. Do not change the state of the message, this will be done by the
|
* Send the message using the underlying endpoint. Do not change the state of the message, this will be done by the
|
||||||
* caller
|
* caller
|
||||||
*
|
*
|
||||||
* @param message the message to send
|
* @param message
|
||||||
|
* the message to send
|
||||||
*/
|
*/
|
||||||
public void send(IoMessage message) {
|
public void send(IoMessage message) {
|
||||||
ConnectionMessages.assertConfigured(this, "Can not send yet"); //$NON-NLS-1$
|
ConnectionMessages.assertConfigured(this, "Can not send yet"); //$NON-NLS-1$
|
||||||
|
|
Loading…
Reference in New Issue