diff options
| author | abranson <andrew.branson@cern.ch> | 2011-08-04 00:42:34 +0200 |
|---|---|---|
| committer | abranson <andrew.branson@cern.ch> | 2011-08-04 00:42:34 +0200 |
| commit | 0ec8481c10cd8277d84c7c1a785483a0a739e5a0 (patch) | |
| tree | 5f6e5d9ae75193e67e6f3b3dfa488960c5cde1d5 /source/com/c2kernel/entity/proxy/ProxyServerConnection.java | |
| parent | 036cbdba66f804743c4c838ed598d6972c4b3e17 (diff) | |
More code cleanup:
Refactored Entity Proxy Subscription to handle generics better
Rewrote RemoteMap to use TreeMap instead of the internal array for
order. It now sorts its keys by number if they parse, else as strings.
Removed a no-longer-in-progress outcome form class
Diffstat (limited to 'source/com/c2kernel/entity/proxy/ProxyServerConnection.java')
| -rw-r--r--[-rwxr-xr-x] | source/com/c2kernel/entity/proxy/ProxyServerConnection.java | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/source/com/c2kernel/entity/proxy/ProxyServerConnection.java b/source/com/c2kernel/entity/proxy/ProxyServerConnection.java index 191492f..6807953 100755..100644 --- a/source/com/c2kernel/entity/proxy/ProxyServerConnection.java +++ b/source/com/c2kernel/entity/proxy/ProxyServerConnection.java @@ -10,7 +10,11 @@ package com.c2kernel.entity.proxy;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.InterruptedIOException;
+import java.io.PrintWriter;
import java.net.Socket;
import com.c2kernel.common.InvalidDataException;
@@ -30,7 +34,7 @@ public class ProxyServerConnection extends Thread PrintWriter serverStream;
boolean listening = false;
static boolean isServer = false;
-
+
/**
* Create an entity proxy manager to listen for proxy events and reap unused proxies
*/
@@ -43,8 +47,9 @@ public class ProxyServerConnection extends Thread listening = true;
start();
}
-
- public void run() {
+
+ @Override
+ public void run() {
Thread.currentThread().setName("Proxy Client Connection Listener to "+serverName+":"+serverPort);
while (listening) {
try {
@@ -72,14 +77,14 @@ public class ProxyServerConnection extends Thread try {
serverStream.close();
serverConnection.close();
- } catch (IOException e1) { }
+ } catch (IOException e1) { }
+
-
serverStream = null;
serverConnection = null;
}
}
-
+
if (serverStream != null) {
try {
Logger.msg(1, "Disconnecting from proxy server on "+serverName+":"+serverPort);
@@ -90,9 +95,9 @@ public class ProxyServerConnection extends Thread } catch (Exception e) {
Logger.error("Error disconnecting from proxy server.");
}
- }
+ }
}
-
+
public void connect() {
Logger.msg(3, "ProxyServerConnection - connecting to proxy server on "+serverName+":"+serverPort);
try {
@@ -111,12 +116,12 @@ public class ProxyServerConnection extends Thread serverIsActive = false;
}
}
-
+
public void shutdown() {
Logger.msg("Proxy Client: flagging shutdown.");
listening = false;
}
-
+
/**
* @param sub
*/
|
