summaryrefslogtreecommitdiff
path: root/cs/demo
diff options
context:
space:
mode:
Diffstat (limited to 'cs/demo')
-rw-r--r--cs/demo/Glacier2/callback/CallbackI.cs32
-rw-r--r--cs/demo/Glacier2/callback/Client.cs216
-rw-r--r--cs/demo/Glacier2/callback/Server.cs2
-rw-r--r--cs/demo/Glacier2/callback/SessionI.cs6
-rw-r--r--cs/demo/Glacier2/callback/SessionManagerI.cs6
-rw-r--r--cs/demo/Glacier2/callback/SessionServer.cs24
-rw-r--r--cs/demo/Ice/async/Client.cs54
-rw-r--r--cs/demo/Ice/async/HelloI.cs6
-rw-r--r--cs/demo/Ice/async/Server.cs40
-rw-r--r--cs/demo/Ice/async/WorkQueue.cs128
-rwxr-xr-xcs/demo/Ice/bidir/CallbackSenderI.cs88
-rwxr-xr-xcs/demo/Ice/bidir/Client.cs14
-rwxr-xr-xcs/demo/Ice/bidir/Server.cs22
-rwxr-xr-xcs/demo/Ice/callback/CallbackSenderI.cs32
-rwxr-xr-xcs/demo/Ice/callback/Client.cs122
-rwxr-xr-xcs/demo/Ice/hello/Client.cs130
-rwxr-xr-xcs/demo/Ice/hello/HelloI.cs6
-rwxr-xr-xcs/demo/Ice/hello/Server.cs8
-rwxr-xr-xcs/demo/Ice/latency/Client.cs30
-rwxr-xr-xcs/demo/Ice/minimal/Client.cs22
-rwxr-xr-xcs/demo/Ice/minimal/Server.cs10
-rwxr-xr-xcs/demo/Ice/nested/Client.cs2
-rwxr-xr-xcs/demo/Ice/session/Client.cs358
-rwxr-xr-xcs/demo/Ice/session/HelloI.cs8
-rwxr-xr-xcs/demo/Ice/session/ReapThread.cs114
-rwxr-xr-xcs/demo/Ice/session/Server.cs20
-rwxr-xr-xcs/demo/Ice/session/SessionFactoryI.cs14
-rwxr-xr-xcs/demo/Ice/session/SessionI.cs136
-rwxr-xr-xcs/demo/Ice/throughput/Client.cs98
-rwxr-xr-xcs/demo/Ice/throughput/ThroughputI.cs42
-rwxr-xr-xcs/demo/Ice/value/Client.cs8
-rwxr-xr-xcs/demo/Ice/value/InitialI.cs2
-rw-r--r--cs/demo/IceBox/hello/Client.cs114
-rw-r--r--cs/demo/IceGrid/allocate/Client.cs288
-rw-r--r--cs/demo/IceGrid/allocate/HelloI.cs2
-rw-r--r--cs/demo/IceGrid/allocate/Server.cs8
-rw-r--r--cs/demo/IceGrid/sessionActivation/Client.cs274
-rw-r--r--cs/demo/IceGrid/sessionActivation/HelloI.cs2
-rw-r--r--cs/demo/IceGrid/sessionActivation/Server.cs8
-rw-r--r--cs/demo/IceGrid/simple/Client.cs20
-rw-r--r--cs/demo/IceGrid/simple/HelloI.cs2
-rw-r--r--cs/demo/IceGrid/simple/Server.cs8
-rwxr-xr-xcs/demo/IceStorm/clock/Publisher.cs138
-rwxr-xr-xcs/demo/IceStorm/clock/Subscriber.cs190
-rwxr-xr-xcs/demo/book/evictor/EvictorBase.cs252
-rwxr-xr-xcs/demo/book/evictor/LinkedList.cs466
-rwxr-xr-xcs/demo/book/printer/Client.cs48
-rwxr-xr-xcs/demo/book/printer/Printer.ice2
-rwxr-xr-xcs/demo/book/printer/Server.cs52
-rwxr-xr-xcs/demo/book/simple_filesystem/Client.cs100
-rwxr-xr-xcs/demo/book/simple_filesystem/DirectoryI.cs36
-rwxr-xr-xcs/demo/book/simple_filesystem/FileI.cs32
-rwxr-xr-xcs/demo/book/simple_filesystem/Filesystem.ice10
-rwxr-xr-xcs/demo/book/simple_filesystem/Server.cs104
54 files changed, 1978 insertions, 1978 deletions
diff --git a/cs/demo/Glacier2/callback/CallbackI.cs b/cs/demo/Glacier2/callback/CallbackI.cs
index b6c30f0a334..20d05798817 100644
--- a/cs/demo/Glacier2/callback/CallbackI.cs
+++ b/cs/demo/Glacier2/callback/CallbackI.cs
@@ -15,26 +15,26 @@ public sealed class CallbackI : CallbackDisp_
public override void initiateCallback(CallbackReceiverPrx proxy, Ice.Current current)
{
Console.WriteLine("initiating callback");
- try
- {
- proxy.callback(current.ctx);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
+ try
+ {
+ proxy.callback(current.ctx);
+ }
+ catch(System.Exception ex)
+ {
+ Console.Error.WriteLine(ex);
+ }
}
public override void shutdown(Ice.Current current)
{
Console.WriteLine("Shutting down...");
- try
- {
- current.adapter.getCommunicator().shutdown();
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
+ try
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+ catch(System.Exception ex)
+ {
+ Console.Error.WriteLine(ex);
+ }
}
}
diff --git a/cs/demo/Glacier2/callback/Client.cs b/cs/demo/Glacier2/callback/Client.cs
index 0cf11f23ecc..7c86c12137c 100644
--- a/cs/demo/Glacier2/callback/Client.cs
+++ b/cs/demo/Glacier2/callback/Client.cs
@@ -21,8 +21,8 @@ public class Client : Ice.Application
"o: send callback as oneway\n" +
"O: send callback as batch oneway\n" +
"f: flush all batch requests\n" +
- "v: set/reset override context field\n" +
- "F: set/reset fake category\n" +
+ "v: set/reset override context field\n" +
+ "F: set/reset fake category\n" +
"s: shutdown server\n" +
"x: exit\n" +
"?: help\n");
@@ -30,56 +30,56 @@ public class Client : Ice.Application
public override int run(string[] args)
{
- Ice.RouterPrx defaultRouter = communicator().getDefaultRouter();
- if(defaultRouter == null)
- {
- Console.Error.WriteLine("no default router set");
- return 1;
- }
-
- Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(defaultRouter);
- if(router == null)
- {
- Console.Error.WriteLine("configured router is not a Glacier2 router");
- return 1;
- }
+ Ice.RouterPrx defaultRouter = communicator().getDefaultRouter();
+ if(defaultRouter == null)
+ {
+ Console.Error.WriteLine("no default router set");
+ return 1;
+ }
+
+ Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(defaultRouter);
+ if(router == null)
+ {
+ Console.Error.WriteLine("configured router is not a Glacier2 router");
+ return 1;
+ }
- while(true)
- {
- Console.WriteLine("This demo accepts any user-id / password combination.");
+ while(true)
+ {
+ Console.WriteLine("This demo accepts any user-id / password combination.");
- String id;
- Console.Write("user id: ");
- Console.Out.Flush();
- id = Console.In.ReadLine();
-
- String pw;
- Console.Write("password: ");
- Console.Out.Flush();
- pw = Console.In.ReadLine();
-
- try
- {
- router.createSession(id, pw);
- break;
- }
- catch(Glacier2.PermissionDeniedException ex)
- {
- Console.Write("permission denied:\n" + ex.reason);
- }
- catch(Glacier2.CannotCreateSessionException ex)
- {
- Console.Write("cannot create session:\n" + ex.reason);
- }
- }
+ String id;
+ Console.Write("user id: ");
+ Console.Out.Flush();
+ id = Console.In.ReadLine();
+
+ String pw;
+ Console.Write("password: ");
+ Console.Out.Flush();
+ pw = Console.In.ReadLine();
+
+ try
+ {
+ router.createSession(id, pw);
+ break;
+ }
+ catch(Glacier2.PermissionDeniedException ex)
+ {
+ Console.Write("permission denied:\n" + ex.reason);
+ }
+ catch(Glacier2.CannotCreateSessionException ex)
+ {
+ Console.Write("cannot create session:\n" + ex.reason);
+ }
+ }
- String category = router.getCategoryForClient();
- Ice.Identity callbackReceiverIdent = new Ice.Identity();
- callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = category;
- Ice.Identity callbackReceiverFakeIdent = new Ice.Identity();
- callbackReceiverFakeIdent.name = "callbackReceiver";
- callbackReceiverFakeIdent.category = "fake";
+ String category = router.getCategoryForClient();
+ Ice.Identity callbackReceiverIdent = new Ice.Identity();
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = category;
+ Ice.Identity callbackReceiverFakeIdent = new Ice.Identity();
+ callbackReceiverFakeIdent.name = "callbackReceiver";
+ callbackReceiverFakeIdent.category = "fake";
Ice.ObjectPrx @base = communicator().propertyToProxy("Callback.Proxy");
CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base);
@@ -92,14 +92,14 @@ public class Client : Ice.Application
adapter.activate();
CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- adapter.createProxy(callbackReceiverIdent));
+ adapter.createProxy(callbackReceiverIdent));
CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
menu();
string line = null;
- string @override = null;
- bool fake = false;
+ string @override = null;
+ bool fake = false;
do
{
try
@@ -113,73 +113,73 @@ public class Client : Ice.Application
}
if(line.Equals("t"))
{
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "t";
- if(@override != null)
- {
- context["_ovrd"] = @override;
- }
+ Ice.Context context = new Ice.Context();
+ context["_fwd"] = "t";
+ if(@override != null)
+ {
+ context["_ovrd"] = @override;
+ }
twoway.initiateCallback(twowayR, context);
}
else if(line.Equals("o"))
{
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "o";
- if(@override != null)
- {
- context["_ovrd"] = @override;
- }
+ Ice.Context context = new Ice.Context();
+ context["_fwd"] = "o";
+ if(@override != null)
+ {
+ context["_ovrd"] = @override;
+ }
oneway.initiateCallback(onewayR, context);
}
else if(line.Equals("O"))
{
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "O";
- if(@override != null)
- {
- context["_ovrd"] = @override;
- }
- batchOneway.initiateCallback(onewayR, context);
+ Ice.Context context = new Ice.Context();
+ context["_fwd"] = "O";
+ if(@override != null)
+ {
+ context["_ovrd"] = @override;
+ }
+ batchOneway.initiateCallback(onewayR, context);
}
else if(line.Equals("f"))
{
- communicator().flushBatchRequests();
+ communicator().flushBatchRequests();
+ }
+ else if(line.Equals("v"))
+ {
+ if(@override == null)
+ {
+ @override = "some_value";
+ Console.WriteLine("override context field is now `" + @override + "'");
+ }
+ else
+ {
+ @override = null;
+ Console.WriteLine("override context field is empty");
+ }
+ }
+ else if(line.Equals("F"))
+ {
+ fake = !fake;
+
+ if(fake)
+ {
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ twowayR.ice_identity(callbackReceiverFakeIdent));
+ onewayR = CallbackReceiverPrxHelper.uncheckedCast(
+ onewayR.ice_identity(callbackReceiverFakeIdent));
+ }
+ else
+ {
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ twowayR.ice_identity(callbackReceiverIdent));
+ onewayR = CallbackReceiverPrxHelper.uncheckedCast(
+ onewayR.ice_identity(callbackReceiverIdent));
+ }
+
+ Console.WriteLine("callback receiver identity: " +
+ communicator().identityToString(twowayR.ice_getIdentity()));
}
- else if(line.Equals("v"))
- {
- if(@override == null)
- {
- @override = "some_value";
- Console.WriteLine("override context field is now `" + @override + "'");
- }
- else
- {
- @override = null;
- Console.WriteLine("override context field is empty");
- }
- }
- else if(line.Equals("F"))
- {
- fake = !fake;
-
- if(fake)
- {
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- twowayR.ice_identity(callbackReceiverFakeIdent));
- onewayR = CallbackReceiverPrxHelper.uncheckedCast(
- onewayR.ice_identity(callbackReceiverFakeIdent));
- }
- else
- {
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- twowayR.ice_identity(callbackReceiverIdent));
- onewayR = CallbackReceiverPrxHelper.uncheckedCast(
- onewayR.ice_identity(callbackReceiverIdent));
- }
-
- Console.WriteLine("callback receiver identity: " +
- communicator().identityToString(twowayR.ice_getIdentity()));
- }
else if(line.Equals("s"))
{
twoway.shutdown();
@@ -215,6 +215,6 @@ public class Client : Ice.Application
if(status != 0)
{
System.Environment.Exit(status);
- }
+ }
}
}
diff --git a/cs/demo/Glacier2/callback/Server.cs b/cs/demo/Glacier2/callback/Server.cs
index 8e735d51712..6b8b66bdd2d 100644
--- a/cs/demo/Glacier2/callback/Server.cs
+++ b/cs/demo/Glacier2/callback/Server.cs
@@ -16,7 +16,7 @@ public class Server : Ice.Application
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server");
adapter.add(new CallbackI(), communicator().stringToIdentity("callback"));
adapter.activate();
- communicator().waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
diff --git a/cs/demo/Glacier2/callback/SessionI.cs b/cs/demo/Glacier2/callback/SessionI.cs
index 3aec1b50c6e..f4a23d1dc43 100644
--- a/cs/demo/Glacier2/callback/SessionI.cs
+++ b/cs/demo/Glacier2/callback/SessionI.cs
@@ -13,13 +13,13 @@ public sealed class SessionI : Glacier2.SessionDisp_
{
public SessionI(string userId)
{
- _userId = userId;
+ _userId = userId;
}
public override void destroy(Ice.Current current)
{
- Console.WriteLine("destroying session for user `" + _userId + "'");
- current.adapter.remove(current.id);
+ Console.WriteLine("destroying session for user `" + _userId + "'");
+ current.adapter.remove(current.id);
}
private readonly string _userId;
diff --git a/cs/demo/Glacier2/callback/SessionManagerI.cs b/cs/demo/Glacier2/callback/SessionManagerI.cs
index 918786cc528..776944f72d6 100644
--- a/cs/demo/Glacier2/callback/SessionManagerI.cs
+++ b/cs/demo/Glacier2/callback/SessionManagerI.cs
@@ -13,8 +13,8 @@ public sealed class SessionManagerI : Glacier2.SessionManagerDisp_
{
public override Glacier2.SessionPrx create(string userId, Glacier2.SessionControlPrx control, Ice.Current current)
{
- Console.WriteLine("creating session for user `" + userId + "'");
- Glacier2.Session session = new SessionI(userId);
- return Glacier2.SessionPrxHelper.uncheckedCast(current.adapter.addWithUUID(session));
+ Console.WriteLine("creating session for user `" + userId + "'");
+ Glacier2.Session session = new SessionI(userId);
+ return Glacier2.SessionPrxHelper.uncheckedCast(current.adapter.addWithUUID(session));
}
}
diff --git a/cs/demo/Glacier2/callback/SessionServer.cs b/cs/demo/Glacier2/callback/SessionServer.cs
index e1edbb601ab..760d9f93042 100644
--- a/cs/demo/Glacier2/callback/SessionServer.cs
+++ b/cs/demo/Glacier2/callback/SessionServer.cs
@@ -13,27 +13,27 @@ public class SessionServer : Ice.Application
{
sealed class DummyPermissionVerifierI : Glacier2.PermissionsVerifierDisp_
{
- public override bool checkPermissions(String userId, String password, out string reason, Ice.Current current)
- {
+ public override bool checkPermissions(String userId, String password, out string reason, Ice.Current current)
+ {
reason = null;
- Console.WriteLine("verified user `" + userId + "' with password `" + password + "'");
- return true;
- }
+ Console.WriteLine("verified user `" + userId + "' with password `" + password + "'");
+ return true;
+ }
};
public override int run(string[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SessionServer");
- adapter.add(new DummyPermissionVerifierI(), communicator().stringToIdentity("verifier"));
- adapter.add(new SessionManagerI(), communicator().stringToIdentity("sessionmanager"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SessionServer");
+ adapter.add(new DummyPermissionVerifierI(), communicator().stringToIdentity("verifier"));
+ adapter.add(new SessionManagerI(), communicator().stringToIdentity("sessionmanager"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
}
public static void Main(string[] args)
{
- SessionServer app = new SessionServer();
+ SessionServer app = new SessionServer();
int status = app.main(args, "config.sessionserver");
if(status != 0)
{
diff --git a/cs/demo/Ice/async/Client.cs b/cs/demo/Ice/async/Client.cs
index b22b2c98113..ed74f2043da 100644
--- a/cs/demo/Ice/async/Client.cs
+++ b/cs/demo/Ice/async/Client.cs
@@ -15,20 +15,20 @@ public class Client : Ice.Application
public class AMI_Hello_sayHelloI : AMI_Hello_sayHello
{
public override void ice_response()
- {
- }
+ {
+ }
- public override void ice_exception(Ice.Exception ex)
- {
- if(ex is RequestCanceledException)
- {
- Console.Error.WriteLine("Request canceled");
- }
- else
- {
- Console.Error.WriteLine(ex);
- }
- }
+ public override void ice_exception(Ice.Exception ex)
+ {
+ if(ex is RequestCanceledException)
+ {
+ Console.Error.WriteLine("Request canceled");
+ }
+ else
+ {
+ Console.Error.WriteLine(ex);
+ }
+ }
}
private static void menu()
@@ -59,31 +59,31 @@ public class Client : Ice.Application
try
{
Console.Out.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
if(line == null)
{
break;
}
if(line.Equals("i"))
- {
- hello.sayHello(0);
- }
+ {
+ hello.sayHello(0);
+ }
else if(line.Equals("d"))
{
hello.sayHello_async(new AMI_Hello_sayHelloI(), 5000);
}
else if(line.Equals("s"))
- {
- hello.shutdown();
- }
+ {
+ hello.shutdown();
+ }
else if(line.Equals("x"))
{
// Nothing to do
}
else if(line.Equals("?"))
{
- menu();
+ menu();
}
else
{
@@ -93,7 +93,7 @@ public class Client : Ice.Application
}
catch(Ice.Exception ex)
{
- Console.Error.WriteLine(ex);
+ Console.Error.WriteLine(ex);
}
}
while(!line.Equals("x"));
@@ -105,9 +105,9 @@ public class Client : Ice.Application
{
Client app = new Client();
int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ if(status != 0)
+ {
+ System.Environment.Exit(status);
+ }
}
}
diff --git a/cs/demo/Ice/async/HelloI.cs b/cs/demo/Ice/async/HelloI.cs
index 10ab48b53bc..4d7f51facc2 100644
--- a/cs/demo/Ice/async/HelloI.cs
+++ b/cs/demo/Ice/async/HelloI.cs
@@ -22,7 +22,7 @@ public class HelloI : HelloDisp_
if(delay == 0)
{
Console.Out.WriteLine("Hello World!");
- cb.ice_response();
+ cb.ice_response();
}
else
{
@@ -33,9 +33,9 @@ public class HelloI : HelloDisp_
public override void shutdown(Ice.Current current)
{
_workQueue.destroy();
- _workQueue.Join();
+ _workQueue.Join();
- current.adapter.getCommunicator().shutdown();
+ current.adapter.getCommunicator().shutdown();
}
private WorkQueue _workQueue;
diff --git a/cs/demo/Ice/async/Server.cs b/cs/demo/Ice/async/Server.cs
index 96eec8d302d..e0363683017 100644
--- a/cs/demo/Ice/async/Server.cs
+++ b/cs/demo/Ice/async/Server.cs
@@ -14,10 +14,10 @@ public class Server : Ice.Application
callbackOnInterrupt();
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- _workQueue = new WorkQueue();
+ _workQueue = new WorkQueue();
adapter.add(new HelloI(_workQueue), communicator().stringToIdentity("hello"));
- _workQueue.Start();
+ _workQueue.Start();
adapter.activate();
communicator().waitForShutdown();
@@ -27,30 +27,30 @@ public class Server : Ice.Application
public override void interruptCallback(int sig)
{
_workQueue.destroy();
- _workQueue.Join();
-
- try
- {
- communicator().destroy();
- }
- catch(Ice.Exception ex)
- {
- System.Console.Error.WriteLine(appName() + ": " + ex);
- }
- catch(System.Exception ex)
- {
- System.Console.Error.WriteLine(appName() + ": unknown exception: " + ex);
- }
+ _workQueue.Join();
+
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.Exception ex)
+ {
+ System.Console.Error.WriteLine(appName() + ": " + ex);
+ }
+ catch(System.Exception ex)
+ {
+ System.Console.Error.WriteLine(appName() + ": unknown exception: " + ex);
+ }
}
public static void Main(string[] args)
{
Server app = new Server();
int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ if(status != 0)
+ {
+ System.Environment.Exit(status);
+ }
}
private WorkQueue _workQueue;
diff --git a/cs/demo/Ice/async/WorkQueue.cs b/cs/demo/Ice/async/WorkQueue.cs
index 186ed6349a2..e5f0e5ba306 100644
--- a/cs/demo/Ice/async/WorkQueue.cs
+++ b/cs/demo/Ice/async/WorkQueue.cs
@@ -17,7 +17,7 @@ public class WorkQueue
private class CallbackEntry
{
public AMD_Hello_sayHello cb;
- public int delay;
+ public int delay;
}
public void Join()
@@ -28,89 +28,89 @@ public class WorkQueue
public void Start()
{
thread_ = new Thread(new ThreadStart(Run));
- thread_.Start();
+ thread_.Start();
}
public void Run()
{
lock(this)
- {
- while(!_done)
- {
- if(_callbacks.Count == 0)
- {
- Monitor.Wait(this);
- }
+ {
+ while(!_done)
+ {
+ if(_callbacks.Count == 0)
+ {
+ Monitor.Wait(this);
+ }
- if(_callbacks.Count != 0)
- {
- //
- // Get next work item.
- //
- CallbackEntry entry = (CallbackEntry)_callbacks[0];
+ if(_callbacks.Count != 0)
+ {
+ //
+ // Get next work item.
+ //
+ CallbackEntry entry = (CallbackEntry)_callbacks[0];
- //
- // Wait for the amount of time indicated in delay to
- // emulate a process that takes a significant period of
- // time to complete.
- //
- Monitor.Wait(this, entry.delay);
+ //
+ // Wait for the amount of time indicated in delay to
+ // emulate a process that takes a significant period of
+ // time to complete.
+ //
+ Monitor.Wait(this, entry.delay);
- if(!_done)
- {
- //
- // Print greeting and send response.
- //
- _callbacks.RemoveAt(0);
- Console.Out.WriteLine("Belated Hello World!");
- entry.cb.ice_response();
- }
- }
- }
+ if(!_done)
+ {
+ //
+ // Print greeting and send response.
+ //
+ _callbacks.RemoveAt(0);
+ Console.Out.WriteLine("Belated Hello World!");
+ entry.cb.ice_response();
+ }
+ }
+ }
- foreach(CallbackEntry e in _callbacks)
- {
- e.cb.ice_exception(new RequestCanceledException());
- }
- }
+ foreach(CallbackEntry e in _callbacks)
+ {
+ e.cb.ice_exception(new RequestCanceledException());
+ }
+ }
}
public void Add(AMD_Hello_sayHello cb, int delay)
{
lock(this)
- {
- if(!_done)
- {
- //
- // Add the work item.
- //
- CallbackEntry entry = new CallbackEntry();
- entry.cb = cb;
- entry.delay = delay;
+ {
+ if(!_done)
+ {
+ //
+ // Add the work item.
+ //
+ CallbackEntry entry = new CallbackEntry();
+ entry.cb = cb;
+ entry.delay = delay;
- if(_callbacks.Count == 0)
- {
- Monitor.Pulse(this);
- }
- _callbacks.Add(entry);
- }
- else
- {
- //
- // Destroyed, throw exception.
- //
- cb.ice_exception(new RequestCanceledException());
- }
- }
+ if(_callbacks.Count == 0)
+ {
+ Monitor.Pulse(this);
+ }
+ _callbacks.Add(entry);
+ }
+ else
+ {
+ //
+ // Destroyed, throw exception.
+ //
+ cb.ice_exception(new RequestCanceledException());
+ }
+ }
}
public void destroy()
{
lock(this)
- {
- _done = true;
- Monitor.Pulse(this);
- }
+ {
+ _done = true;
+ Monitor.Pulse(this);
+ }
}
private ArrayList _callbacks = new ArrayList();
diff --git a/cs/demo/Ice/bidir/CallbackSenderI.cs b/cs/demo/Ice/bidir/CallbackSenderI.cs
index d261f72b67b..20642cd6d06 100755
--- a/cs/demo/Ice/bidir/CallbackSenderI.cs
+++ b/cs/demo/Ice/bidir/CallbackSenderI.cs
@@ -16,67 +16,67 @@ class CallbackSenderI : CallbackSenderDisp_
public CallbackSenderI(Ice.Communicator communicator)
{
_communicator = communicator;
- _destroy = false;
- _num = 0;
- _clients = new ArrayList();
+ _destroy = false;
+ _num = 0;
+ _clients = new ArrayList();
}
public void destroy()
{
lock(this)
- {
- System.Console.Out.WriteLine("destroying callback sender");
- _destroy = true;
-
- System.Threading.Monitor.Pulse(this);
- }
+ {
+ System.Console.Out.WriteLine("destroying callback sender");
+ _destroy = true;
+
+ System.Threading.Monitor.Pulse(this);
+ }
}
public override void addClient(Ice.Identity ident, Ice.Current current)
{
lock(this)
- {
- System.Console.Out.WriteLine("adding client `" + _communicator.identityToString(ident) + "'");
+ {
+ System.Console.Out.WriteLine("adding client `" + _communicator.identityToString(ident) + "'");
- Ice.ObjectPrx @base = current.con.createProxy(ident);
- CallbackReceiverPrx client = CallbackReceiverPrxHelper.uncheckedCast(@base);
- _clients.Add(client);
- }
+ Ice.ObjectPrx @base = current.con.createProxy(ident);
+ CallbackReceiverPrx client = CallbackReceiverPrxHelper.uncheckedCast(@base);
+ _clients.Add(client);
+ }
}
public void Run()
{
lock(this)
- {
- while(!_destroy)
- {
- System.Threading.Monitor.Wait(this, 2000);
-
- if(!_destroy && _clients.Count != 0)
- {
- ++_num;
+ {
+ while(!_destroy)
+ {
+ System.Threading.Monitor.Wait(this, 2000);
+
+ if(!_destroy && _clients.Count != 0)
+ {
+ ++_num;
- ArrayList toRemove = new ArrayList();
- foreach(CallbackReceiverPrx c in _clients)
- {
- try
- {
- c.callback(_num);
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine("removing client `" +
- _communicator.identityToString(c.ice_getIdentity()) + "':\n" + ex);
- toRemove.Add(c);
- }
- }
- foreach(CallbackReceiverPrx c in toRemove)
- {
- _clients.Remove(c);
- }
- }
- }
- }
+ ArrayList toRemove = new ArrayList();
+ foreach(CallbackReceiverPrx c in _clients)
+ {
+ try
+ {
+ c.callback(_num);
+ }
+ catch(Ice.LocalException ex)
+ {
+ Console.Error.WriteLine("removing client `" +
+ _communicator.identityToString(c.ice_getIdentity()) + "':\n" + ex);
+ toRemove.Add(c);
+ }
+ }
+ foreach(CallbackReceiverPrx c in toRemove)
+ {
+ _clients.Remove(c);
+ }
+ }
+ }
+ }
}
private Ice.Communicator _communicator;
diff --git a/cs/demo/Ice/bidir/Client.cs b/cs/demo/Ice/bidir/Client.cs
index cde91959bd1..aad7f1f82c6 100755
--- a/cs/demo/Ice/bidir/Client.cs
+++ b/cs/demo/Ice/bidir/Client.cs
@@ -14,7 +14,7 @@ public class Client : Ice.Application
public override int run(string[] args)
{
CallbackSenderPrx server =
- CallbackSenderPrxHelper.checkedCast(communicator().propertyToProxy("Callback.Client.CallbackServer"));
+ CallbackSenderPrxHelper.checkedCast(communicator().propertyToProxy("Callback.Client.CallbackServer"));
if(server == null)
{
System.Console.Error.WriteLine("invalid proxy");
@@ -22,14 +22,14 @@ public class Client : Ice.Application
}
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("");
- Ice.Identity ident = new Ice.Identity();
- ident.name = Ice.Util.generateUUID();
- ident.category = "";
+ Ice.Identity ident = new Ice.Identity();
+ ident.name = Ice.Util.generateUUID();
+ ident.category = "";
adapter.add(new CallbackReceiverI(), ident);
adapter.activate();
- server.ice_getConnection().setAdapter(adapter);
- server.addClient(ident);
- communicator().waitForShutdown();
+ server.ice_getConnection().setAdapter(adapter);
+ server.addClient(ident);
+ communicator().waitForShutdown();
return 0;
}
diff --git a/cs/demo/Ice/bidir/Server.cs b/cs/demo/Ice/bidir/Server.cs
index c7632befb83..692ffc7e7cc 100755
--- a/cs/demo/Ice/bidir/Server.cs
+++ b/cs/demo/Ice/bidir/Server.cs
@@ -19,18 +19,18 @@ public class Server : Ice.Application
adapter.add(sender, communicator().stringToIdentity("sender"));
adapter.activate();
- Thread t = new Thread(new ThreadStart(sender.Run));
- t.Start();
+ Thread t = new Thread(new ThreadStart(sender.Run));
+ t.Start();
- try
- {
- communicator().waitForShutdown();
- }
- finally
- {
- sender.destroy();
- t.Join();
- }
+ try
+ {
+ communicator().waitForShutdown();
+ }
+ finally
+ {
+ sender.destroy();
+ t.Join();
+ }
return 0;
}
diff --git a/cs/demo/Ice/callback/CallbackSenderI.cs b/cs/demo/Ice/callback/CallbackSenderI.cs
index 27a790e8dd9..c2d7bd39afc 100755
--- a/cs/demo/Ice/callback/CallbackSenderI.cs
+++ b/cs/demo/Ice/callback/CallbackSenderI.cs
@@ -14,26 +14,26 @@ public sealed class CallbackSenderI : CallbackSenderDisp_
public override void initiateCallback(CallbackReceiverPrx proxy, Ice.Current current)
{
System.Console.Out.WriteLine("initiating callback");
- try
- {
- proxy.callback(current.ctx);
- }
- catch(System.Exception ex)
- {
- System.Console.Error.WriteLine(ex);
- }
+ try
+ {
+ proxy.callback(current.ctx);
+ }
+ catch(System.Exception ex)
+ {
+ System.Console.Error.WriteLine(ex);
+ }
}
public override void shutdown(Ice.Current current)
{
System.Console.Out.WriteLine("Shutting down...");
- try
- {
- current.adapter.getCommunicator().shutdown();
- }
- catch(System.Exception ex)
- {
- System.Console.Error.WriteLine(ex);
- }
+ try
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+ catch(System.Exception ex)
+ {
+ System.Console.Error.WriteLine(ex);
+ }
}
}
diff --git a/cs/demo/Ice/callback/Client.cs b/cs/demo/Ice/callback/Client.cs
index 1896f713f59..86e028579e9 100755
--- a/cs/demo/Ice/callback/Client.cs
+++ b/cs/demo/Ice/callback/Client.cs
@@ -15,35 +15,35 @@ public class Client : Ice.Application
private static void menu()
{
Console.Out.Write("usage:\n"
- + "t: send callback as twoway\n"
- + "o: send callback as oneway\n"
- + "O: send callback as batch oneway\n"
- + "d: send callback as datagram\n"
- + "D: send callback as batch datagram\n"
- + "f: flush all batch requests");
- if(_haveSSL)
- {
- Console.Out.Write("\nS: switch secure mode on/off");
- }
- Console.Out.WriteLine("\ns: shutdown server\n"
- + "x: exit\n"
- + "?: help\n");
+ + "t: send callback as twoway\n"
+ + "o: send callback as oneway\n"
+ + "O: send callback as batch oneway\n"
+ + "d: send callback as datagram\n"
+ + "D: send callback as batch datagram\n"
+ + "f: flush all batch requests");
+ if(_haveSSL)
+ {
+ Console.Out.Write("\nS: switch secure mode on/off");
+ }
+ Console.Out.WriteLine("\ns: shutdown server\n"
+ + "x: exit\n"
+ + "?: help\n");
}
public override int run(string[] args)
{
- try
- {
- communicator().getPluginManager().getPlugin("IceSSL");
- _haveSSL = true;
- }
- catch(Ice.NotRegisteredException)
- {
- }
+ try
+ {
+ communicator().getPluginManager().getPlugin("IceSSL");
+ _haveSSL = true;
+ }
+ catch(Ice.NotRegisteredException)
+ {
+ }
CallbackSenderPrx twoway = CallbackSenderPrxHelper.checkedCast(
- communicator().propertyToProxy("Callback.Client.CallbackServer").
- ice_twoway().ice_timeout(-1).ice_secure(false));
+ communicator().propertyToProxy("Callback.Client.CallbackServer").
+ ice_twoway().ice_timeout(-1).ice_secure(false));
if(twoway == null)
{
Console.Error.WriteLine("invalid proxy");
@@ -59,12 +59,12 @@ public class Client : Ice.Application
adapter.activate();
CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- adapter.createProxy(communicator().stringToIdentity("callbackReceiver")));
+ adapter.createProxy(communicator().stringToIdentity("callbackReceiver")));
CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(
- twowayR.ice_oneway());
+ twowayR.ice_oneway());
CallbackReceiverPrx datagramR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_datagram());
- bool secure = false;
+ bool secure = false;
menu();
@@ -94,25 +94,25 @@ public class Client : Ice.Application
}
else if(line.Equals("d"))
{
- if(secure)
- {
- Console.Out.WriteLine("secure datagrams are not supported");
- }
- else
- {
- datagram.initiateCallback(datagramR);
- }
+ if(secure)
+ {
+ Console.Out.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ datagram.initiateCallback(datagramR);
+ }
}
else if(line.Equals("D"))
{
- if(secure)
- {
- Console.Out.WriteLine("secure datagrams are not supported");
- }
- else
- {
- batchDatagram.initiateCallback(datagramR);
- }
+ if(secure)
+ {
+ Console.Out.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ batchDatagram.initiateCallback(datagramR);
+ }
}
else if(line.Equals("f"))
{
@@ -120,27 +120,27 @@ public class Client : Ice.Application
}
else if(_haveSSL && line.Equals("S"))
{
- secure = !secure;
+ secure = !secure;
- twoway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_secure(secure));
- oneway = CallbackSenderPrxHelper.uncheckedCast(oneway.ice_secure(secure));
- batchOneway = CallbackSenderPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
- datagram = CallbackSenderPrxHelper.uncheckedCast(datagram.ice_secure(secure));
- batchDatagram = CallbackSenderPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
+ twoway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_secure(secure));
+ oneway = CallbackSenderPrxHelper.uncheckedCast(oneway.ice_secure(secure));
+ batchOneway = CallbackSenderPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
+ datagram = CallbackSenderPrxHelper.uncheckedCast(datagram.ice_secure(secure));
+ batchDatagram = CallbackSenderPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_secure(secure));
- onewayR = CallbackReceiverPrxHelper.uncheckedCast(onewayR.ice_secure(secure));
- datagramR = CallbackReceiverPrxHelper.uncheckedCast(datagramR.ice_secure(secure));
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_secure(secure));
+ onewayR = CallbackReceiverPrxHelper.uncheckedCast(onewayR.ice_secure(secure));
+ datagramR = CallbackReceiverPrxHelper.uncheckedCast(datagramR.ice_secure(secure));
- if(secure)
- {
- Console.Out.WriteLine("secure mode is now on");
- }
- else
- {
- Console.Out.WriteLine("secure mode is now off");
- }
- }
+ if(secure)
+ {
+ Console.Out.WriteLine("secure mode is now on");
+ }
+ else
+ {
+ Console.Out.WriteLine("secure mode is now off");
+ }
+ }
else if(line.Equals("s"))
{
twoway.shutdown();
@@ -161,7 +161,7 @@ public class Client : Ice.Application
}
catch(System.Exception ex)
{
- Console.Error.WriteLine(ex);
+ Console.Error.WriteLine(ex);
}
}
while(!line.Equals("x"));
diff --git a/cs/demo/Ice/hello/Client.cs b/cs/demo/Ice/hello/Client.cs
index 73586a5c695..98eef16d0d1 100755
--- a/cs/demo/Ice/hello/Client.cs
+++ b/cs/demo/Ice/hello/Client.cs
@@ -15,38 +15,38 @@ public class Client : Ice.Application
private static void menu()
{
Console.Write(
- "usage:\n" +
- "t: send greeting as twoway\n" +
- "o: send greeting as oneway\n" +
- "O: send greeting as batch oneway\n" +
- "d: send greeting as datagram\n" +
- "D: send greeting as batch datagram\n" +
- "f: flush all batch requests\n" +
- "T: set a timeout\n" +
- "P: set a server delay");
- if(_haveSSL)
- {
+ "usage:\n" +
+ "t: send greeting as twoway\n" +
+ "o: send greeting as oneway\n" +
+ "O: send greeting as batch oneway\n" +
+ "d: send greeting as datagram\n" +
+ "D: send greeting as batch datagram\n" +
+ "f: flush all batch requests\n" +
+ "T: set a timeout\n" +
+ "P: set a server delay");
+ if(_haveSSL)
+ {
Console.Write("\nS: switch secure mode on/off");
- }
+ }
Console.WriteLine(
- "\ns: shutdown server\n" +
- "x: exit\n" +
- "?: help\n");
+ "\ns: shutdown server\n" +
+ "x: exit\n" +
+ "?: help\n");
}
public override int run(string[] args)
{
- try
- {
- communicator().getPluginManager().getPlugin("IceSSL");
- _haveSSL = true;
- }
- catch(Ice.NotRegisteredException)
- {
- }
+ try
+ {
+ communicator().getPluginManager().getPlugin("IceSSL");
+ _haveSSL = true;
+ }
+ catch(Ice.NotRegisteredException)
+ {
+ }
HelloPrx twoway = HelloPrxHelper.checkedCast(
- communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false));
+ communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false));
if(twoway == null)
{
Console.Error.WriteLine("invalid proxy");
@@ -57,9 +57,9 @@ public class Client : Ice.Application
HelloPrx datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram());
HelloPrx batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram());
- bool secure = false;
+ bool secure = false;
int timeout = -1;
- int delay = 0;
+ int delay = 0;
menu();
@@ -89,25 +89,25 @@ public class Client : Ice.Application
}
else if(line.Equals("d"))
{
- if(secure)
- {
- Console.WriteLine("secure datagrams are not supported");
- }
- else
- {
- datagram.sayHello(delay);
- }
+ if(secure)
+ {
+ Console.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ datagram.sayHello(delay);
+ }
}
else if(line.Equals("D"))
{
- if(secure)
- {
- Console.WriteLine("secure datagrams are not supported");
- }
- else
- {
- batchDatagram.sayHello(delay);
- }
+ if(secure)
+ {
+ Console.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ batchDatagram.sayHello(delay);
+ }
}
else if(line.Equals("f"))
{
@@ -136,7 +136,7 @@ public class Client : Ice.Application
{
Console.WriteLine("timeout is now set to 2000ms");
}
- }
+ }
else if(line.Equals("P"))
{
if(delay == 0)
@@ -157,25 +157,25 @@ public class Client : Ice.Application
Console.WriteLine("server delay is now set to 2500ms");
}
}
- else if(_haveSSL && line.Equals("S"))
- {
- secure = !secure;
+ else if(_haveSSL && line.Equals("S"))
+ {
+ secure = !secure;
- twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure));
- oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure));
- batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
- datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure));
- batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
+ twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure));
+ oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure));
+ batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
+ datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure));
+ batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
- if(secure)
- {
- Console.WriteLine("secure mode is now on");
- }
- else
- {
- Console.WriteLine("secure mode is now off");
- }
- }
+ if(secure)
+ {
+ Console.WriteLine("secure mode is now on");
+ }
+ else
+ {
+ Console.WriteLine("secure mode is now off");
+ }
+ }
else if(line.Equals("s"))
{
twoway.shutdown();
@@ -196,7 +196,7 @@ public class Client : Ice.Application
}
catch(System.Exception ex)
{
- Console.Error.WriteLine(ex);
+ Console.Error.WriteLine(ex);
}
}
while (!line.Equals("x"));
@@ -208,10 +208,10 @@ public class Client : Ice.Application
{
Client app = new Client();
int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ if(status != 0)
+ {
+ System.Environment.Exit(status);
+ }
}
private static bool _haveSSL = false;
diff --git a/cs/demo/Ice/hello/HelloI.cs b/cs/demo/Ice/hello/HelloI.cs
index 8f397039521..5d3c56ac15d 100755
--- a/cs/demo/Ice/hello/HelloI.cs
+++ b/cs/demo/Ice/hello/HelloI.cs
@@ -14,9 +14,9 @@ public class HelloI : HelloDisp_
public override void sayHello(int delay, Ice.Current current)
{
if(delay > 0)
- {
- System.Threading.Thread.Sleep(delay);
- }
+ {
+ System.Threading.Thread.Sleep(delay);
+ }
System.Console.Out.WriteLine("Hello World!");
}
diff --git a/cs/demo/Ice/hello/Server.cs b/cs/demo/Ice/hello/Server.cs
index 7ea1a19d5cf..d448fcb08dd 100755
--- a/cs/demo/Ice/hello/Server.cs
+++ b/cs/demo/Ice/hello/Server.cs
@@ -22,9 +22,9 @@ public class Server : Ice.Application
{
Server app = new Server();
int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ if(status != 0)
+ {
+ System.Environment.Exit(status);
+ }
}
}
diff --git a/cs/demo/Ice/latency/Client.cs b/cs/demo/Ice/latency/Client.cs
index a65f14320c4..8f6e1cca9f8 100755
--- a/cs/demo/Ice/latency/Client.cs
+++ b/cs/demo/Ice/latency/Client.cs
@@ -22,21 +22,21 @@ public class Client : Ice.Application
return 1;
}
- //
- // A method needs to be invoked thousands of times before the JIT compiler
- // will convert it to native code. To ensure an accurate latency measurement,
- // we need to "warm up" the JIT compiler.
- //
- {
- int reps = 20000;
- Console.Error.Write("warming up the JIT compiler...");
- Console.Error.Flush();
- for(int i = 0; i < reps; i++)
- {
- ping.ice_ping();
- }
- Console.Error.WriteLine("ok");
- }
+ //
+ // A method needs to be invoked thousands of times before the JIT compiler
+ // will convert it to native code. To ensure an accurate latency measurement,
+ // we need to "warm up" the JIT compiler.
+ //
+ {
+ int reps = 20000;
+ Console.Error.Write("warming up the JIT compiler...");
+ Console.Error.Flush();
+ for(int i = 0; i < reps; i++)
+ {
+ ping.ice_ping();
+ }
+ Console.Error.WriteLine("ok");
+ }
long tv1 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
int repetitions = 100000;
diff --git a/cs/demo/Ice/minimal/Client.cs b/cs/demo/Ice/minimal/Client.cs
index e8976096a56..5653bed8ac4 100755
--- a/cs/demo/Ice/minimal/Client.cs
+++ b/cs/demo/Ice/minimal/Client.cs
@@ -14,22 +14,22 @@ public class Client
{
public static void Main(string[] args)
{
- int status = 0;
+ int status = 0;
Ice.Communicator communicator = null;
try
{
communicator = Ice.Util.initialize(ref args);
- HelloPrx hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello:tcp -p 10000"));
- if(hello == null)
- {
- Console.Error.WriteLine("invalid proxy");
- status = 1;
- }
- else
- {
- hello.sayHello();
- }
+ HelloPrx hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello:tcp -p 10000"));
+ if(hello == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ status = 1;
+ }
+ else
+ {
+ hello.sayHello();
+ }
}
catch(System.Exception ex)
{
diff --git a/cs/demo/Ice/minimal/Server.cs b/cs/demo/Ice/minimal/Server.cs
index 83da6fe66ff..2de0577c4b7 100755
--- a/cs/demo/Ice/minimal/Server.cs
+++ b/cs/demo/Ice/minimal/Server.cs
@@ -13,16 +13,16 @@ public class Server
{
public static void Main(string[] args)
{
- int status = 0;
+ int status = 0;
Ice.Communicator communicator = null;
try
{
communicator = Ice.Util.initialize(ref args);
- Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "tcp -p 10000");
- adapter.add(new HelloI(), communicator.stringToIdentity("hello"));
- adapter.activate();
- communicator.waitForShutdown();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "tcp -p 10000");
+ adapter.add(new HelloI(), communicator.stringToIdentity("hello"));
+ adapter.activate();
+ communicator.waitForShutdown();
}
catch(System.Exception ex)
{
diff --git a/cs/demo/Ice/nested/Client.cs b/cs/demo/Ice/nested/Client.cs
index 84e49d8f494..139f8d45fb8 100755
--- a/cs/demo/Ice/nested/Client.cs
+++ b/cs/demo/Ice/nested/Client.cs
@@ -23,7 +23,7 @@ public class Client : Ice.Application
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Client");
NestedPrx self =
- NestedPrxHelper.uncheckedCast(adapter.createProxy(communicator().stringToIdentity("nestedClient")));
+ NestedPrxHelper.uncheckedCast(adapter.createProxy(communicator().stringToIdentity("nestedClient")));
adapter.add(new NestedI(self), communicator().stringToIdentity("nestedClient"));
adapter.activate();
diff --git a/cs/demo/Ice/session/Client.cs b/cs/demo/Ice/session/Client.cs
index 2ab470a7ef9..b34e5472bf4 100755
--- a/cs/demo/Ice/session/Client.cs
+++ b/cs/demo/Ice/session/Client.cs
@@ -16,193 +16,193 @@ public class Client : Ice.Application
{
class SessionRefreshThread
{
- public SessionRefreshThread(Ice.Logger logger, int timeout, SessionPrx session)
- {
- _logger = logger;
- _session = session;
- _timeout = timeout;
- _terminated = false;
- }
-
- public void run()
- {
- lock(this)
- {
- while(!_terminated)
- {
- System.Threading.Monitor.Wait(this, _timeout);
- if(!_terminated)
- {
- try
- {
- _session.refresh();
- }
- catch(Ice.Exception ex)
- {
- _logger.warning("SessionRefreshThread: " + ex);
- _terminated = true;
- }
- }
- }
- }
- }
-
- public void terminate()
- {
- lock(this)
- {
- _terminated = true;
- System.Threading.Monitor.Pulse(this);
- }
- }
-
- private Ice.Logger _logger;
- private SessionPrx _session;
- private int _timeout;
- private bool _terminated;
+ public SessionRefreshThread(Ice.Logger logger, int timeout, SessionPrx session)
+ {
+ _logger = logger;
+ _session = session;
+ _timeout = timeout;
+ _terminated = false;
+ }
+
+ public void run()
+ {
+ lock(this)
+ {
+ while(!_terminated)
+ {
+ System.Threading.Monitor.Wait(this, _timeout);
+ if(!_terminated)
+ {
+ try
+ {
+ _session.refresh();
+ }
+ catch(Ice.Exception ex)
+ {
+ _logger.warning("SessionRefreshThread: " + ex);
+ _terminated = true;
+ }
+ }
+ }
+ }
+ }
+
+ public void terminate()
+ {
+ lock(this)
+ {
+ _terminated = true;
+ System.Threading.Monitor.Pulse(this);
+ }
+ }
+
+ private Ice.Logger _logger;
+ private SessionPrx _session;
+ private int _timeout;
+ private bool _terminated;
};
public override int run(string[] args)
{
- string name;
- do
- {
- Console.Out.Write("Please enter your name ==> ");
- Console.Out.Flush();
-
- name = Console.In.ReadLine();
- if(name == null)
- {
- return 1;
- }
- name = name.Trim();
- }
- while(name.Length == 0);
-
- Ice.ObjectPrx basePrx = communicator().propertyToProxy("SessionFactory.Proxy");
- SessionFactoryPrx factory = SessionFactoryPrxHelper.checkedCast(basePrx);
- if(factory == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
-
- SessionPrx session = factory.create(name);
-
- SessionRefreshThread refresh = new SessionRefreshThread(communicator().getLogger(), 5000, session);
- Thread refreshThread = new Thread(new ThreadStart(refresh.run));
- refreshThread.Start();
-
- ArrayList hellos = new ArrayList();
-
- menu();
-
- try
- {
- bool destroy = true;
- bool shutdown = false;
- while(true)
- {
- Console.Out.Write("==> ");
- Console.Out.Flush();
- string line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Length > 0 && Char.IsDigit(line[0]))
- {
- int index = Int32.Parse(line);
- if(index < hellos.Count)
- {
- HelloPrx hello = (HelloPrx)hellos[index];
- hello.sayHello();
- }
- else
- {
- Console.Out.WriteLine("Index is too high. " + hellos.Count +
- " hello objects exist so far.\n" +
- "Use `c' to create a new hello object.");
- }
- }
- else if(line.Equals("c"))
- {
- hellos.Add(session.createHello());
- Console.Out.WriteLine("Created hello object " + (hellos.Count - 1));
- }
- else if(line.Equals("s"))
- {
- destroy = false;
- shutdown = true;
- break;
- }
- else if(line.Equals("x"))
- {
- break;
- }
- else if(line.Equals("t"))
- {
- destroy = false;
- break;
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.Out.WriteLine("Unknown command `" + line + "'.");
- menu();
- }
- }
-
- //
- // The refresher thread must be terminated before destroy is
- // called, otherwise it might get ObjectNotExistException. refresh
- // is set to 0 so that if session.destroy() raises an exception
- // the thread will not be re-terminated and re-joined.
- //
- refresh.terminate();
- refreshThread.Join();
- refresh = null;
-
- if(destroy)
- {
- session.destroy();
- }
- if(shutdown)
- {
- factory.shutdown();
- }
- }
- catch(System.Exception)
- {
- //
- // The refresher thread must be terminated in the event of a
- // failure.
- //
- if(refresh != null)
- {
- refresh.terminate();
- refreshThread.Join();
- refresh = null;
- }
- throw;
- }
-
- return 0;
+ string name;
+ do
+ {
+ Console.Out.Write("Please enter your name ==> ");
+ Console.Out.Flush();
+
+ name = Console.In.ReadLine();
+ if(name == null)
+ {
+ return 1;
+ }
+ name = name.Trim();
+ }
+ while(name.Length == 0);
+
+ Ice.ObjectPrx basePrx = communicator().propertyToProxy("SessionFactory.Proxy");
+ SessionFactoryPrx factory = SessionFactoryPrxHelper.checkedCast(basePrx);
+ if(factory == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
+
+ SessionPrx session = factory.create(name);
+
+ SessionRefreshThread refresh = new SessionRefreshThread(communicator().getLogger(), 5000, session);
+ Thread refreshThread = new Thread(new ThreadStart(refresh.run));
+ refreshThread.Start();
+
+ ArrayList hellos = new ArrayList();
+
+ menu();
+
+ try
+ {
+ bool destroy = true;
+ bool shutdown = false;
+ while(true)
+ {
+ Console.Out.Write("==> ");
+ Console.Out.Flush();
+ string line = Console.In.ReadLine();
+ if(line == null)
+ {
+ break;
+ }
+ if(line.Length > 0 && Char.IsDigit(line[0]))
+ {
+ int index = Int32.Parse(line);
+ if(index < hellos.Count)
+ {
+ HelloPrx hello = (HelloPrx)hellos[index];
+ hello.sayHello();
+ }
+ else
+ {
+ Console.Out.WriteLine("Index is too high. " + hellos.Count +
+ " hello objects exist so far.\n" +
+ "Use `c' to create a new hello object.");
+ }
+ }
+ else if(line.Equals("c"))
+ {
+ hellos.Add(session.createHello());
+ Console.Out.WriteLine("Created hello object " + (hellos.Count - 1));
+ }
+ else if(line.Equals("s"))
+ {
+ destroy = false;
+ shutdown = true;
+ break;
+ }
+ else if(line.Equals("x"))
+ {
+ break;
+ }
+ else if(line.Equals("t"))
+ {
+ destroy = false;
+ break;
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
+ }
+ else
+ {
+ Console.Out.WriteLine("Unknown command `" + line + "'.");
+ menu();
+ }
+ }
+
+ //
+ // The refresher thread must be terminated before destroy is
+ // called, otherwise it might get ObjectNotExistException. refresh
+ // is set to 0 so that if session.destroy() raises an exception
+ // the thread will not be re-terminated and re-joined.
+ //
+ refresh.terminate();
+ refreshThread.Join();
+ refresh = null;
+
+ if(destroy)
+ {
+ session.destroy();
+ }
+ if(shutdown)
+ {
+ factory.shutdown();
+ }
+ }
+ catch(System.Exception)
+ {
+ //
+ // The refresher thread must be terminated in the event of a
+ // failure.
+ //
+ if(refresh != null)
+ {
+ refresh.terminate();
+ refreshThread.Join();
+ refresh = null;
+ }
+ throw;
+ }
+
+ return 0;
}
private static void menu()
{
- Console.Out.WriteLine(
- "usage:\n" +
- "c: create a new per-client hello object\n" +
- "0-9: send a greeting to a hello object\n" +
- "s: shutdown the server and exit\n" +
- "x: exit\n" +
- "t: exit without destroying the session\n" +
- "?: help\n");
+ Console.Out.WriteLine(
+ "usage:\n" +
+ "c: create a new per-client hello object\n" +
+ "0-9: send a greeting to a hello object\n" +
+ "s: shutdown the server and exit\n" +
+ "x: exit\n" +
+ "t: exit without destroying the session\n" +
+ "?: help\n");
}
public static void Main(string[] args)
diff --git a/cs/demo/Ice/session/HelloI.cs b/cs/demo/Ice/session/HelloI.cs
index e69fb4faef7..bf76807390f 100755
--- a/cs/demo/Ice/session/HelloI.cs
+++ b/cs/demo/Ice/session/HelloI.cs
@@ -14,14 +14,14 @@ public class HelloI : HelloDisp_
{
public HelloI(string name, int id)
{
- _name = name;
- _id = id;
+ _name = name;
+ _id = id;
}
public override void sayHello(Ice.Current c)
{
- Console.Out.WriteLine("Hello object #" + _id + " for session `" + _name + "' says:\n" +
- "Hello " + _name + "!");
+ Console.Out.WriteLine("Hello object #" + _id + " for session `" + _name + "' says:\n" +
+ "Hello " + _name + "!");
}
private string _name;
diff --git a/cs/demo/Ice/session/ReapThread.cs b/cs/demo/Ice/session/ReapThread.cs
index 877dccd304e..24f8078bac3 100755
--- a/cs/demo/Ice/session/ReapThread.cs
+++ b/cs/demo/Ice/session/ReapThread.cs
@@ -16,81 +16,81 @@ public class ReapThread
{
public class SessionProxyPair
{
- public SessionProxyPair(SessionPrx p, SessionI s)
- {
- proxy = p;
- session = s;
- }
+ public SessionProxyPair(SessionPrx p, SessionI s)
+ {
+ proxy = p;
+ session = s;
+ }
- public SessionPrx proxy;
- public SessionI session;
+ public SessionPrx proxy;
+ public SessionI session;
}
public ReapThread()
{
- _timeout = System.TimeSpan.FromSeconds(10);
- _terminated = false;
- _sessions = new ArrayList();
+ _timeout = System.TimeSpan.FromSeconds(10);
+ _terminated = false;
+ _sessions = new ArrayList();
}
public void run()
{
- lock(this)
- {
- while(!_terminated)
- {
- System.Threading.Monitor.Wait(this, _timeout);
- if(!_terminated)
- {
- ArrayList tmp = new ArrayList();
- foreach(SessionProxyPair p in _sessions)
- {
- try
- {
- //
- // Session destruction may take time in a
- // real-world example. Therefore the current time
- // is computed for each iteration.
- //
- if((System.DateTime.Now - p.session.timestamp()) > _timeout)
- {
- string name = p.proxy.getName();
- p.proxy.destroy();
- Console.Out.WriteLine("The session " + name + " has timed out.");
- }
- else
- {
- tmp.Add(p);
- }
- }
- catch(Ice.ObjectNotExistException)
- {
- // Ignore.
- }
- }
- _sessions = tmp;
- }
- }
- }
+ lock(this)
+ {
+ while(!_terminated)
+ {
+ System.Threading.Monitor.Wait(this, _timeout);
+ if(!_terminated)
+ {
+ ArrayList tmp = new ArrayList();
+ foreach(SessionProxyPair p in _sessions)
+ {
+ try
+ {
+ //
+ // Session destruction may take time in a
+ // real-world example. Therefore the current time
+ // is computed for each iteration.
+ //
+ if((System.DateTime.Now - p.session.timestamp()) > _timeout)
+ {
+ string name = p.proxy.getName();
+ p.proxy.destroy();
+ Console.Out.WriteLine("The session " + name + " has timed out.");
+ }
+ else
+ {
+ tmp.Add(p);
+ }
+ }
+ catch(Ice.ObjectNotExistException)
+ {
+ // Ignore.
+ }
+ }
+ _sessions = tmp;
+ }
+ }
+ }
}
public void terminate()
{
- lock(this)
- {
- _terminated = true;
- System.Threading.Monitor.Pulse(this);
+ lock(this)
+ {
+ _terminated = true;
+ System.Threading.Monitor.Pulse(this);
- _sessions.Clear();
- }
+ _sessions.Clear();
+ }
}
public void add(SessionPrx proxy, SessionI session)
{
- lock(this)
- {
- _sessions.Add(new SessionProxyPair(proxy, session));
- }
+ lock(this)
+ {
+ _sessions.Add(new SessionProxyPair(proxy, session));
+ }
}
private bool _terminated;
diff --git a/cs/demo/Ice/session/Server.cs b/cs/demo/Ice/session/Server.cs
index 0f6512ad90e..add922aa1ef 100755
--- a/cs/demo/Ice/session/Server.cs
+++ b/cs/demo/Ice/session/Server.cs
@@ -15,20 +15,20 @@ public class Server : Ice.Application
{
public override int run(string[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SessionFactory");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SessionFactory");
- ReapThread reaper = new ReapThread();
- Thread reaperThread = new Thread(new ThreadStart(reaper.run));
- reaperThread.Start();
+ ReapThread reaper = new ReapThread();
+ Thread reaperThread = new Thread(new ThreadStart(reaper.run));
+ reaperThread.Start();
- adapter.add(new SessionFactoryI(reaper), communicator().stringToIdentity("SessionFactory"));
- adapter.activate();
- communicator().waitForShutdown();
+ adapter.add(new SessionFactoryI(reaper), communicator().stringToIdentity("SessionFactory"));
+ adapter.activate();
+ communicator().waitForShutdown();
- reaper.terminate();
- reaperThread.Join();
+ reaper.terminate();
+ reaperThread.Join();
- return 0;
+ return 0;
}
public static void Main(string[] args)
diff --git a/cs/demo/Ice/session/SessionFactoryI.cs b/cs/demo/Ice/session/SessionFactoryI.cs
index d5ad3f3a6ad..2f696e0b6fc 100755
--- a/cs/demo/Ice/session/SessionFactoryI.cs
+++ b/cs/demo/Ice/session/SessionFactoryI.cs
@@ -14,21 +14,21 @@ public class SessionFactoryI : SessionFactoryDisp_
{
public SessionFactoryI(ReapThread reapThread)
{
- _reaper = reapThread;
+ _reaper = reapThread;
}
public override SessionPrx create(string name, Ice.Current c)
{
- SessionI session = new SessionI(name);
- SessionPrx proxy = SessionPrxHelper.uncheckedCast(c.adapter.addWithUUID(session));
- _reaper.add(proxy, session);
- return proxy;
+ SessionI session = new SessionI(name);
+ SessionPrx proxy = SessionPrxHelper.uncheckedCast(c.adapter.addWithUUID(session));
+ _reaper.add(proxy, session);
+ return proxy;
}
public override void shutdown(Ice.Current c)
{
- Console.Out.WriteLine("Shutting down...");
- c.adapter.getCommunicator().shutdown();
+ Console.Out.WriteLine("Shutting down...");
+ c.adapter.getCommunicator().shutdown();
}
private ReapThread _reaper;
diff --git a/cs/demo/Ice/session/SessionI.cs b/cs/demo/Ice/session/SessionI.cs
index 46e2d0cdda7..ace9e9c9b0f 100755
--- a/cs/demo/Ice/session/SessionI.cs
+++ b/cs/demo/Ice/session/SessionI.cs
@@ -15,96 +15,96 @@ public class SessionI : SessionDisp_
{
public SessionI(string name)
{
- _name = name;
- _timestamp = System.DateTime.Now;
- _nextId = 0;
- _destroy = false;
- _objs = new ArrayList();
+ _name = name;
+ _timestamp = System.DateTime.Now;
+ _nextId = 0;
+ _destroy = false;
+ _objs = new ArrayList();
- Console.Out.WriteLine("The session " + _name + " is now created.");
+ Console.Out.WriteLine("The session " + _name + " is now created.");
}
public override HelloPrx createHello(Ice.Current c)
{
- lock(this)
- {
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
-
- HelloPrx hello = HelloPrxHelper.uncheckedCast(c.adapter.addWithUUID(new HelloI(_name, _nextId++)));
- _objs.Add(hello);
- return hello;
- }
+ lock(this)
+ {
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+
+ HelloPrx hello = HelloPrxHelper.uncheckedCast(c.adapter.addWithUUID(new HelloI(_name, _nextId++)));
+ _objs.Add(hello);
+ return hello;
+ }
}
public override void refresh(Ice.Current c)
{
- lock(this)
- {
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
-
- _timestamp = System.DateTime.Now;
- }
+ lock(this)
+ {
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+
+ _timestamp = System.DateTime.Now;
+ }
}
public override string getName(Ice.Current c)
{
- lock(this)
- {
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
-
- return _name;
- }
+ lock(this)
+ {
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+
+ return _name;
+ }
}
public override void destroy(Ice.Current c)
{
- lock(this)
- {
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
-
- _destroy = true;
-
- Console.Out.WriteLine("The session " + _name + " is now destroyed.");
- try
- {
- c.adapter.remove(c.id);
- foreach(HelloPrx p in _objs)
- {
- c.adapter.remove(p.ice_getIdentity());
- }
- }
- catch(Ice.ObjectAdapterDeactivatedException)
- {
- // This method is called on shutdown of the server, in which
- // case this exception is expected.
- }
- }
+ lock(this)
+ {
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+
+ _destroy = true;
+
+ Console.Out.WriteLine("The session " + _name + " is now destroyed.");
+ try
+ {
+ c.adapter.remove(c.id);
+ foreach(HelloPrx p in _objs)
+ {
+ c.adapter.remove(p.ice_getIdentity());
+ }
+ }
+ catch(Ice.ObjectAdapterDeactivatedException)
+ {
+ // This method is called on shutdown of the server, in which
+ // case this exception is expected.
+ }
+ }
- _objs.Clear();
+ _objs.Clear();
}
public System.DateTime timestamp()
{
- lock(this)
- {
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
- return _timestamp;
- }
+ lock(this)
+ {
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+ return _timestamp;
+ }
}
private string _name;
diff --git a/cs/demo/Ice/throughput/Client.cs b/cs/demo/Ice/throughput/Client.cs
index 7317514d5bf..d1690d0c825 100755
--- a/cs/demo/Ice/throughput/Client.cs
+++ b/cs/demo/Ice/throughput/Client.cs
@@ -26,12 +26,12 @@ public class Client : Ice.Application
+ "t: Send sequence as twoway\n"
+ "o: Send sequence as oneway\n"
+ "r: Receive sequence\n"
- + "e: Echo (send and receive) sequence\n"
+ + "e: Echo (send and receive) sequence\n"
+ "\n"
+ "other commands\n"
+ "s: shutdown server\n"
- + "x: exit\n"
- + "?: help\n");
+ + "x: exit\n"
+ + "?: help\n");
}
public override int
@@ -49,26 +49,26 @@ public class Client : Ice.Application
byte[] byteSeq = new byte[ByteSeqSize.value];
string[] stringSeq = new string[StringSeqSize.value];
- for(int i = 0; i < StringSeqSize.value; ++i)
- {
- stringSeq[i] = "hello";
- }
+ for(int i = 0; i < StringSeqSize.value; ++i)
+ {
+ stringSeq[i] = "hello";
+ }
StringDouble[] structSeq = new StringDouble[StringDoubleSeqSize.value];
for(int i = 0; i < StringDoubleSeqSize.value; ++i)
{
- structSeq[i] = new StringDouble();
+ structSeq[i] = new StringDouble();
structSeq[i].s = "hello";
structSeq[i].d = 3.14;
}
- Fixed[] fixedSeq = new Fixed[FixedSeqSize.value];
- for(int i = 0; i < FixedSeqSize.value; ++i)
- {
- fixedSeq[i].i = 0;
- fixedSeq[i].j = 0;
- fixedSeq[i].d = 0;
- }
+ Fixed[] fixedSeq = new Fixed[FixedSeqSize.value];
+ for(int i = 0; i < FixedSeqSize.value; ++i)
+ {
+ fixedSeq[i].i = 0;
+ fixedSeq[i].j = 0;
+ fixedSeq[i].d = 0;
+ }
//
// A method needs to be invoked thousands of times before the JIT compiler
@@ -76,11 +76,11 @@ public class Client : Ice.Application
// we need to "warm up" the JIT compiler.
//
{
- byte[] emptyBytes = new byte[1];
- string[] emptyStrings = new string[1];
- StringDouble[] emptyStructs = new StringDouble[1];
- emptyStructs[0] = new StringDouble();
- Fixed[] emptyFixed = new Fixed[1];
+ byte[] emptyBytes = new byte[1];
+ string[] emptyStrings = new string[1];
+ StringDouble[] emptyStructs = new StringDouble[1];
+ emptyStructs[0] = new StringDouble();
+ Fixed[] emptyFixed = new Fixed[1];
int reps = 10000;
Console.Error.Write("warming up the JIT compiler...");
@@ -122,10 +122,10 @@ public class Client : Ice.Application
Console.Write("==> ");
Console.Out.Flush();
line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
+ if(line == null)
+ {
+ break;
+ }
long tmsec = System.DateTime.Now.Ticks / 10000;
const int repetitions = 100;
@@ -379,31 +379,31 @@ public class Client : Ice.Application
break;
}
}
- double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0;
- if(c == 'e')
- {
- mbit *= 2;
- }
- Console.WriteLine("throughput: " + mbit.ToString("#.##") + "Mbps");
- }
- else if(line.Equals("s"))
- {
- throughput.shutdown();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.WriteLine("unknown command `" + line + "'");
- menu();
- }
- }
+ double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0;
+ if(c == 'e')
+ {
+ mbit *= 2;
+ }
+ Console.WriteLine("throughput: " + mbit.ToString("#.##") + "Mbps");
+ }
+ else if(line.Equals("s"))
+ {
+ throughput.shutdown();
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
+ }
+ else
+ {
+ Console.WriteLine("unknown command `" + line + "'");
+ menu();
+ }
+ }
catch(System.Exception ex)
{
Console.Error.WriteLine(ex);
diff --git a/cs/demo/Ice/throughput/ThroughputI.cs b/cs/demo/Ice/throughput/ThroughputI.cs
index 6b93036b8f6..0b94466cfff 100755
--- a/cs/demo/Ice/throughput/ThroughputI.cs
+++ b/cs/demo/Ice/throughput/ThroughputI.cs
@@ -24,7 +24,7 @@ public sealed class ThroughputI : ThroughputDisp_
_structSeq = new StringDouble[StringDoubleSeqSize.value];
for(int i = 0; i < StringDoubleSeqSize.value; ++i)
{
- _structSeq[i] = new StringDouble();
+ _structSeq[i] = new StringDouble();
_structSeq[i].s = "hello";
_structSeq[i].d = 3.14;
}
@@ -49,13 +49,13 @@ public sealed class ThroughputI : ThroughputDisp_
public override byte[] recvByteSeq(Ice.Current current)
{
if(_warmup)
- {
+ {
return _emptyByteSeq;
- }
- else
- {
+ }
+ else
+ {
return _byteSeq;
- }
+ }
}
public override byte[] echoByteSeq(byte[] seq, Ice.Current current)
@@ -70,13 +70,13 @@ public sealed class ThroughputI : ThroughputDisp_
public override string[] recvStringSeq(Ice.Current current)
{
if(_warmup)
- {
+ {
return _emptyStringSeq;
- }
- else
- {
+ }
+ else
+ {
return _stringSeq;
- }
+ }
}
public override string[] echoStringSeq(string[] seq, Ice.Current current)
@@ -91,13 +91,13 @@ public sealed class ThroughputI : ThroughputDisp_
public override StringDouble[] recvStructSeq(Ice.Current current)
{
if(_warmup)
- {
+ {
return _emptyStructSeq;
- }
- else
- {
+ }
+ else
+ {
return _structSeq;
- }
+ }
}
public override StringDouble[] echoStructSeq(StringDouble[] seq, Ice.Current current)
@@ -112,13 +112,13 @@ public sealed class ThroughputI : ThroughputDisp_
public override Fixed[] recvFixedSeq(Ice.Current current)
{
if(_warmup)
- {
+ {
return _emptyFixedSeq;
- }
- else
- {
+ }
+ else
+ {
return _fixedSeq;
- }
+ }
}
public override Fixed[] echoFixedSeq(Fixed[] seq, Ice.Current current)
diff --git a/cs/demo/Ice/value/Client.cs b/cs/demo/Ice/value/Client.cs
index 45d5d28081f..9d877701c53 100755
--- a/cs/demo/Ice/value/Client.cs
+++ b/cs/demo/Ice/value/Client.cs
@@ -28,7 +28,7 @@ public class Client : Ice.Application
Console.Out.WriteLine("operations, and print its contents. No factory is required");
Console.Out.WriteLine("for this.");
Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
+ Console.In.ReadLine();
Simple simple = initial.getSimple();
Console.Out.WriteLine("==> " + simple.message);
@@ -45,8 +45,8 @@ public class Client : Ice.Application
try
{
initial.getPrinter(out printer, out printerProxy);
- Console.Error.WriteLine("Did not get the expected NoObjectFactoryException!");
- Environment.Exit(1);
+ Console.Error.WriteLine("Did not get the expected NoObjectFactoryException!");
+ Environment.Exit(1);
}
catch(Ice.NoObjectFactoryException ex)
{
@@ -145,7 +145,7 @@ public class Client : Ice.Application
Console.Out.WriteLine();
Console.Out.WriteLine("That's it for this demo. Have fun with Ice!");
- initial.shutdown();
+ initial.shutdown();
return 0;
}
diff --git a/cs/demo/Ice/value/InitialI.cs b/cs/demo/Ice/value/InitialI.cs
index 4b59bbf7918..b28eb7d6d22 100755
--- a/cs/demo/Ice/value/InitialI.cs
+++ b/cs/demo/Ice/value/InitialI.cs
@@ -51,7 +51,7 @@ class InitialI : Initial
public override void shutdown(Ice.Current current)
{
- current.adapter.getCommunicator().shutdown();
+ current.adapter.getCommunicator().shutdown();
}
private Simple _simple;
diff --git a/cs/demo/IceBox/hello/Client.cs b/cs/demo/IceBox/hello/Client.cs
index be9284b6820..1da24eb192b 100644
--- a/cs/demo/IceBox/hello/Client.cs
+++ b/cs/demo/IceBox/hello/Client.cs
@@ -15,35 +15,35 @@ public class Client : Ice.Application
private static void menu()
{
Console.Write(
- "usage:\n" +
- "t: send greeting as twoway\n" +
- "o: send greeting as oneway\n" +
- "O: send greeting as batch oneway\n" +
- "d: send greeting as datagram\n" +
- "D: send greeting as batch datagram\n" +
- "f: flush all batch requests\n");
- if(_haveSSL)
- {
- Console.Write("\nS: switch secure mode on/off");
- }
- Console.WriteLine(
- "\nx: exit\n" +
- "?: help\n");
+ "usage:\n" +
+ "t: send greeting as twoway\n" +
+ "o: send greeting as oneway\n" +
+ "O: send greeting as batch oneway\n" +
+ "d: send greeting as datagram\n" +
+ "D: send greeting as batch datagram\n" +
+ "f: flush all batch requests\n");
+ if(_haveSSL)
+ {
+ Console.Write("\nS: switch secure mode on/off");
+ }
+ Console.WriteLine(
+ "\nx: exit\n" +
+ "?: help\n");
}
public override int run(string[] args)
{
- try
- {
- communicator().getPluginManager().getPlugin("IceSSL");
- _haveSSL = true;
- }
- catch(Ice.NotRegisteredException)
- {
- }
+ try
+ {
+ communicator().getPluginManager().getPlugin("IceSSL");
+ _haveSSL = true;
+ }
+ catch(Ice.NotRegisteredException)
+ {
+ }
HelloPrx twoway = HelloPrxHelper.checkedCast(
- communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false));
+ communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false));
if(twoway == null)
{
Console.Error.WriteLine("invalid proxy");
@@ -54,7 +54,7 @@ public class Client : Ice.Application
HelloPrx datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram());
HelloPrx batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram());
- bool secure = false;
+ bool secure = false;
menu();
@@ -84,25 +84,25 @@ public class Client : Ice.Application
}
else if(line.Equals("d"))
{
- if(secure)
- {
- Console.WriteLine("secure datagrams are not supported");
- }
- else
- {
- datagram.sayHello();
- }
+ if(secure)
+ {
+ Console.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ datagram.sayHello();
+ }
}
else if(line.Equals("D"))
{
- if(secure)
- {
- Console.WriteLine("secure datagrams are not supported");
- }
- else
- {
- batchDatagram.sayHello();
- }
+ if(secure)
+ {
+ Console.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ batchDatagram.sayHello();
+ }
}
else if(line.Equals("f"))
{
@@ -110,23 +110,23 @@ public class Client : Ice.Application
}
else if(_haveSSL && line.Equals("S"))
{
- secure = !secure;
+ secure = !secure;
- twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure));
- oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure));
- batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
- datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure));
- batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
-
- if(secure)
- {
- Console.WriteLine("secure mode is now on");
- }
- else
- {
- Console.WriteLine("secure mode is now off");
- }
- }
+ twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure));
+ oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure));
+ batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
+ datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure));
+ batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
+
+ if(secure)
+ {
+ Console.WriteLine("secure mode is now on");
+ }
+ else
+ {
+ Console.WriteLine("secure mode is now off");
+ }
+ }
else if(line.Equals("x"))
{
// Nothing to do
@@ -143,7 +143,7 @@ public class Client : Ice.Application
}
catch(System.Exception ex)
{
- Console.Error.WriteLine(ex);
+ Console.Error.WriteLine(ex);
}
}
while (!line.Equals("x"));
diff --git a/cs/demo/IceGrid/allocate/Client.cs b/cs/demo/IceGrid/allocate/Client.cs
index 24cef92b254..7d3b8792e08 100644
--- a/cs/demo/IceGrid/allocate/Client.cs
+++ b/cs/demo/IceGrid/allocate/Client.cs
@@ -17,47 +17,47 @@ public class Client : Ice.Application
class SessionKeepAliveThread
{
public SessionKeepAliveThread(IceGrid.SessionPrx session, int timeout)
- {
- _session = session;
- _timeout = timeout;
- _terminated = false;
- }
-
- public void run()
- {
- lock(this)
- {
+ {
+ _session = session;
+ _timeout = timeout;
+ _terminated = false;
+ }
+
+ public void run()
+ {
+ lock(this)
+ {
while(!_terminated)
{
- System.Threading.Monitor.Wait(this, _timeout);
+ System.Threading.Monitor.Wait(this, _timeout);
if(_terminated)
{
- break;
- }
+ break;
+ }
try
{
_session.keepAlive();
}
catch(Ice.LocalException)
{
- break;
+ break;
}
}
- }
- }
-
- public void terminate()
- {
- lock(this)
- {
- _terminated = true;
- System.Threading.Monitor.Pulse(this);
- }
- }
-
- private IceGrid.SessionPrx _session;
- private int _timeout;
- private bool _terminated;
+ }
+ }
+
+ public void terminate()
+ {
+ lock(this)
+ {
+ _terminated = true;
+ System.Threading.Monitor.Pulse(this);
+ }
+ }
+
+ private IceGrid.SessionPrx _session;
+ private int _timeout;
+ private bool _terminated;
}
private void menu()
@@ -72,129 +72,129 @@ public class Client : Ice.Application
public override int run(string[] args)
{
- int status = 0;
+ int status = 0;
IceGrid.RegistryPrx registry =
- IceGrid.RegistryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Registry"));
- if(registry == null)
- {
+ IceGrid.RegistryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Registry"));
+ if(registry == null)
+ {
Console.WriteLine("could not contact registry");
- return 1;
- }
-
-
- IceGrid.SessionPrx session = null;
- while(true)
- {
- Console.Out.WriteLine("This demo accepts any user-id / password combination.");
-
- string id;
- Console.Out.Write("user id: ");
- Console.Out.Flush();
- id = Console.In.ReadLine();
-
- string pw;
- Console.Out.Write("password: ");
- Console.Out.Flush();
- pw = Console.In.ReadLine();
-
- try
- {
- session = registry.createSession(id, pw);
- break;
- }
- catch(IceGrid.PermissionDeniedException ex)
- {
- Console.WriteLine("permission denied:\n" + ex.reason);
- }
- }
-
- SessionKeepAliveThread keepAlive = new SessionKeepAliveThread(session, (int)registry.getSessionTimeout() / 2);
- Thread keepAliveThread = new Thread(new ThreadStart(keepAlive.run));
- keepAliveThread.Start();
-
- try
- {
- HelloPrx hello;
- try
- {
- hello = HelloPrxHelper.checkedCast(
- session.allocateObjectById(communicator().stringToIdentity("hello")));
- }
- catch(IceGrid.ObjectNotRegisteredException)
- {
- hello = HelloPrxHelper.checkedCast(session.allocateObjectByType("::Demo::Hello"));
- }
-
- menu();
-
- string line = null;
- do
- {
- try
- {
- Console.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("t"))
- {
- hello.sayHello();
- }
- else if(line.Equals("s"))
- {
- hello.shutdown();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.WriteLine("unknown command `" + line + "'");
- menu();
- }
- }
- catch(Ice.LocalException ex)
- {
- Console.WriteLine(ex);
- }
- }
- while(!line.Equals("x"));
- }
- catch(IceGrid.AllocationException ex)
- {
- Console.WriteLine("could not allocate object: " + ex.reason);
- status = 1;
- }
- catch(Exception ex)
- {
- Console.WriteLine("expected exception: " + ex);
- status = 1;
- }
-
- //
- // Destroy the keepAlive thread and the sesion object otherwise
- // the session will be kept allocated until the timeout occurs.
- // Destroying the session will release all allocated objects.
- //
- keepAlive.terminate();
- keepAliveThread.Join();
- session.destroy();
+ return 1;
+ }
+
+
+ IceGrid.SessionPrx session = null;
+ while(true)
+ {
+ Console.Out.WriteLine("This demo accepts any user-id / password combination.");
+
+ string id;
+ Console.Out.Write("user id: ");
+ Console.Out.Flush();
+ id = Console.In.ReadLine();
+
+ string pw;
+ Console.Out.Write("password: ");
+ Console.Out.Flush();
+ pw = Console.In.ReadLine();
+
+ try
+ {
+ session = registry.createSession(id, pw);
+ break;
+ }
+ catch(IceGrid.PermissionDeniedException ex)
+ {
+ Console.WriteLine("permission denied:\n" + ex.reason);
+ }
+ }
+
+ SessionKeepAliveThread keepAlive = new SessionKeepAliveThread(session, (int)registry.getSessionTimeout() / 2);
+ Thread keepAliveThread = new Thread(new ThreadStart(keepAlive.run));
+ keepAliveThread.Start();
+
+ try
+ {
+ HelloPrx hello;
+ try
+ {
+ hello = HelloPrxHelper.checkedCast(
+ session.allocateObjectById(communicator().stringToIdentity("hello")));
+ }
+ catch(IceGrid.ObjectNotRegisteredException)
+ {
+ hello = HelloPrxHelper.checkedCast(session.allocateObjectByType("::Demo::Hello"));
+ }
+
+ menu();
+
+ string line = null;
+ do
+ {
+ try
+ {
+ Console.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
+ {
+ break;
+ }
+ if(line.Equals("t"))
+ {
+ hello.sayHello();
+ }
+ else if(line.Equals("s"))
+ {
+ hello.shutdown();
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
+ }
+ else
+ {
+ Console.WriteLine("unknown command `" + line + "'");
+ menu();
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ Console.WriteLine(ex);
+ }
+ }
+ while(!line.Equals("x"));
+ }
+ catch(IceGrid.AllocationException ex)
+ {
+ Console.WriteLine("could not allocate object: " + ex.reason);
+ status = 1;
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("expected exception: " + ex);
+ status = 1;
+ }
+
+ //
+ // Destroy the keepAlive thread and the sesion object otherwise
+ // the session will be kept allocated until the timeout occurs.
+ // Destroying the session will release all allocated objects.
+ //
+ keepAlive.terminate();
+ keepAliveThread.Join();
+ session.destroy();
return status;
}
public static void Main(string[] args)
{
- Client app = new Client();
- int status = app.main(args, "config.client");
+ Client app = new Client();
+ int status = app.main(args, "config.client");
if(status != 0)
{
System.Environment.Exit(status);
diff --git a/cs/demo/IceGrid/allocate/HelloI.cs b/cs/demo/IceGrid/allocate/HelloI.cs
index 6d29c1122ce..8d6a588c1a3 100644
--- a/cs/demo/IceGrid/allocate/HelloI.cs
+++ b/cs/demo/IceGrid/allocate/HelloI.cs
@@ -14,7 +14,7 @@ public class HelloI : HelloDisp_
{
public HelloI(string name)
{
- _name = name;
+ _name = name;
}
public override void sayHello(Ice.Current current)
diff --git a/cs/demo/IceGrid/allocate/Server.cs b/cs/demo/IceGrid/allocate/Server.cs
index 9dc3c5e3b38..12e42ed79a0 100644
--- a/cs/demo/IceGrid/allocate/Server.cs
+++ b/cs/demo/IceGrid/allocate/Server.cs
@@ -12,8 +12,8 @@ public class Server : Ice.Application
public override int run(string[] args)
{
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- Ice.Properties properties = communicator().getProperties();
- Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
+ Ice.Properties properties = communicator().getProperties();
+ Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
adapter.add(new HelloI(properties.getProperty("Ice.ServerId")), id);
adapter.activate();
communicator().waitForShutdown();
@@ -22,8 +22,8 @@ public class Server : Ice.Application
static public void Main(string[] args)
{
- Server app = new Server();
- int status = app.main(args);
+ Server app = new Server();
+ int status = app.main(args);
if(status != 0)
{
System.Environment.Exit(status);
diff --git a/cs/demo/IceGrid/sessionActivation/Client.cs b/cs/demo/IceGrid/sessionActivation/Client.cs
index af2e0a617e3..a7e7b35512e 100644
--- a/cs/demo/IceGrid/sessionActivation/Client.cs
+++ b/cs/demo/IceGrid/sessionActivation/Client.cs
@@ -17,47 +17,47 @@ public class Client : Ice.Application
class SessionKeepAliveThread
{
public SessionKeepAliveThread(IceGrid.SessionPrx session, int timeout)
- {
- _session = session;
- _timeout = timeout;
- _terminated = false;
- }
-
- public void run()
- {
- lock(this)
- {
+ {
+ _session = session;
+ _timeout = timeout;
+ _terminated = false;
+ }
+
+ public void run()
+ {
+ lock(this)
+ {
while(!_terminated)
{
- System.Threading.Monitor.Wait(this, _timeout);
+ System.Threading.Monitor.Wait(this, _timeout);
if(_terminated)
{
- break;
- }
+ break;
+ }
try
{
_session.keepAlive();
}
catch(Ice.LocalException)
{
- break;
+ break;
}
}
- }
- }
-
- public void terminate()
- {
- lock(this)
- {
- _terminated = true;
- System.Threading.Monitor.Pulse(this);
- }
- }
-
- private IceGrid.SessionPrx _session;
- private int _timeout;
- private bool _terminated;
+ }
+ }
+
+ public void terminate()
+ {
+ lock(this)
+ {
+ _terminated = true;
+ System.Threading.Monitor.Pulse(this);
+ }
+ }
+
+ private IceGrid.SessionPrx _session;
+ private int _timeout;
+ private bool _terminated;
}
private void menu()
@@ -71,122 +71,122 @@ public class Client : Ice.Application
public override int run(string[] args)
{
- int status = 1;
+ int status = 1;
IceGrid.RegistryPrx registry =
- IceGrid.RegistryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Registry"));
- if(registry == null)
- {
+ IceGrid.RegistryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Registry"));
+ if(registry == null)
+ {
Console.WriteLine("could not contact registry");
- return 1;
- }
-
-
- IceGrid.SessionPrx session = null;
- while(true)
- {
- Console.Out.WriteLine("This demo accepts any user-id / password combination.");
-
- string id;
- Console.Out.Write("user id: ");
- Console.Out.Flush();
- id = Console.In.ReadLine();
-
- string pw;
- Console.Out.Write("password: ");
- Console.Out.Flush();
- pw = Console.In.ReadLine();
-
- try
- {
- session = registry.createSession(id, pw);
- break;
- }
- catch(IceGrid.PermissionDeniedException ex)
- {
- Console.WriteLine("permission denied:\n" + ex.reason);
- }
- }
-
- SessionKeepAliveThread keepAlive = new SessionKeepAliveThread(session, (int)registry.getSessionTimeout() / 2);
- Thread keepAliveThread = new Thread(new ThreadStart(keepAlive.run));
- keepAliveThread.Start();
-
- try
- {
- HelloPrx hello = HelloPrxHelper.checkedCast(
- session.allocateObjectById(communicator().stringToIdentity("hello")));
-
- menu();
-
- string line = null;
- do
- {
- try
- {
- Console.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("t"))
- {
- hello.sayHello();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.WriteLine("unknown command `" + line + "'");
- menu();
- }
- }
- catch(Ice.LocalException ex)
- {
- Console.WriteLine(ex);
- }
- }
- while(!line.Equals("x"));
- }
- catch(IceGrid.AllocationException ex)
- {
- Console.WriteLine("could not allocate object: " + ex.reason);
- status = 1;
- }
- catch(IceGrid.ObjectNotRegisteredException)
- {
- Console.WriteLine("object not registered with registry");
- status = 1;
- }
- catch(Exception ex)
- {
- Console.WriteLine("expected exception: " + ex);
- status = 1;
- }
-
- //
- // Destroy the keepAlive thread and the sesion object otherwise
- // the session will be kept allocated until the timeout occurs.
- // Destroying the session will release all allocated objects.
- //
- keepAlive.terminate();
- keepAliveThread.Join();
- session.destroy();
+ return 1;
+ }
+
+
+ IceGrid.SessionPrx session = null;
+ while(true)
+ {
+ Console.Out.WriteLine("This demo accepts any user-id / password combination.");
+
+ string id;
+ Console.Out.Write("user id: ");
+ Console.Out.Flush();
+ id = Console.In.ReadLine();
+
+ string pw;
+ Console.Out.Write("password: ");
+ Console.Out.Flush();
+ pw = Console.In.ReadLine();
+
+ try
+ {
+ session = registry.createSession(id, pw);
+ break;
+ }
+ catch(IceGrid.PermissionDeniedException ex)
+ {
+ Console.WriteLine("permission denied:\n" + ex.reason);
+ }
+ }
+
+ SessionKeepAliveThread keepAlive = new SessionKeepAliveThread(session, (int)registry.getSessionTimeout() / 2);
+ Thread keepAliveThread = new Thread(new ThreadStart(keepAlive.run));
+ keepAliveThread.Start();
+
+ try
+ {
+ HelloPrx hello = HelloPrxHelper.checkedCast(
+ session.allocateObjectById(communicator().stringToIdentity("hello")));
+
+ menu();
+
+ string line = null;
+ do
+ {
+ try
+ {
+ Console.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
+ {
+ break;
+ }
+ if(line.Equals("t"))
+ {
+ hello.sayHello();
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
+ }
+ else
+ {
+ Console.WriteLine("unknown command `" + line + "'");
+ menu();
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ Console.WriteLine(ex);
+ }
+ }
+ while(!line.Equals("x"));
+ }
+ catch(IceGrid.AllocationException ex)
+ {
+ Console.WriteLine("could not allocate object: " + ex.reason);
+ status = 1;
+ }
+ catch(IceGrid.ObjectNotRegisteredException)
+ {
+ Console.WriteLine("object not registered with registry");
+ status = 1;
+ }
+ catch(Exception ex)
+ {
+ Console.WriteLine("expected exception: " + ex);
+ status = 1;
+ }
+
+ //
+ // Destroy the keepAlive thread and the sesion object otherwise
+ // the session will be kept allocated until the timeout occurs.
+ // Destroying the session will release all allocated objects.
+ //
+ keepAlive.terminate();
+ keepAliveThread.Join();
+ session.destroy();
return status;
}
public static void Main(string[] args)
{
- Client app = new Client();
- int status = app.main(args, "config.client");
+ Client app = new Client();
+ int status = app.main(args, "config.client");
if(status != 0)
{
System.Environment.Exit(status);
diff --git a/cs/demo/IceGrid/sessionActivation/HelloI.cs b/cs/demo/IceGrid/sessionActivation/HelloI.cs
index 5483e1b529c..58185209214 100644
--- a/cs/demo/IceGrid/sessionActivation/HelloI.cs
+++ b/cs/demo/IceGrid/sessionActivation/HelloI.cs
@@ -14,7 +14,7 @@ public class HelloI : HelloDisp_
{
public HelloI(string name)
{
- _name = name;
+ _name = name;
}
public override void sayHello(Ice.Current current)
diff --git a/cs/demo/IceGrid/sessionActivation/Server.cs b/cs/demo/IceGrid/sessionActivation/Server.cs
index 9dc3c5e3b38..12e42ed79a0 100644
--- a/cs/demo/IceGrid/sessionActivation/Server.cs
+++ b/cs/demo/IceGrid/sessionActivation/Server.cs
@@ -12,8 +12,8 @@ public class Server : Ice.Application
public override int run(string[] args)
{
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- Ice.Properties properties = communicator().getProperties();
- Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
+ Ice.Properties properties = communicator().getProperties();
+ Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
adapter.add(new HelloI(properties.getProperty("Ice.ServerId")), id);
adapter.activate();
communicator().waitForShutdown();
@@ -22,8 +22,8 @@ public class Server : Ice.Application
static public void Main(string[] args)
{
- Server app = new Server();
- int status = app.main(args);
+ Server app = new Server();
+ int status = app.main(args);
if(status != 0)
{
System.Environment.Exit(status);
diff --git a/cs/demo/IceGrid/simple/Client.cs b/cs/demo/IceGrid/simple/Client.cs
index ae4f0f43ad6..4b651059b38 100644
--- a/cs/demo/IceGrid/simple/Client.cs
+++ b/cs/demo/IceGrid/simple/Client.cs
@@ -25,16 +25,16 @@ public class Client : Ice.Application
public override int run(string[] args)
{
HelloPrx hello = null;
- try
- {
- hello = HelloPrxHelper.checkedCast(communicator().stringToProxy("hello"));
- }
- catch(Ice.NotRegisteredException)
- {
- IceGrid.QueryPrx query =
- IceGrid.QueryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Query"));
- hello = HelloPrxHelper.checkedCast(query.findObjectByType("::Demo::Hello"));
- }
+ try
+ {
+ hello = HelloPrxHelper.checkedCast(communicator().stringToProxy("hello"));
+ }
+ catch(Ice.NotRegisteredException)
+ {
+ IceGrid.QueryPrx query =
+ IceGrid.QueryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Query"));
+ hello = HelloPrxHelper.checkedCast(query.findObjectByType("::Demo::Hello"));
+ }
if(hello == null)
{
Console.WriteLine("couldn't find a `::Demo::Hello' object");
diff --git a/cs/demo/IceGrid/simple/HelloI.cs b/cs/demo/IceGrid/simple/HelloI.cs
index 6d29c1122ce..8d6a588c1a3 100644
--- a/cs/demo/IceGrid/simple/HelloI.cs
+++ b/cs/demo/IceGrid/simple/HelloI.cs
@@ -14,7 +14,7 @@ public class HelloI : HelloDisp_
{
public HelloI(string name)
{
- _name = name;
+ _name = name;
}
public override void sayHello(Ice.Current current)
diff --git a/cs/demo/IceGrid/simple/Server.cs b/cs/demo/IceGrid/simple/Server.cs
index 9dc3c5e3b38..12e42ed79a0 100644
--- a/cs/demo/IceGrid/simple/Server.cs
+++ b/cs/demo/IceGrid/simple/Server.cs
@@ -12,8 +12,8 @@ public class Server : Ice.Application
public override int run(string[] args)
{
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- Ice.Properties properties = communicator().getProperties();
- Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
+ Ice.Properties properties = communicator().getProperties();
+ Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
adapter.add(new HelloI(properties.getProperty("Ice.ServerId")), id);
adapter.activate();
communicator().waitForShutdown();
@@ -22,8 +22,8 @@ public class Server : Ice.Application
static public void Main(string[] args)
{
- Server app = new Server();
- int status = app.main(args);
+ Server app = new Server();
+ int status = app.main(args);
if(status != 0)
{
System.Environment.Exit(status);
diff --git a/cs/demo/IceStorm/clock/Publisher.cs b/cs/demo/IceStorm/clock/Publisher.cs
index bbdb50eb3bc..58181795e03 100755
--- a/cs/demo/IceStorm/clock/Publisher.cs
+++ b/cs/demo/IceStorm/clock/Publisher.cs
@@ -17,7 +17,7 @@ public class Publisher : Ice.Application
public override int run(string[] args)
{
IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast(
- communicator().propertyToProxy("IceStorm.TopicManager.Proxy"));
+ communicator().propertyToProxy("IceStorm.TopicManager.Proxy"));
if(manager == null)
{
Console.WriteLine("invalid proxy");
@@ -25,42 +25,42 @@ public class Publisher : Ice.Application
}
string topicName = "time";
- bool datagram = false;
- bool twoway = false;
- int optsSet = 0;
- for(int i = 0; i < args.Length; ++i)
- {
- if(args[i].Equals("--datagram"))
- {
- datagram = true;
- ++optsSet;
- }
- else if(args[i].Equals("--twoway"))
- {
- twoway = true;
- ++optsSet;
- }
- else if(args[i].Equals("--oneway"))
- {
- ++optsSet;
- }
- else if(args[i].StartsWith("--"))
- {
- usage();
- return 1;
- }
- else
- {
- topicName = args[i];
- break;
- }
- }
+ bool datagram = false;
+ bool twoway = false;
+ int optsSet = 0;
+ for(int i = 0; i < args.Length; ++i)
+ {
+ if(args[i].Equals("--datagram"))
+ {
+ datagram = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--twoway"))
+ {
+ twoway = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--oneway"))
+ {
+ ++optsSet;
+ }
+ else if(args[i].StartsWith("--"))
+ {
+ usage();
+ return 1;
+ }
+ else
+ {
+ topicName = args[i];
+ break;
+ }
+ }
- if(optsSet > 1)
- {
- usage();
- return 1;
- }
+ if(optsSet > 1)
+ {
+ usage();
+ return 1;
+ }
//
// Retrieve the topic.
@@ -72,57 +72,57 @@ public class Publisher : Ice.Application
}
catch(IceStorm.NoSuchTopic)
{
- try
- {
+ try
+ {
topic = manager.create(topicName);
- }
- catch(IceStorm.TopicExists)
- {
+ }
+ catch(IceStorm.TopicExists)
+ {
Console.WriteLine("temporary error. try again.");
return 1;
- }
+ }
}
- //
- // Get the topic's publisher object, and create a Clock proxy with
- // the mode specified as an argument of this application.
- //
- Ice.ObjectPrx publisher = topic.getPublisher();
- if(datagram)
- {
- publisher = publisher.ice_datagram();
- }
- else if(twoway)
- {
- // Do nothing.
- }
- else //if(oneway)
- {
- publisher = publisher.ice_oneway();
- }
- ClockPrx clock = ClockPrxHelper.uncheckedCast(publisher);
+ //
+ // Get the topic's publisher object, and create a Clock proxy with
+ // the mode specified as an argument of this application.
+ //
+ Ice.ObjectPrx publisher = topic.getPublisher();
+ if(datagram)
+ {
+ publisher = publisher.ice_datagram();
+ }
+ else if(twoway)
+ {
+ // Do nothing.
+ }
+ else //if(oneway)
+ {
+ publisher = publisher.ice_oneway();
+ }
+ ClockPrx clock = ClockPrxHelper.uncheckedCast(publisher);
Console.WriteLine("publishing tick events. Press ^C to terminate the application.");
- try
- {
+ try
+ {
while(true)
{
clock.tick(System.DateTime.Now.ToString("G", DateTimeFormatInfo.InvariantInfo));
- System.Threading.Thread.Sleep(1000);
+ System.Threading.Thread.Sleep(1000);
}
- }
- catch(Ice.CommunicatorDestroyedException)
- {
- // Ignore
- }
+ }
+ catch(Ice.CommunicatorDestroyedException)
+ {
+ // Ignore
+ }
return 0;
}
public void usage()
{
- Console.WriteLine("Usage: " + appName() + " [--datagram|--twoway|--oneway] [topic]");
+ Console.WriteLine("Usage: " + appName() + " [--datagram|--twoway|--oneway] [topic]");
}
diff --git a/cs/demo/IceStorm/clock/Subscriber.cs b/cs/demo/IceStorm/clock/Subscriber.cs
index decca11f81f..17da20475ad 100755
--- a/cs/demo/IceStorm/clock/Subscriber.cs
+++ b/cs/demo/IceStorm/clock/Subscriber.cs
@@ -16,15 +16,15 @@ public class Subscriber : Ice.Application
public class ClockI : ClockDisp_
{
public override void tick(string date, Ice.Current current)
- {
- System.Console.Out.WriteLine(date);
- }
+ {
+ System.Console.Out.WriteLine(date);
+ }
}
public override int run(string[] args)
{
IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast(
- communicator().propertyToProxy("IceStorm.TopicManager.Proxy"));
+ communicator().propertyToProxy("IceStorm.TopicManager.Proxy"));
if(manager == null)
{
Console.WriteLine("invalid proxy");
@@ -32,62 +32,62 @@ public class Subscriber : Ice.Application
}
string topicName = "time";
- bool datagram = false;
- bool twoway = false;
- bool ordered = false;
- bool batch = false;
- int optsSet = 0;
- for(int i = 0; i < args.Length; ++i)
- {
- if(args[i].Equals("--datagram"))
- {
- datagram = true;
- ++optsSet;
- }
- else if(args[i].Equals("--twoway"))
- {
- twoway = true;
- ++optsSet;
- }
- else if(args[i].Equals("--ordered"))
- {
- ordered = true;
- ++optsSet;
- }
- else if(args[i].Equals("--oneway"))
- {
- ++optsSet;
- }
- else if(args[i].Equals("--batch"))
- {
- batch = true;
- }
- else if(args[i].StartsWith("--"))
- {
- usage();
- return 1;
- }
- else
- {
- topicName = args[i];
- break;
- }
- }
-
- if(batch)
- {
- if(twoway || ordered)
- {
- Console.WriteLine(appName() + ": batch can only be set with oneway or datagram");
- return 1;
- }
- }
-
- if(optsSet > 1)
- {
- usage();
- return 1;
- }
+ bool datagram = false;
+ bool twoway = false;
+ bool ordered = false;
+ bool batch = false;
+ int optsSet = 0;
+ for(int i = 0; i < args.Length; ++i)
+ {
+ if(args[i].Equals("--datagram"))
+ {
+ datagram = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--twoway"))
+ {
+ twoway = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--ordered"))
+ {
+ ordered = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--oneway"))
+ {
+ ++optsSet;
+ }
+ else if(args[i].Equals("--batch"))
+ {
+ batch = true;
+ }
+ else if(args[i].StartsWith("--"))
+ {
+ usage();
+ return 1;
+ }
+ else
+ {
+ topicName = args[i];
+ break;
+ }
+ }
+
+ if(batch)
+ {
+ if(twoway || ordered)
+ {
+ Console.WriteLine(appName() + ": batch can only be set with oneway or datagram");
+ return 1;
+ }
+ }
+
+ if(optsSet > 1)
+ {
+ usage();
+ return 1;
+ }
//
// Retrieve the topic.
@@ -117,40 +117,40 @@ public class Subscriber : Ice.Application
//
Ice.ObjectPrx subscriber = adapter.addWithUUID(new ClockI());
- IceStorm.QoS qos = new IceStorm.QoS();
-
- //
- // Set up the proxy.
- //
- if(datagram)
- {
- subscriber = subscriber.ice_datagram();
- }
- else if(twoway)
- {
- // Do nothing to the subscriber proxy. Its already twoway.
- }
- else if(ordered)
- {
- // Do nothing to the subscriber proxy. Its already twoway.
- qos["reliability"] = "ordered";
- }
- else // if(oneway)
- {
- subscriber = subscriber.ice_oneway();
- }
- if(batch)
- {
- if(datagram)
- {
- subscriber = subscriber.ice_batchDatagram();
- }
- else
- {
- subscriber = subscriber.ice_batchOneway();
- }
- }
-
+ IceStorm.QoS qos = new IceStorm.QoS();
+
+ //
+ // Set up the proxy.
+ //
+ if(datagram)
+ {
+ subscriber = subscriber.ice_datagram();
+ }
+ else if(twoway)
+ {
+ // Do nothing to the subscriber proxy. Its already twoway.
+ }
+ else if(ordered)
+ {
+ // Do nothing to the subscriber proxy. Its already twoway.
+ qos["reliability"] = "ordered";
+ }
+ else // if(oneway)
+ {
+ subscriber = subscriber.ice_oneway();
+ }
+ if(batch)
+ {
+ if(datagram)
+ {
+ subscriber = subscriber.ice_batchDatagram();
+ }
+ else
+ {
+ subscriber = subscriber.ice_batchOneway();
+ }
+ }
+
topic.subscribeAndGetPublisher(qos, subscriber);
adapter.activate();
@@ -168,7 +168,7 @@ public class Subscriber : Ice.Application
public void
usage()
{
- Console.WriteLine("Usage: " + appName() + " [--batch] [--datagram|--twoway|--ordered|--oneway] [topic]");
+ Console.WriteLine("Usage: " + appName() + " [--batch] [--datagram|--twoway|--ordered|--oneway] [topic]");
}
diff --git a/cs/demo/book/evictor/EvictorBase.cs b/cs/demo/book/evictor/EvictorBase.cs
index 1224b7f6aa7..26749e0d291 100755
--- a/cs/demo/book/evictor/EvictorBase.cs
+++ b/cs/demo/book/evictor/EvictorBase.cs
@@ -12,135 +12,135 @@ namespace Evictor
public abstract class EvictorBase : Ice.LocalObjectImpl, Ice.ServantLocator
{
- public EvictorBase()
- {
- _size = 1000;
- }
-
- public EvictorBase(int size)
- {
- _size = size < 0 ? 1000 : size;
- }
-
- public abstract Ice.Object add(Ice.Current c, out Ice.LocalObject cookie);
-
- public abstract void evict(Ice.Object servant, Ice.LocalObject cookie);
-
- public Ice.Object locate(Ice.Current c, out Ice.LocalObject cookie)
- {
- lock(this)
- {
- //
- // Create a cookie.
- //
- EvictorCookie ec = new EvictorCookie();
-
- //
- // Check if we a servant in the map already.
- //
- ec.entry = (EvictorEntry)_map[c.id];
- bool newEntry = ec.entry == null;
- if(!newEntry)
- {
- //
- // Got an entry already, dequeue the entry from
- // its current position.
- //
- ec.entry.pos.Remove();
- }
- else
- {
- //
- // We do not have an entry. Ask the derived class to
- // instantiate a servant and add a new entry to the map.
- //
- ec.entry = new EvictorEntry();
- Ice.LocalObject theCookie;
- ec.entry.servant = add(c, out theCookie); // Down-call
- if(ec.entry.servant == null)
- {
- return null;
- }
- ec.entry.userCookie = theCookie;
- ec.entry.useCount = 0;
- _map[c.id] = ec.entry;
- }
-
- //
- // Increment the use count of the servant and enqueue
- // the entry at the front, so we get LRU order.
- //
- ++(ec.entry.useCount);
- _queue.AddFirst(c.id);
- ec.entry.pos = (LinkedList.Enumerator)_queue.GetEnumerator();
+ public EvictorBase()
+ {
+ _size = 1000;
+ }
+
+ public EvictorBase(int size)
+ {
+ _size = size < 0 ? 1000 : size;
+ }
+
+ public abstract Ice.Object add(Ice.Current c, out Ice.LocalObject cookie);
+
+ public abstract void evict(Ice.Object servant, Ice.LocalObject cookie);
+
+ public Ice.Object locate(Ice.Current c, out Ice.LocalObject cookie)
+ {
+ lock(this)
+ {
+ //
+ // Create a cookie.
+ //
+ EvictorCookie ec = new EvictorCookie();
+
+ //
+ // Check if we a servant in the map already.
+ //
+ ec.entry = (EvictorEntry)_map[c.id];
+ bool newEntry = ec.entry == null;
+ if(!newEntry)
+ {
+ //
+ // Got an entry already, dequeue the entry from
+ // its current position.
+ //
+ ec.entry.pos.Remove();
+ }
+ else
+ {
+ //
+ // We do not have an entry. Ask the derived class to
+ // instantiate a servant and add a new entry to the map.
+ //
+ ec.entry = new EvictorEntry();
+ Ice.LocalObject theCookie;
+ ec.entry.servant = add(c, out theCookie); // Down-call
+ if(ec.entry.servant == null)
+ {
+ return null;
+ }
+ ec.entry.userCookie = theCookie;
+ ec.entry.useCount = 0;
+ _map[c.id] = ec.entry;
+ }
+
+ //
+ // Increment the use count of the servant and enqueue
+ // the entry at the front, so we get LRU order.
+ //
+ ++(ec.entry.useCount);
+ _queue.AddFirst(c.id);
+ ec.entry.pos = (LinkedList.Enumerator)_queue.GetEnumerator();
ec.entry.pos.MovePrev();
cookie = ec;
- return ec.entry.servant;
- }
- }
-
- public void finished(Ice.Current c, Ice.Object o, Ice.LocalObject cookie)
- {
- lock(this)
- {
- EvictorCookie ec = (EvictorCookie)cookie;
-
- //
- // Decrement use count and check if
- // there is something to evict.
- //
- --(ec.entry).useCount;
- evictServants();
- }
- }
-
- public void deactivate(string category)
- {
- lock(this)
- {
- _size = 0;
- evictServants();
- }
- }
-
- private class EvictorEntry
- {
- internal Ice.Object servant;
- internal Ice.LocalObject userCookie;
- internal LinkedList.Enumerator pos;
- internal int useCount;
- }
-
- private class EvictorCookie : Ice.LocalObjectImpl
- {
- public EvictorEntry entry;
- }
-
- private void evictServants()
- {
- //
- // If the evictor queue has grown larger than the limit,
- // look at the excess elements to see whether any of them
- // can be evicted.
- //
- LinkedList.Enumerator p = (LinkedList.Enumerator)_queue.GetEnumerator();
- for(int i = _map.Count - _size; i > 0; --i)
- {
+ return ec.entry.servant;
+ }
+ }
+
+ public void finished(Ice.Current c, Ice.Object o, Ice.LocalObject cookie)
+ {
+ lock(this)
+ {
+ EvictorCookie ec = (EvictorCookie)cookie;
+
+ //
+ // Decrement use count and check if
+ // there is something to evict.
+ //
+ --(ec.entry).useCount;
+ evictServants();
+ }
+ }
+
+ public void deactivate(string category)
+ {
+ lock(this)
+ {
+ _size = 0;
+ evictServants();
+ }
+ }
+
+ private class EvictorEntry
+ {
+ internal Ice.Object servant;
+ internal Ice.LocalObject userCookie;
+ internal LinkedList.Enumerator pos;
+ internal int useCount;
+ }
+
+ private class EvictorCookie : Ice.LocalObjectImpl
+ {
+ public EvictorEntry entry;
+ }
+
+ private void evictServants()
+ {
+ //
+ // If the evictor queue has grown larger than the limit,
+ // look at the excess elements to see whether any of them
+ // can be evicted.
+ //
+ LinkedList.Enumerator p = (LinkedList.Enumerator)_queue.GetEnumerator();
+ for(int i = _map.Count - _size; i > 0; --i)
+ {
p.MovePrev();
- Ice.Identity id = (Ice.Identity)p.Current;
- EvictorEntry e = (EvictorEntry)_map[id];
- if(e.useCount == 0)
- {
- evict(e.servant, e.userCookie); // Down-call
- p.Remove();
- _map.Remove(id);
- }
- }
- }
-
- private System.Collections.Hashtable _map = new System.Collections.Hashtable();
- private LinkedList _queue = new LinkedList();
- private int _size;
+ Ice.Identity id = (Ice.Identity)p.Current;
+ EvictorEntry e = (EvictorEntry)_map[id];
+ if(e.useCount == 0)
+ {
+ evict(e.servant, e.userCookie); // Down-call
+ p.Remove();
+ _map.Remove(id);
+ }
+ }
+ }
+
+ private System.Collections.Hashtable _map = new System.Collections.Hashtable();
+ private LinkedList _queue = new LinkedList();
+ private int _size;
}
}
diff --git a/cs/demo/book/evictor/LinkedList.cs b/cs/demo/book/evictor/LinkedList.cs
index ec27ae17e3a..8f8c08e6238 100755
--- a/cs/demo/book/evictor/LinkedList.cs
+++ b/cs/demo/book/evictor/LinkedList.cs
@@ -15,258 +15,258 @@ namespace Evictor
public class LinkedList : ICollection, ICloneable
{
- public LinkedList()
- {
- _head = null;
- _tail = null;
- _count = 0;
- }
+ public LinkedList()
+ {
+ _head = null;
+ _tail = null;
+ _count = 0;
+ }
- public int Count
- {
- get
- {
- return _count;
- }
- }
+ public int Count
+ {
+ get
+ {
+ return _count;
+ }
+ }
- public bool IsSynchronized
- {
- get
- {
- return false;
- }
- }
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
- public object SyncRoot
- {
- get
- {
- return this;
- }
- }
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
- public void CopyTo(Array array, int index)
- {
- //
- // Check preconditions.
- //
- if(array == null)
- {
- throw new ArgumentNullException("array", "array parameter must not be null");
- }
- if(index < 0)
- {
- throw new ArgumentOutOfRangeException("index", _count, "index must not be less than zero");
- }
- if(index >= array.Length)
- {
- throw new ArgumentException("index out of bounds for array", "index");
- }
- if(array.Length - index > _count)
- {
- throw new ArgumentException("insufficient room in array", "array");
- }
- if(array.Rank != 1)
- {
- throw new ArgumentException("array must be one-dimensional", "array");
- }
+ public void CopyTo(Array array, int index)
+ {
+ //
+ // Check preconditions.
+ //
+ if(array == null)
+ {
+ throw new ArgumentNullException("array", "array parameter must not be null");
+ }
+ if(index < 0)
+ {
+ throw new ArgumentOutOfRangeException("index", _count, "index must not be less than zero");
+ }
+ if(index >= array.Length)
+ {
+ throw new ArgumentException("index out of bounds for array", "index");
+ }
+ if(array.Length - index > _count)
+ {
+ throw new ArgumentException("insufficient room in array", "array");
+ }
+ if(array.Rank != 1)
+ {
+ throw new ArgumentException("array must be one-dimensional", "array");
+ }
- //
- // Copy the elements.
- //
- Node n = _head;
- while(n != null)
- {
- array.SetValue(n.val, index++);
- n = (Node)n.next;
- }
- }
+ //
+ // Copy the elements.
+ //
+ Node n = _head;
+ while(n != null)
+ {
+ array.SetValue(n.val, index++);
+ n = (Node)n.next;
+ }
+ }
- public IEnumerator GetEnumerator()
- {
- return new Enumerator(this);
- }
+ public IEnumerator GetEnumerator()
+ {
+ return new Enumerator(this);
+ }
- public object Clone()
- {
- LinkedList l = new LinkedList();
- Node cursor = _head;
- while(cursor != null)
- {
- l.Add(cursor.val);
- cursor = cursor.next;
- }
- return l;
- }
+ public object Clone()
+ {
+ LinkedList l = new LinkedList();
+ Node cursor = _head;
+ while(cursor != null)
+ {
+ l.Add(cursor.val);
+ cursor = cursor.next;
+ }
+ return l;
+ }
- public void Add(object value)
- {
- Node n = new Node();
- n.val = value;
- if(_tail == null)
- {
- n.prev = null;
- n.next = null;
- _head = n;
- _tail = n;
- }
- else
- {
- n.prev = _tail;
- n.next = null;
- _tail.next = n;
- _tail = n;
- }
- _count++;
- }
+ public void Add(object value)
+ {
+ Node n = new Node();
+ n.val = value;
+ if(_tail == null)
+ {
+ n.prev = null;
+ n.next = null;
+ _head = n;
+ _tail = n;
+ }
+ else
+ {
+ n.prev = _tail;
+ n.next = null;
+ _tail.next = n;
+ _tail = n;
+ }
+ _count++;
+ }
- public void AddFirst(object value)
- {
- Node n = new Node();
- n.val = value;
- if(_head == null)
- {
- n.prev = null;
- n.next = null;
- _head = n;
- _tail = n;
- }
- else
- {
- n.prev = null;
- n.next = _head;
- _head.prev = n;
- _head = n;
- }
- _count++;
- }
+ public void AddFirst(object value)
+ {
+ Node n = new Node();
+ n.val = value;
+ if(_head == null)
+ {
+ n.prev = null;
+ n.next = null;
+ _head = n;
+ _tail = n;
+ }
+ else
+ {
+ n.prev = null;
+ n.next = _head;
+ _head.prev = n;
+ _head = n;
+ }
+ _count++;
+ }
- private void Remove(Node n)
- {
- Debug.Assert(n != null);
- Debug.Assert(_count != 0);
-
- if(n.prev != null)
- {
- n.prev.next = n.next;
- }
- else
- {
- _head = n.next;
- }
- if(n.next != null)
- {
- n.next.prev = n.prev;
- }
- else
- {
- _tail = n.prev;
- }
- _count--;
- }
+ private void Remove(Node n)
+ {
+ Debug.Assert(n != null);
+ Debug.Assert(_count != 0);
+
+ if(n.prev != null)
+ {
+ n.prev.next = n.next;
+ }
+ else
+ {
+ _head = n.next;
+ }
+ if(n.next != null)
+ {
+ n.next.prev = n.prev;
+ }
+ else
+ {
+ _tail = n.prev;
+ }
+ _count--;
+ }
- internal class Node
- {
- internal Node next;
- internal Node prev;
- internal object val;
- }
+ internal class Node
+ {
+ internal Node next;
+ internal Node prev;
+ internal object val;
+ }
- private Node _head;
- private Node _tail;
- private int _count;
+ private Node _head;
+ private Node _tail;
+ private int _count;
- public class Enumerator : IEnumerator
- {
- internal Enumerator(LinkedList list)
- {
- _list = list;
- _current = null;
- _movePrev = null;
- _moveNext = null;
- _removed = false;
- }
+ public class Enumerator : IEnumerator
+ {
+ internal Enumerator(LinkedList list)
+ {
+ _list = list;
+ _current = null;
+ _movePrev = null;
+ _moveNext = null;
+ _removed = false;
+ }
- public void Reset()
- {
- _current = null;
- _movePrev = null;
- _moveNext = null;
- _removed = false;
- }
+ public void Reset()
+ {
+ _current = null;
+ _movePrev = null;
+ _moveNext = null;
+ _removed = false;
+ }
- public object Current
- {
- get
- {
- if(_current == null)
- {
- throw new InvalidOperationException("iterator not positioned on an element");
- }
- return _current.val;
- }
- }
+ public object Current
+ {
+ get
+ {
+ if(_current == null)
+ {
+ throw new InvalidOperationException("iterator not positioned on an element");
+ }
+ return _current.val;
+ }
+ }
- public bool MoveNext()
- {
- if(_removed)
- {
- _current = _moveNext;
- _moveNext = null;
- _movePrev = null;
- _removed = false;
- }
- else
- {
- if(_current == _list._tail) // Make sure the iterator "sticks" if on last element.
- {
- return false;
- }
- _current = _current == null ? _list._head : _current.next;
- }
- return _current != null;
- }
+ public bool MoveNext()
+ {
+ if(_removed)
+ {
+ _current = _moveNext;
+ _moveNext = null;
+ _movePrev = null;
+ _removed = false;
+ }
+ else
+ {
+ if(_current == _list._tail) // Make sure the iterator "sticks" if on last element.
+ {
+ return false;
+ }
+ _current = _current == null ? _list._head : _current.next;
+ }
+ return _current != null;
+ }
- public bool MovePrev()
- {
- if(_removed)
- {
- _current = _movePrev;
- _movePrev = null;
- _moveNext = null;
- _removed = false;
- }
- else
- {
- if(_current == _list._head) // Make sure the iterator "sticks" if on first element.
- {
- return false;
- }
- _current = _current == null ? _list._tail : _current.prev;
- }
- return _current != null;
- }
+ public bool MovePrev()
+ {
+ if(_removed)
+ {
+ _current = _movePrev;
+ _movePrev = null;
+ _moveNext = null;
+ _removed = false;
+ }
+ else
+ {
+ if(_current == _list._head) // Make sure the iterator "sticks" if on first element.
+ {
+ return false;
+ }
+ _current = _current == null ? _list._tail : _current.prev;
+ }
+ return _current != null;
+ }
- public void Remove()
- {
- if(_current == null)
- {
- throw new InvalidOperationException("iterator is not positioned on an element");
- }
- _removed = true;
- _moveNext = _current.next; // Remember where to move next for call to MoveNext().
- _movePrev = _current.prev; // Remember where to move next for call to MovePrev().
- _list.Remove(_current);
- _current = null;
- }
+ public void Remove()
+ {
+ if(_current == null)
+ {
+ throw new InvalidOperationException("iterator is not positioned on an element");
+ }
+ _removed = true;
+ _moveNext = _current.next; // Remember where to move next for call to MoveNext().
+ _movePrev = _current.prev; // Remember where to move next for call to MovePrev().
+ _list.Remove(_current);
+ _current = null;
+ }
- private LinkedList _list; // The list we are iterating over.
- private Node _current; // Current iterator position.
- private Node _moveNext; // Remembers node that preceded a removed element.
- private Node _movePrev; // Remembers node that followed a removed element.
- private bool _removed; // True after a call to Remove(), false otherwise.
- }
+ private LinkedList _list; // The list we are iterating over.
+ private Node _current; // Current iterator position.
+ private Node _moveNext; // Remembers node that preceded a removed element.
+ private Node _movePrev; // Remembers node that followed a removed element.
+ private bool _removed; // True after a call to Remove(), false otherwise.
+ }
}
}
diff --git a/cs/demo/book/printer/Client.cs b/cs/demo/book/printer/Client.cs
index 40fc2cb8f2c..fd4bd6b2723 100755
--- a/cs/demo/book/printer/Client.cs
+++ b/cs/demo/book/printer/Client.cs
@@ -17,31 +17,31 @@ public class Client
int status = 0;
Ice.Communicator ic = null;
try {
- ic = Ice.Util.initialize(ref args);
- Ice.ObjectPrx obj = ic.stringToProxy(
- "SimplePrinter:default -p 10000");
- PrinterPrx printer = PrinterPrxHelper.checkedCast(obj);
- if (printer == null)
- throw new ApplicationException("Invalid proxy");
+ ic = Ice.Util.initialize(ref args);
+ Ice.ObjectPrx obj = ic.stringToProxy(
+ "SimplePrinter:default -p 10000");
+ PrinterPrx printer = PrinterPrxHelper.checkedCast(obj);
+ if (printer == null)
+ throw new ApplicationException("Invalid proxy");
- printer.printString("Hello World!");
+ printer.printString("Hello World!");
} catch (Exception e) {
- Console.Error.WriteLine(e);
- status = 1;
- }
- if (ic != null) {
- // Clean up
- //
- try {
- ic.destroy();
- } catch (Exception e) {
- Console.Error.WriteLine(e);
- status = 1;
- }
- }
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ Console.Error.WriteLine(e);
+ status = 1;
+ }
+ if (ic != null) {
+ // Clean up
+ //
+ try {
+ ic.destroy();
+ } catch (Exception e) {
+ Console.Error.WriteLine(e);
+ status = 1;
+ }
+ }
+ if(status != 0)
+ {
+ System.Environment.Exit(status);
+ }
}
}
diff --git a/cs/demo/book/printer/Printer.ice b/cs/demo/book/printer/Printer.ice
index 87146f1288e..4a35e77a02b 100755
--- a/cs/demo/book/printer/Printer.ice
+++ b/cs/demo/book/printer/Printer.ice
@@ -13,7 +13,7 @@
module Demo {
interface Printer
{
- void printString(string s);
+ void printString(string s);
};
};
diff --git a/cs/demo/book/printer/Server.cs b/cs/demo/book/printer/Server.cs
index 841cff6cceb..fb361bf363d 100755
--- a/cs/demo/book/printer/Server.cs
+++ b/cs/demo/book/printer/Server.cs
@@ -21,34 +21,34 @@ public class Server
{
public static void Main(string[] args)
{
- int status = 0;
- Ice.Communicator ic = null;
+ int status = 0;
+ Ice.Communicator ic = null;
try {
- ic = Ice.Util.initialize(ref args);
- Ice.ObjectAdapter adapter
- = ic.createObjectAdapterWithEndpoints(
- "SimplePrinterAdapter", "default -p 10000");
- Ice.Object obj = new PrinterI();
- adapter.add(
- obj,
- ic.stringToIdentity("SimplePrinter"));
- adapter.activate();
- ic.waitForShutdown();
+ ic = Ice.Util.initialize(ref args);
+ Ice.ObjectAdapter adapter
+ = ic.createObjectAdapterWithEndpoints(
+ "SimplePrinterAdapter", "default -p 10000");
+ Ice.Object obj = new PrinterI();
+ adapter.add(
+ obj,
+ ic.stringToIdentity("SimplePrinter"));
+ adapter.activate();
+ ic.waitForShutdown();
} catch (Exception e) {
- Console.Error.WriteLine(e);
- status = 1;
- }
- if (ic != null)
- {
- // Clean up
- //
- try {
- ic.destroy();
- } catch (Exception e) {
- Console.Error.WriteLine(e);
- status = 1;
- }
- }
+ Console.Error.WriteLine(e);
+ status = 1;
+ }
+ if (ic != null)
+ {
+ // Clean up
+ //
+ try {
+ ic.destroy();
+ } catch (Exception e) {
+ Console.Error.WriteLine(e);
+ status = 1;
+ }
+ }
if(status != 0)
{
System.Environment.Exit(status);
diff --git a/cs/demo/book/simple_filesystem/Client.cs b/cs/demo/book/simple_filesystem/Client.cs
index d0cd00d3cfb..80b400a65f6 100755
--- a/cs/demo/book/simple_filesystem/Client.cs
+++ b/cs/demo/book/simple_filesystem/Client.cs
@@ -18,64 +18,64 @@ public class Client
static void listRecursive(DirectoryPrx dir, int depth)
{
- string indent = new string('\t', ++depth);
+ string indent = new string('\t', ++depth);
- NodePrx[] contents = dir.list();
+ NodePrx[] contents = dir.list();
- foreach (NodePrx node in contents) {
- DirectoryPrx subdir = DirectoryPrxHelper.checkedCast(node);
- FilePrx file = FilePrxHelper.uncheckedCast(node);
- Console.WriteLine(indent + node.name() + (subdir != null ? " (directory):" : " (file):"));
- if (subdir != null) {
- listRecursive(subdir, depth);
- } else {
- string[] text = file.read();
- for (int j = 0; j < text.Length; ++j)
- Console.WriteLine(indent + "\t" + text[j]);
- }
- }
+ foreach (NodePrx node in contents) {
+ DirectoryPrx subdir = DirectoryPrxHelper.checkedCast(node);
+ FilePrx file = FilePrxHelper.uncheckedCast(node);
+ Console.WriteLine(indent + node.name() + (subdir != null ? " (directory):" : " (file):"));
+ if (subdir != null) {
+ listRecursive(subdir, depth);
+ } else {
+ string[] text = file.read();
+ for (int j = 0; j < text.Length; ++j)
+ Console.WriteLine(indent + "\t" + text[j]);
+ }
+ }
}
public static void Main(string[] args)
{
- int status = 0;
- Ice.Communicator ic = null;
- try {
- // Create a communicator
- //
- ic = Ice.Util.initialize(ref args);
+ int status = 0;
+ Ice.Communicator ic = null;
+ try {
+ // Create a communicator
+ //
+ ic = Ice.Util.initialize(ref args);
- // Create a proxy for the root directory
- //
- Ice.ObjectPrx obj = ic.stringToProxy("RootDir:default -p 10000");
+ // Create a proxy for the root directory
+ //
+ Ice.ObjectPrx obj = ic.stringToProxy("RootDir:default -p 10000");
- // Down-cast the proxy to a Directory proxy
- //
- DirectoryPrx rootDir = DirectoryPrxHelper.checkedCast(obj);
- if (rootDir == null)
- throw new ApplicationException("Invalid proxy");
+ // Down-cast the proxy to a Directory proxy
+ //
+ DirectoryPrx rootDir = DirectoryPrxHelper.checkedCast(obj);
+ if (rootDir == null)
+ throw new ApplicationException("Invalid proxy");
- // Recursively list the contents of the root directory
- //
- Console.WriteLine("Contents of root directory:");
- listRecursive(rootDir, 0);
- } catch (Exception e) {
- Console.Error.WriteLine(e);
- status = 1;
- }
- if (ic != null) {
- // Clean up
- //
- try {
- ic.destroy();
- } catch (Exception e) {
- Console.Error.WriteLine(e);
- status = 1;
- }
- }
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ // Recursively list the contents of the root directory
+ //
+ Console.WriteLine("Contents of root directory:");
+ listRecursive(rootDir, 0);
+ } catch (Exception e) {
+ Console.Error.WriteLine(e);
+ status = 1;
+ }
+ if (ic != null) {
+ // Clean up
+ //
+ try {
+ ic.destroy();
+ } catch (Exception e) {
+ Console.Error.WriteLine(e);
+ status = 1;
+ }
+ }
+ if(status != 0)
+ {
+ System.Environment.Exit(status);
+ }
}
}
diff --git a/cs/demo/book/simple_filesystem/DirectoryI.cs b/cs/demo/book/simple_filesystem/DirectoryI.cs
index 98a25feb615..82a05e8cfed 100755
--- a/cs/demo/book/simple_filesystem/DirectoryI.cs
+++ b/cs/demo/book/simple_filesystem/DirectoryI.cs
@@ -16,29 +16,29 @@ public class DirectoryI : DirectoryDisp_
public DirectoryI(string name, DirectoryI parent)
{
- _name = name;
- _parent = parent;
-
- // Create an identity. The parent has the fixed identity "/"
- //
- Ice.Identity myID = _adapter.getCommunicator().stringToIdentity(_parent != null ? Ice.Util.generateUUID() : "RootDir");
-
- // Add the identity to the object adapter
- //
- _adapter.add(this, myID);
-
- // Create a proxy for the new node and add it as a child to the parent
- //
- NodePrx thisNode = NodePrxHelper.uncheckedCast(_adapter.createProxy(myID));
- if (_parent != null)
- _parent.addChild(thisNode);
+ _name = name;
+ _parent = parent;
+
+ // Create an identity. The parent has the fixed identity "/"
+ //
+ Ice.Identity myID = _adapter.getCommunicator().stringToIdentity(_parent != null ? Ice.Util.generateUUID() : "RootDir");
+
+ // Add the identity to the object adapter
+ //
+ _adapter.add(this, myID);
+
+ // Create a proxy for the new node and add it as a child to the parent
+ //
+ NodePrx thisNode = NodePrxHelper.uncheckedCast(_adapter.createProxy(myID));
+ if (_parent != null)
+ _parent.addChild(thisNode);
}
// Slice Node::name() operation
public override string name(Ice.Current current)
{
- return _name;
+ return _name;
}
// Slice Directory::list() operation
@@ -53,7 +53,7 @@ public class DirectoryI : DirectoryDisp_
public void addChild(NodePrx child)
{
- _contents.Add(child);
+ _contents.Add(child);
}
public static Ice.ObjectAdapter _adapter;
diff --git a/cs/demo/book/simple_filesystem/FileI.cs b/cs/demo/book/simple_filesystem/FileI.cs
index 9b549945b60..67ee9cceaf0 100755
--- a/cs/demo/book/simple_filesystem/FileI.cs
+++ b/cs/demo/book/simple_filesystem/FileI.cs
@@ -16,44 +16,44 @@ public class FileI : FileDisp_
public FileI(string name, DirectoryI parent)
{
- _name = name;
- _parent = parent;
+ _name = name;
+ _parent = parent;
- Debug.Assert(_parent != null);
+ Debug.Assert(_parent != null);
- // Create an identity
- //
- Ice.Identity myID = _adapter.getCommunicator().stringToIdentity(Ice.Util.generateUUID());
+ // Create an identity
+ //
+ Ice.Identity myID = _adapter.getCommunicator().stringToIdentity(Ice.Util.generateUUID());
- // Add the identity to the object adapter
- //
- _adapter.add(this, myID);
+ // Add the identity to the object adapter
+ //
+ _adapter.add(this, myID);
- // Create a proxy for the new node and add it as a child to the parent
- //
- NodePrx thisNode = NodePrxHelper.uncheckedCast(_adapter.createProxy(myID));
- _parent.addChild(thisNode);
+ // Create a proxy for the new node and add it as a child to the parent
+ //
+ NodePrx thisNode = NodePrxHelper.uncheckedCast(_adapter.createProxy(myID));
+ _parent.addChild(thisNode);
}
// Slice Node::name() operation
public override string name(Ice.Current current)
{
- return _name;
+ return _name;
}
// Slice File::read() operation
public override string[] read(Ice.Current current)
{
- return _lines;
+ return _lines;
}
// Slice File::write() operation
public override void write(string[] text, Ice.Current current)
{
- _lines = text;
+ _lines = text;
}
public static Ice.ObjectAdapter _adapter;
diff --git a/cs/demo/book/simple_filesystem/Filesystem.ice b/cs/demo/book/simple_filesystem/Filesystem.ice
index 1fab7e0a7c2..c2458a5e8a8 100755
--- a/cs/demo/book/simple_filesystem/Filesystem.ice
+++ b/cs/demo/book/simple_filesystem/Filesystem.ice
@@ -9,23 +9,23 @@
module Filesystem {
exception GenericError {
- string reason;
+ string reason;
};
interface Node {
- idempotent string name();
+ idempotent string name();
};
sequence<string> Lines;
interface File extends Node {
- idempotent Lines read();
- idempotent void write(Lines text) throws GenericError;
+ idempotent Lines read();
+ idempotent void write(Lines text) throws GenericError;
};
sequence<Node*> NodeSeq;
interface Directory extends Node {
- idempotent NodeSeq list();
+ idempotent NodeSeq list();
};
};
diff --git a/cs/demo/book/simple_filesystem/Server.cs b/cs/demo/book/simple_filesystem/Server.cs
index eb1931026ff..410d2c67f0c 100755
--- a/cs/demo/book/simple_filesystem/Server.cs
+++ b/cs/demo/book/simple_filesystem/Server.cs
@@ -15,71 +15,71 @@ public class Server : Ice.Application
public override int run(string[] args)
{
// Terminate cleanly on receipt of a signal
- //
- shutdownOnInterrupt();
+ //
+ shutdownOnInterrupt();
- // Create an object adapter (stored in the _adapter
- // static members)
- //
- Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints(
- "SimpleFilesystem", "default -p 10000");
- DirectoryI._adapter = adapter;
- FileI._adapter = adapter;
+ // Create an object adapter (stored in the _adapter
+ // static members)
+ //
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints(
+ "SimpleFilesystem", "default -p 10000");
+ DirectoryI._adapter = adapter;
+ FileI._adapter = adapter;
- // Create the root directory (with name "/" and no parent)
- //
- DirectoryI root = new DirectoryI("/", null);
+ // Create the root directory (with name "/" and no parent)
+ //
+ DirectoryI root = new DirectoryI("/", null);
- // Create a file called "README" in the root directory
- //
- File file = new FileI("README", root);
- string[] text;
- text = new string[]{ "This file system contains a collection of poetry." };
- try {
- file.write(text);
- } catch (GenericError e) {
- Console.Error.WriteLine(e.reason);
- }
+ // Create a file called "README" in the root directory
+ //
+ File file = new FileI("README", root);
+ string[] text;
+ text = new string[]{ "This file system contains a collection of poetry." };
+ try {
+ file.write(text);
+ } catch (GenericError e) {
+ Console.Error.WriteLine(e.reason);
+ }
- // Create a directory called "Coleridge" in the root directory
- //
- DirectoryI coleridge = new DirectoryI("Coleridge", root);
+ // Create a directory called "Coleridge" in the root directory
+ //
+ DirectoryI coleridge = new DirectoryI("Coleridge", root);
- // Create a file called "Kubla_Khan" in the Coleridge directory
- //
- file = new FileI("Kubla_Khan", coleridge);
- text = new string[]{ "In Xanadu did Kubla Khan",
- "A stately pleasure-dome decree:",
- "Where Alph, the sacred river, ran",
- "Through caverns measureless to man",
- "Down to a sunless sea." };
- try {
- file.write(text);
- } catch (GenericError e) {
- Console.Error.WriteLine(e.reason);
- }
+ // Create a file called "Kubla_Khan" in the Coleridge directory
+ //
+ file = new FileI("Kubla_Khan", coleridge);
+ text = new string[]{ "In Xanadu did Kubla Khan",
+ "A stately pleasure-dome decree:",
+ "Where Alph, the sacred river, ran",
+ "Through caverns measureless to man",
+ "Down to a sunless sea." };
+ try {
+ file.write(text);
+ } catch (GenericError e) {
+ Console.Error.WriteLine(e.reason);
+ }
- // All objects are created, allow client requests now
- //
- adapter.activate();
+ // All objects are created, allow client requests now
+ //
+ adapter.activate();
- // Wait until we are done
- //
- communicator().waitForShutdown();
+ // Wait until we are done
+ //
+ communicator().waitForShutdown();
- if (interrupted())
- Console.Error.WriteLine(appName() + ": terminating");
+ if (interrupted())
+ Console.Error.WriteLine(appName() + ": terminating");
- return 0;
+ return 0;
}
public static void Main(string[] args)
{
Server app = new Server();
- int status = app.main(args);
- if(status != 0)
- {
- Environment.Exit(status);
- }
+ int status = app.main(args);
+ if(status != 0)
+ {
+ Environment.Exit(status);
+ }
}
}