Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-06-23 19:14:50 +0000
committerUwe Stieber2014-06-23 19:14:50 +0000
commit39615f42df0bad97f0157eeed85716ff0c3a9d11 (patch)
treeeb236cef2332c05fb57344585dd899a2126fe1e7
parent37a61f9ce77935263805dec639753be2bd06dc7d (diff)
downloadorg.eclipse.tcf-39615f42df0bad97f0157eeed85716ff0c3a9d11.tar.gz
org.eclipse.tcf-39615f42df0bad97f0157eeed85716ff0c3a9d11.tar.xz
org.eclipse.tcf-39615f42df0bad97f0157eeed85716ff0c3a9d11.zip
Target Explorer: Fix doChainValueAdd done callback invoked to early and improved locator communication logging (if enabled)
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.properties2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/LogManager.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/listener/ChannelTraceListenerManager.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/nls/Messages.properties2
6 files changed, 39 insertions, 24 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java
index d232acacd..c60590d50 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java
@@ -1100,9 +1100,16 @@ public final class ChannelManager extends PlatformObject implements IChannelMana
@Override
public void onChannelOpened() {
if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) {
- CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.ChannelManager_openChannel_redirect_succeeded,
- new Object[] { valueAddPeer.get().getID(), finChannel.getRemotePeer().getID(), Integer.valueOf(index.get()) }),
- 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, ChannelManager.this);
+ if (index.get() == 0) {
+ CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.ChannelManager_openChannel_succeeded,
+ new Object[] { valueAddPeer.get().getID(), Integer.valueOf(index.get()), id }),
+ 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, ChannelManager.this);
+
+ } else {
+ CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.ChannelManager_openChannel_redirect_succeeded,
+ new Object[] { valueAddPeer.get().getID(), finChannel.getRemotePeer().getID(), Integer.valueOf(index.get()) }),
+ 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, ChannelManager.this);
+ }
}
// Channel opened. Check if we are done.
@@ -1133,7 +1140,7 @@ public final class ChannelManager extends PlatformObject implements IChannelMana
}
// Redirect the channel to the next value-add in chain
- finChannel.redirect(nextValueAddPeer.get().getAttributes());
+ finChannel.redirect(valueAddPeer.get().getAttributes());
}
}
@@ -1143,9 +1150,15 @@ public final class ChannelManager extends PlatformObject implements IChannelMana
finChannel.removeChannelListener(this);
if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) {
- CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.ChannelManager_openChannel_redirect_failed, valueAddPeer.get().getID(),
- nextValueAddPeer.get() != null ? nextValueAddPeer.get().getID() : id),
- 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, ChannelManager.this);
+ if (index.get() == 0) {
+ CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.ChannelManager_openChannel_failed,
+ new Object[] { valueAddPeer.get().getID(), Integer.valueOf(index.get()), id }),
+ 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, ChannelManager.this);
+
+ } else {
+ CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.ChannelManager_openChannel_redirect_failed, finChannel.getRemotePeer().getID(), valueAddPeer.get().getID()),
+ 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, ChannelManager.this);
+ }
}
// Clean the reference counter and the channel map
@@ -1162,18 +1175,6 @@ public final class ChannelManager extends PlatformObject implements IChannelMana
}
};
channel.addChannelListener(finChannelListener);
-
- // Redirect the channel to the next value-add in chain
- // Note: If the redirect succeeds, channel.getRemotePeer().getID() will be identical to id.
- if (nextValueAddPeer.get() != null) {
- channel.redirect(nextValueAddPeer.get().getAttributes());
- } else {
- // Remove ourself as channel listener
- finChannel.removeChannelListener(finChannelListener);
-
- // No other value-add in the chain -> all done
- done.doneChainValueAdd(null, finChannel);
- }
} else {
// Channel is null? Something went terrible wrong.
done.doneChainValueAdd(new Exception("Unexpected null return value from IPeer#openChannel()!"), null); //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.java
index 0e4852e56..7cf894d30 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.java
@@ -85,6 +85,8 @@ public class Messages extends NLS {
public static String ChannelManager_openChannel_valueAdd_launch_exception;
public static String ChannelManager_openChannel_valueAdd_startChaining;
public static String ChannelManager_openChannel_proxies_startChaining;
+ public static String ChannelManager_openChannel_succeeded;
+ public static String ChannelManager_openChannel_failed;
public static String ChannelManager_openChannel_redirect_succeeded;
public static String ChannelManager_openChannel_redirect_failed;
public static String ChannelManager_openChannel_redirect_invalidChannelState;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.properties
index 3178c140d..f0442d313 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.properties
@@ -26,6 +26,8 @@ ChannelManager_openChannel_valueAdd_launch=Value-add #{0} ({1}): launch {2} (err
ChannelManager_openChannel_valueAdd_launch_exception=Value-add #{0} ({1}): Launch exception was:\n{2}
ChannelManager_openChannel_valueAdd_startChaining=Start chaining of value-add's. Target id = {0}
ChannelManager_openChannel_proxies_startChaining=Start chaining of proxies. Target id = {0}
+ChannelManager_openChannel_succeeded=Successfully opened channel to {0}. Redirect Level = {1}. Target id = {2}
+ChannelManager_openChannel_failed=Failed to open channel to {0}. Redirect Level = {1}. Target id = {2}
ChannelManager_openChannel_redirect_succeeded=Successfully redirected channel from {0} to {1}. Redirect Level = {2}
ChannelManager_openChannel_redirect_failed=Failed to redirect channel from {0} to {1}.
ChannelManager_openChannel_redirect_invalidChannelState=Channel not in open state. Cannot redirect channel to {1}.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/LogManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/LogManager.java
index 611a5ed75..b8aedde23 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/LogManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/LogManager.java
@@ -274,6 +274,11 @@ public final class LogManager implements IProtocolStateChangeListener {
// Get the peer name
logName = peer.getName();
+ // If the locator communication logging is enabled, it will make sense to
+ // also log communication to the proxies which may not have a name attribute set
+ boolean locatorEvents = CoreBundleActivator.getScopedPreferences().getBoolean(IPreferenceKeys.PREF_SHOW_LOCATOR_EVENTS);
+ if (locatorEvents && logName == null) logName = peer.getID();
+
if (logName != null) {
// Get the peer host IP address
String ip = peer.getAttributes().get(IPeer.ATTR_IP_HOST);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/listener/ChannelTraceListenerManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/listener/ChannelTraceListenerManager.java
index 632bab26f..b21440166 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/listener/ChannelTraceListenerManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/listener/ChannelTraceListenerManager.java
@@ -80,11 +80,15 @@ public class ChannelTraceListenerManager {
// The trace listeners can be accessed only via AbstractChannel
if (!(channel instanceof AbstractChannel)) return;
- // If the channel is opened to a ValueAdd, do not write a log file.
- // Logging for value-add's is done through the value-add itself
+ // If the locator events shall be logged, we need to log the communication
+ // to the value-adds as well.
+ boolean locatorEvents = CoreBundleActivator.getScopedPreferences().getBoolean(IPreferenceKeys.PREF_SHOW_LOCATOR_EVENTS);
+
+ // If the channel is opened to a ValueAdd, do not write a log file (except
+ // if the locator communication logging is enabled).
String value = channel.getRemotePeer().getAttributes().get("ValueAdd"); //$NON-NLS-1$
boolean isValueAdd = value != null && ("1".equals(value.trim()) || Boolean.parseBoolean(value.trim())); //$NON-NLS-1$
- if (isValueAdd) return;
+ if (isValueAdd && !locatorEvents) return;
// Get the preference key if or if not logging is enabled
boolean loggingEnabled = CoreBundleActivator.getScopedPreferences().getBoolean(IPreferenceKeys.PREF_LOGGING_ENABLED);
@@ -107,7 +111,8 @@ public class ChannelTraceListenerManager {
String message = NLS.bind(Messages.ChannelTraceListener_channelOpened_message,
new Object[] {
date,
- Integer.toHexString(channel.hashCode())
+ Integer.toHexString(channel.hashCode()),
+ isValueAdd ? "[" + channel.getRemotePeer().getID() + "]" : "" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
});
// Get the file writer
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/nls/Messages.properties
index 868c0ebea..d952c99d0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.log.core/src/org/eclipse/tcf/te/tcf/log/core/internal/nls/Messages.properties
@@ -8,7 +8,7 @@
# Wind River Systems - initial API and implementation
###############################################################################
-ChannelTraceListener_channelOpened_message=# {0}: Opened channel {1}
+ChannelTraceListener_channelOpened_message=# {0}: Opened channel {1} {2}
ChannelTraceListener_channelClosed_message=# {0}: Closed channel {1} (error={2})
LogManager_dispose_message=# {0}: Closed session

Back to the top