Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2004-12-29 23:33:38 +0000
committerslewis2004-12-29 23:33:38 +0000
commite7f33c81e033a48f80a0821277f3c3c5667a699e (patch)
treec1b3f8ea6abbcb415d33e7796702310de18a35b5
parent988adbc7f32e6dff8756850b1c8d970345156758 (diff)
downloadorg.eclipse.ecf-e7f33c81e033a48f80a0821277f3c3c5667a699e.tar.gz
org.eclipse.ecf-e7f33c81e033a48f80a0821277f3c3c5667a699e.tar.xz
org.eclipse.ecf-e7f33c81e033a48f80a0821277f3c3c5667a699e.zip
Added tracing to org.eclipe.ecf.provider plugin
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/.options3
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/Trace.java (renamed from framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/Debug.java)12
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java26
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectInputStream.java12
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectOutputStream.java8
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Server.java14
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOWrapper.java18
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPServerSOContainerGroup.java14
8 files changed, 56 insertions, 51 deletions
diff --git a/framework/bundles/org.eclipse.ecf.provider/.options b/framework/bundles/org.eclipse.ecf.provider/.options
new file mode 100644
index 000000000..34aa5dee7
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.provider/.options
@@ -0,0 +1,3 @@
+org.eclipse.ecf.provider/debug = true
+org.eclipse.ecf.provider/debug/flag = true
+org.eclipse.ecf.provider/debug/filter = *
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/Debug.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/Trace.java
index 497eed1d3..c8fd8dc1d 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/Debug.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/Trace.java
@@ -1,11 +1,13 @@
package org.eclipse.ecf.provider;
-public class Debug {
+import org.eclipse.core.runtime.Platform;
- public static boolean ON = false;
+public class Trace {
+
+ public static boolean ON = Platform.inDebugMode();
- public static Debug create(String key) {
- return new Debug(key);
+ public static Trace create(String key) {
+ return new Trace(key);
}
public static void errDumpStack(Throwable e, String msg) {
@@ -19,7 +21,7 @@ public class Debug {
public void msg(String msg) {
System.err.println(msg);
}
- protected Debug(String str) {
+ protected Trace(String str) {
}
public static void setThreadDebugGroup(Object obj) {
// Do nothing
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
index d807e548e..3ee916a65 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java
@@ -28,7 +28,7 @@ import org.eclipse.ecf.core.comm.provider.ISynchAsynchConnectionInstantiator;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.identity.IDFactory;
import org.eclipse.ecf.core.util.SimpleQueueImpl;
-import org.eclipse.ecf.provider.Debug;
+import org.eclipse.ecf.provider.Trace;
public final class Client implements ISynchAsynchConnection {
@@ -51,7 +51,7 @@ public final class Client implements ISynchAsynchConnection {
}
public static final String PROTOCOL = "ecftcp";
- public static final Debug debug = Debug.create(Client.class.getName());
+ public static final Trace debug = Trace.create(Client.class.getName());
public static final int SNDR_PRIORITY = Thread.NORM_PRIORITY;
public static final int RCVR_PRIORITY = Thread.NORM_PRIORITY;
@@ -198,7 +198,7 @@ public final class Client implements ISynchAsynchConnection {
if (fact == null) {
fact = SocketFactory.getDefaultSocketFactory();
}
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Connecting to " + address + ":" + port);
}
// Actually connect to remote using socket from socket factory.
@@ -266,7 +266,7 @@ public final class Client implements ISynchAsynchConnection {
msgCount++;
} catch (IOException e) {
// Log to stderr
- Debug.errDumpStack(e, "Exception in sender thread for "
+ Trace.errDumpStack(e, "Exception in sender thread for "
+ address + ":" + port);
if (isClosing) {
@@ -285,7 +285,7 @@ public final class Client implements ISynchAsynchConnection {
break;
}
}
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Sndr for " + address + ":" + port
+ " terminating.");
}
@@ -352,10 +352,10 @@ public final class Client implements ISynchAsynchConnection {
handleRcv(readObject());
} catch (IOException e) {
// Log to stderr
- Debug.errDumpStack(e, "Exception in read thread for "
+ Trace.errDumpStack(e, "Exception in read thread for "
+ address + ":" + port);
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(e, "Exception in read thread for "
+ address + ":" + port + ": "
+ e.getMessage());
@@ -376,7 +376,7 @@ public final class Client implements ISynchAsynchConnection {
break;
}
}
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Rcvr for " + address + ":" + port
+ " terminating.");
}
@@ -464,10 +464,10 @@ public final class Client implements ISynchAsynchConnection {
}
} catch (Exception e) {
// Log to stderr
- Debug.errDumpStack(e, "Exception in ping thread for "
+ Trace.errDumpStack(e, "Exception in ping thread for "
+ address + ":" + port);
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(e, "Exception in ping.");
}
if (isClosing) {
@@ -486,7 +486,7 @@ public final class Client implements ISynchAsynchConnection {
break;
}
}
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Keepalive terminating.");
}
}
@@ -494,7 +494,7 @@ public final class Client implements ISynchAsynchConnection {
}
public synchronized void disconnect() throws IOException {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("disconnect()");
}
// Close send queue and socket
@@ -550,7 +550,7 @@ public final class Client implements ISynchAsynchConnection {
try {
ret = (Serializable) inputStream.readObject();
} catch (ClassNotFoundException e) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(e, "Class not found exception");
}
throw new IOException(
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectInputStream.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectInputStream.java
index 4f6853a59..621de79bd 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectInputStream.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectInputStream.java
@@ -4,19 +4,19 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
-import org.eclipse.ecf.provider.Debug;
+import org.eclipse.ecf.provider.Trace;
public class ExObjectInputStream extends ObjectInputStream {
private boolean replace = false;
- public static final Debug debug = Debug.create(ExObjectInputStream.class
+ public static final Trace debug = Trace.create(ExObjectInputStream.class
.getName());
public ExObjectInputStream(InputStream in) throws IOException,
SecurityException {
super(in);
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("ExObjectInputStream(" + in + ")");
}
}
@@ -24,7 +24,7 @@ public class ExObjectInputStream extends ObjectInputStream {
public ExObjectInputStream(InputStream in, boolean backwardCompatibility)
throws IOException, SecurityException {
super(in);
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("ExObjectInputStream(" + in + "," + backwardCompatibility
+ ")");
}
@@ -41,12 +41,12 @@ public class ExObjectInputStream extends ObjectInputStream {
}
protected void debug(String msg) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg(msg);
}
}
protected void debug(String msg, Throwable t) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(t, msg);
}
}
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectOutputStream.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectOutputStream.java
index ffb02010c..f71c6e249 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectOutputStream.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/ExObjectOutputStream.java
@@ -4,13 +4,13 @@ import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
-import org.eclipse.ecf.provider.Debug;
+import org.eclipse.ecf.provider.Trace;
public class ExObjectOutputStream extends ObjectOutputStream {
private boolean replace = false;
- public static final Debug debug = Debug.create(ExObjectOutputStream.class
+ public static final Trace debug = Trace.create(ExObjectOutputStream.class
.getName());
public ExObjectOutputStream(OutputStream out) throws IOException {
@@ -33,12 +33,12 @@ public class ExObjectOutputStream extends ObjectOutputStream {
}
}
protected void debug(String msg) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg(msg);
}
}
protected void debug(String msg, Throwable t) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(t, msg);
}
}
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Server.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Server.java
index 694cfabcb..590788f39 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Server.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Server.java
@@ -4,10 +4,10 @@ import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
-import org.eclipse.ecf.provider.Debug;
+import org.eclipse.ecf.provider.Trace;
public class Server extends ServerSocket {
- public static Debug debug = Debug.create(Server.class.getName());
+ public static Trace debug = Trace.create(Server.class.getName());
ISocketAcceptHandler acceptHandler;
@@ -36,7 +36,7 @@ public class Server extends ServerSocket {
try {
handleAccept(accept());
} catch (Exception e) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(e, "Exception in accept");
}
// If we get an exception on accept(), we should just
@@ -44,7 +44,7 @@ public class Server extends ServerSocket {
break;
}
}
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Closing listener normally.");
}
}
@@ -57,7 +57,7 @@ public class Server extends ServerSocket {
try {
acceptHandler.handleAccept(aSocket);
} catch (Exception e) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(e,
"Unexplained exception in connect. Closing.");
}
@@ -67,7 +67,7 @@ public class Server extends ServerSocket {
}
;
} finally {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("handleAcceptAsych terminating.");
}
}
@@ -76,7 +76,7 @@ public class Server extends ServerSocket {
}
public synchronized void close() throws IOException {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("close()");
}
super.close();
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOWrapper.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOWrapper.java
index 93b4a17ce..e1982adf3 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOWrapper.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOWrapper.java
@@ -14,11 +14,11 @@ import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.util.AsynchResult;
import org.eclipse.ecf.core.util.Event;
import org.eclipse.ecf.core.util.SimpleQueueImpl;
-import org.eclipse.ecf.provider.Debug;
+import org.eclipse.ecf.provider.Trace;
import org.eclipse.ecf.provider.generic.gmm.Member;
final class SOWrapper {
- static Debug debug = Debug.create(SOWrapper.class.getName());
+ static Trace debug = Trace.create(SOWrapper.class.getName());
protected ISharedObject sharedObject;
private SOConfig sharedObjectConfig;
@@ -116,12 +116,12 @@ final class SOWrapper {
return container.getNewSharedObjectThread(sharedObjectID,
new Runnable() {
public void run() {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Starting runner for " + sharedObjectID);
}
// The debug class will associate this thread with
// container
- Debug.setThreadDebugGroup(container.getID());
+ Trace.setThreadDebugGroup(container.getID());
// Then process messages on queue until interrupted or
// queue closed
//Msg aMsg = null;
@@ -145,7 +145,7 @@ final class SOWrapper {
SOWrapper.this.doDestroy();
}
} catch (Throwable t) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(t,
"Exception executing event " + evt
+ " on meta " + this);
@@ -156,14 +156,14 @@ final class SOWrapper {
// If the thread was interrupted, then show appropriate
// spam
if (Thread.currentThread().isInterrupted()) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug
.msg("Runner for "
+ sharedObjectID
+ " terminating after being interrupted");
}
} else {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Runner for " + sharedObjectID
+ " terminating normally");
}
@@ -268,12 +268,12 @@ final class SOWrapper {
return sb.toString();
}
void handleRuntimeException(Throwable except) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(except, "handleRuntimeException called for "
+ sharedObjectID);
}
try {
- Debug.errDumpStack(except, "handleRuntimeException called for "
+ Trace.errDumpStack(except, "handleRuntimeException called for "
+ sharedObjectID);
} catch (Throwable e) {
}
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPServerSOContainerGroup.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPServerSOContainerGroup.java
index 865ff914f..e1a9df9ad 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPServerSOContainerGroup.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/TCPServerSOContainerGroup.java
@@ -9,7 +9,7 @@ import java.io.Serializable;
import java.net.Socket;
import java.net.URI;
-import org.eclipse.ecf.provider.Debug;
+import org.eclipse.ecf.provider.Trace;
import org.eclipse.ecf.core.comm.ConnectionRequestHandler;
import org.eclipse.ecf.provider.comm.tcp.Client;
import org.eclipse.ecf.provider.comm.tcp.ConnectRequestMessage;
@@ -24,7 +24,7 @@ public class TCPServerSOContainerGroup extends SOContainerGroup implements
public static final String INVALID_CONNECT = "Invalid connect request. ";
- public static final Debug debug = Debug
+ public static final Trace debug = Trace
.create(TCPServerSOContainerGroup.class.getName());
public static final String DEFAULT_GROUP_NAME = TCPServerSOContainerGroup.class
.getName();
@@ -49,7 +49,7 @@ public class TCPServerSOContainerGroup extends SOContainerGroup implements
}
public synchronized void putOnTheAir() throws IOException {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Putting group " + this + " on the air.");
}
listener = new Server(threadGroup, port, this);
@@ -71,7 +71,7 @@ public class TCPServerSOContainerGroup extends SOContainerGroup implements
ConnectRequestMessage req = (ConnectRequestMessage) iStream
.readObject();
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Got connect request " + req);
}
if (req == null)
@@ -88,7 +88,7 @@ public class TCPServerSOContainerGroup extends SOContainerGroup implements
+ "Target path is null");
TCPServerSOContainer srs = (TCPServerSOContainer) get(path);
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Found container with " + srs.getID().getName()
+ " for target " + uri);
}
@@ -115,13 +115,13 @@ public class TCPServerSOContainerGroup extends SOContainerGroup implements
public synchronized void takeOffTheAir() {
if (listener != null) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.msg("Taking " + getName() + " on the air.");
}
try {
listener.close();
} catch (IOException e) {
- if (Debug.ON && debug != null) {
+ if (Trace.ON && debug != null) {
debug.dumpStack(e, "Exception in closeListener");
}
}

Back to the top