summaryrefslogtreecommitdiff
path: root/java/demo/Ice
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
committerBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
commitabada90e3f84dc703b8ddc9efcbed8a946fadead (patch)
tree2c6f9dccd510ea97cb927a7bd635422efaae547a /java/demo/Ice
parentremoving trace message (diff)
downloadice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip
Expanded tabs into spaces
Diffstat (limited to 'java/demo/Ice')
-rw-r--r--java/demo/Ice/async/Client.java44
-rw-r--r--java/demo/Ice/async/HelloI.java34
-rw-r--r--java/demo/Ice/async/Server.java22
-rw-r--r--java/demo/Ice/async/WorkQueue.java142
-rwxr-xr-xjava/demo/Ice/bidir/CallbackSenderI.java72
-rwxr-xr-xjava/demo/Ice/bidir/Client.java14
-rwxr-xr-xjava/demo/Ice/bidir/Server.java34
-rw-r--r--java/demo/Ice/callback/CallbackSenderI.java32
-rw-r--r--java/demo/Ice/callback/Client.java130
-rw-r--r--java/demo/Ice/hello/Client.java88
-rw-r--r--java/demo/Ice/hello/HelloI.java6
-rw-r--r--java/demo/Ice/invoke/Client.java36
-rw-r--r--java/demo/Ice/latency/Client.java30
-rwxr-xr-xjava/demo/Ice/minimal/Client.java8
-rwxr-xr-xjava/demo/Ice/minimal/Server.java6
-rw-r--r--java/demo/Ice/nested/Client.java52
-rw-r--r--java/demo/Ice/session/Client.java340
-rw-r--r--java/demo/Ice/session/HelloI.java4
-rw-r--r--java/demo/Ice/session/ReapThread.java100
-rw-r--r--java/demo/Ice/session/Server.java20
-rw-r--r--java/demo/Ice/session/SessionFactoryI.java14
-rw-r--r--java/demo/Ice/session/SessionI.java92
-rw-r--r--java/demo/Ice/throughput/Client.java680
-rw-r--r--java/demo/Ice/throughput/ThroughputI.java84
-rw-r--r--java/demo/Ice/value/Client.java52
-rw-r--r--java/demo/Ice/value/InitialI.java2
26 files changed, 1069 insertions, 1069 deletions
diff --git a/java/demo/Ice/async/Client.java b/java/demo/Ice/async/Client.java
index 3a89d037dd2..d87aee7e8a1 100644
--- a/java/demo/Ice/async/Client.java
+++ b/java/demo/Ice/async/Client.java
@@ -30,25 +30,25 @@ public class Client extends Ice.Application
public class AMI_Hello_sayHelloI extends AMI_Hello_sayHello
{
public void ice_response()
- {
- }
+ {
+ }
- public void ice_exception(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
+ public void ice_exception(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
- public void ice_exception(Ice.UserException ex)
- {
- if(ex instanceof Demo.RequestCanceledException)
- {
- System.out.println("Request canceled");
- }
- else
- {
- ex.printStackTrace();
- }
- }
+ public void ice_exception(Ice.UserException ex)
+ {
+ if(ex instanceof Demo.RequestCanceledException)
+ {
+ System.out.println("Request canceled");
+ }
+ else
+ {
+ ex.printStackTrace();
+ }
+ }
}
private static void
@@ -71,7 +71,7 @@ public class Client extends Ice.Application
// Application installed interrupt callback and install our
// own shutdown hook.
//
- setInterruptHook(new ShutdownHook());
+ setInterruptHook(new ShutdownHook());
HelloPrx hello = HelloPrxHelper.checkedCast(communicator().propertyToProxy("Hello.Proxy"));
if(hello == null)
@@ -98,16 +98,16 @@ public class Client extends Ice.Application
}
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
diff --git a/java/demo/Ice/async/HelloI.java b/java/demo/Ice/async/HelloI.java
index ce555b3e9dd..9df4d2c71cc 100644
--- a/java/demo/Ice/async/HelloI.java
+++ b/java/demo/Ice/async/HelloI.java
@@ -21,14 +21,14 @@ public class HelloI extends _HelloDisp
sayHello_async(AMD_Hello_sayHello cb, int delay, Ice.Current current)
{
if(delay == 0)
- {
- System.out.println("Hello World!");
- cb.ice_response();
- }
- else
- {
- _workQueue.add(cb, delay);
- }
+ {
+ System.out.println("Hello World!");
+ cb.ice_response();
+ }
+ else
+ {
+ _workQueue.add(cb, delay);
+ }
}
public void
@@ -36,16 +36,16 @@ public class HelloI extends _HelloDisp
{
System.out.println("Shutting down...");
- _workQueue.destroy();
- try
- {
- _workQueue.join();
- }
- catch(java.lang.InterruptedException ex)
- {
- }
+ _workQueue.destroy();
+ try
+ {
+ _workQueue.join();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
- current.adapter.getCommunicator().shutdown();
+ current.adapter.getCommunicator().shutdown();
}
private WorkQueue _workQueue;
diff --git a/java/demo/Ice/async/Server.java b/java/demo/Ice/async/Server.java
index 6077a8b9a34..25ba4e2baac 100644
--- a/java/demo/Ice/async/Server.java
+++ b/java/demo/Ice/async/Server.java
@@ -16,14 +16,14 @@ public class Server extends Ice.Application
public void
run()
{
- _workQueue.destroy();
- try
- {
- _workQueue.join();
- }
- catch(java.lang.InterruptedException ex)
- {
- }
+ _workQueue.destroy();
+ try
+ {
+ _workQueue.join();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
try
{
@@ -39,13 +39,13 @@ public class Server extends Ice.Application
public int
run(String[] args)
{
- setInterruptHook(new ShutdownHook());
+ setInterruptHook(new ShutdownHook());
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();
diff --git a/java/demo/Ice/async/WorkQueue.java b/java/demo/Ice/async/WorkQueue.java
index 036a1978b49..bc18061058a 100644
--- a/java/demo/Ice/async/WorkQueue.java
+++ b/java/demo/Ice/async/WorkQueue.java
@@ -14,100 +14,100 @@ public class WorkQueue extends Thread
class CallbackEntry
{
AMD_Hello_sayHello cb;
- int delay;
+ int delay;
}
public synchronized void
run()
{
while(!_done)
- {
- if(_callbacks.size() == 0)
- {
- try
- {
- wait();
- }
- catch(java.lang.InterruptedException ex)
- {
- }
- }
+ {
+ if(_callbacks.size() == 0)
+ {
+ try
+ {
+ wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
- if(_callbacks.size() != 0)
- {
- //
- // Get next work item.
- //
- CallbackEntry entry = (CallbackEntry)_callbacks.getFirst();
+ if(_callbacks.size() != 0)
+ {
+ //
+ // Get next work item.
+ //
+ CallbackEntry entry = (CallbackEntry)_callbacks.getFirst();
- //
- // Wait for the amount of time indicated in delay to
- // emulate a process that takes a significant period of
- // time to complete.
- //
- try
- {
- wait(entry.delay);
- }
- catch(java.lang.InterruptedException ex)
- {
- }
+ //
+ // Wait for the amount of time indicated in delay to
+ // emulate a process that takes a significant period of
+ // time to complete.
+ //
+ try
+ {
+ wait(entry.delay);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
- if(!_done)
- {
- //
- // Print greeting and send response.
- //
- _callbacks.removeFirst();
- System.err.println("Belated Hello World!");
- entry.cb.ice_response();
- }
- }
- }
+ if(!_done)
+ {
+ //
+ // Print greeting and send response.
+ //
+ _callbacks.removeFirst();
+ System.err.println("Belated Hello World!");
+ entry.cb.ice_response();
+ }
+ }
+ }
- //
- // Throw exception for any outstanding requests.
- //
- java.util.Iterator p = _callbacks.iterator();
- while(p.hasNext())
- {
- CallbackEntry entry = (CallbackEntry)p.next();
- entry.cb.ice_exception(new RequestCanceledException());
- }
+ //
+ // Throw exception for any outstanding requests.
+ //
+ java.util.Iterator p = _callbacks.iterator();
+ while(p.hasNext())
+ {
+ CallbackEntry entry = (CallbackEntry)p.next();
+ entry.cb.ice_exception(new RequestCanceledException());
+ }
}
public synchronized void
add(AMD_Hello_sayHello cb, int delay)
{
if(!_done)
- {
- //
- // Add the work item.
- //
- CallbackEntry entry = new CallbackEntry();
- entry.cb = cb;
- entry.delay = delay;
+ {
+ //
+ // Add the work item.
+ //
+ CallbackEntry entry = new CallbackEntry();
+ entry.cb = cb;
+ entry.delay = delay;
- if(_callbacks.size() == 0)
- {
- notify();
- }
- _callbacks.add(entry);
- }
- else
- {
- //
- // Destroyed, throw exception.
- //
- cb.ice_exception(new RequestCanceledException());
- }
+ if(_callbacks.size() == 0)
+ {
+ notify();
+ }
+ _callbacks.add(entry);
+ }
+ else
+ {
+ //
+ // Destroyed, throw exception.
+ //
+ cb.ice_exception(new RequestCanceledException());
+ }
}
public synchronized void
destroy()
{
_done = true;
- notify();
+ notify();
}
private java.util.LinkedList _callbacks = new java.util.LinkedList();
diff --git a/java/demo/Ice/bidir/CallbackSenderI.java b/java/demo/Ice/bidir/CallbackSenderI.java
index 71a8745f900..05805692ca7 100755
--- a/java/demo/Ice/bidir/CallbackSenderI.java
+++ b/java/demo/Ice/bidir/CallbackSenderI.java
@@ -19,56 +19,56 @@ class CallbackSenderI extends _CallbackSenderDisp implements java.lang.Runnable
synchronized public void
destroy()
{
- System.out.println("destroying callback sender");
- _destroy = true;
+ System.out.println("destroying callback sender");
+ _destroy = true;
- this.notify();
+ this.notify();
}
synchronized public void
addClient(Ice.Identity ident, Ice.Current current)
{
- System.out.println("adding client `" + _communicator.identityToString(ident) + "'");
+ System.out.println("adding client `" + _communicator.identityToString(ident) + "'");
- Ice.ObjectPrx base = current.con.createProxy(ident);
- CallbackReceiverPrx client = CallbackReceiverPrxHelper.uncheckedCast(base);
- _clients.addElement(client);
+ Ice.ObjectPrx base = current.con.createProxy(ident);
+ CallbackReceiverPrx client = CallbackReceiverPrxHelper.uncheckedCast(base);
+ _clients.addElement(client);
}
synchronized public void
run()
{
- while(!_destroy)
- {
- try
- {
- this.wait(2000);
- }
- catch(java.lang.InterruptedException ex)
- {
- }
+ while(!_destroy)
+ {
+ try
+ {
+ this.wait(2000);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
- if(!_destroy && !_clients.isEmpty())
- {
- ++_num;
+ if(!_destroy && !_clients.isEmpty())
+ {
+ ++_num;
- java.util.Iterator p = _clients.iterator();
- while(p.hasNext())
- {
- CallbackReceiverPrx r = (CallbackReceiverPrx)p.next();
- try
- {
- r.callback(_num);
- }
- catch(Exception ex)
- {
- System.out.println("removing client `" + _communicator.identityToString(r.ice_getIdentity()) + "':");
- ex.printStackTrace();
- p.remove();
- }
- }
- }
- }
+ java.util.Iterator p = _clients.iterator();
+ while(p.hasNext())
+ {
+ CallbackReceiverPrx r = (CallbackReceiverPrx)p.next();
+ try
+ {
+ r.callback(_num);
+ }
+ catch(Exception ex)
+ {
+ System.out.println("removing client `" + _communicator.identityToString(r.ice_getIdentity()) + "':");
+ ex.printStackTrace();
+ p.remove();
+ }
+ }
+ }
+ }
}
private Ice.Communicator _communicator;
diff --git a/java/demo/Ice/bidir/Client.java b/java/demo/Ice/bidir/Client.java
index b7c3136f220..84c4989a6e5 100755
--- a/java/demo/Ice/bidir/Client.java
+++ b/java/demo/Ice/bidir/Client.java
@@ -15,7 +15,7 @@ public class Client extends Ice.Application
run(String[] args)
{
CallbackSenderPrx server =
- CallbackSenderPrxHelper.checkedCast(communicator().propertyToProxy("Callback.Client.CallbackServer"));
+ CallbackSenderPrxHelper.checkedCast(communicator().propertyToProxy("Callback.Client.CallbackServer"));
if(server == null)
{
System.err.println("invalid proxy");
@@ -23,14 +23,14 @@ public class Client extends 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/java/demo/Ice/bidir/Server.java b/java/demo/Ice/bidir/Server.java
index 2a97cc22795..47106babf54 100755
--- a/java/demo/Ice/bidir/Server.java
+++ b/java/demo/Ice/bidir/Server.java
@@ -19,24 +19,24 @@ public class Server extends Ice.Application
adapter.add(sender, communicator().stringToIdentity("sender"));
adapter.activate();
- Thread t = new Thread(sender);
- t.start();
+ Thread t = new Thread(sender);
+ t.start();
- try
- {
- communicator().waitForShutdown();
- }
- finally
- {
- sender.destroy();
- try
- {
- t.join();
- }
- catch(java.lang.InterruptedException ex)
- {
- }
- }
+ try
+ {
+ communicator().waitForShutdown();
+ }
+ finally
+ {
+ sender.destroy();
+ try
+ {
+ t.join();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
return 0;
}
diff --git a/java/demo/Ice/callback/CallbackSenderI.java b/java/demo/Ice/callback/CallbackSenderI.java
index 617c7f1af42..dacda16de3f 100644
--- a/java/demo/Ice/callback/CallbackSenderI.java
+++ b/java/demo/Ice/callback/CallbackSenderI.java
@@ -15,27 +15,27 @@ public final class CallbackSenderI extends _CallbackSenderDisp
initiateCallback(CallbackReceiverPrx proxy, Ice.Current current)
{
System.out.println("initiating callback");
- try
- {
- proxy.callback(current.ctx);
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
+ try
+ {
+ proxy.callback(current.ctx);
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
}
public void
shutdown(Ice.Current current)
{
System.out.println("Shutting down...");
- try
- {
- current.adapter.getCommunicator().shutdown();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
+ try
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
}
}
diff --git a/java/demo/Ice/callback/Client.java b/java/demo/Ice/callback/Client.java
index cd8ae849b14..63495d8233c 100644
--- a/java/demo/Ice/callback/Client.java
+++ b/java/demo/Ice/callback/Client.java
@@ -13,18 +13,18 @@ public class Client extends Ice.Application
{
class ShutdownHook extends Thread
{
- public void
- run()
- {
- try
- {
- communicator().destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
+ public void
+ run()
+ {
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
}
private static void
@@ -38,7 +38,7 @@ public class Client extends Ice.Application
"d: send callback as datagram\n" +
"D: send callback as batch datagram\n" +
"f: flush all batch requests\n" +
- "S: switch secure mode on/off\n" +
+ "S: switch secure mode on/off\n" +
"s: shutdown server\n" +
"x: exit\n" +
"?: help\n");
@@ -47,16 +47,16 @@ public class Client extends Ice.Application
public int
run(String[] args)
{
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- setInterruptHook(new ShutdownHook());
+ //
+ // Since this is an interactive demo we want to clear the
+ // Application installed interrupt callback and install our
+ // own shutdown hook.
+ //
+ setInterruptHook(new ShutdownHook());
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)
{
System.err.println("invalid proxy");
@@ -72,13 +72,13 @@ public class Client extends Ice.Application
adapter.activate();
CallbackReceiverPrx twowayR =
- CallbackReceiverPrxHelper.uncheckedCast(adapter.createProxy(
+ CallbackReceiverPrxHelper.uncheckedCast(adapter.createProxy(
communicator().stringToIdentity("callbackReceiver")));
CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
CallbackReceiverPrx datagramR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_datagram());
- boolean secure = false;
- String secureStr = "";
+ boolean secure = false;
+ String secureStr = "";
menu();
@@ -110,53 +110,53 @@ public class Client extends Ice.Application
}
else if(line.equals("d"))
{
- if(secure)
- {
- System.out.println("secure datagrams are not supported");
- }
- else
- {
- datagram.initiateCallback(datagramR);
- }
+ if(secure)
+ {
+ System.out.println("secure datagrams are not supported");
+ }
+ else
+ {
+ datagram.initiateCallback(datagramR);
+ }
}
else if(line.equals("D"))
{
- if(secure)
- {
- System.out.println("secure datagrams are not supported");
- }
- else
- {
- batchDatagram.initiateCallback(datagramR);
- }
+ if(secure)
+ {
+ System.out.println("secure datagrams are not supported");
+ }
+ else
+ {
+ batchDatagram.initiateCallback(datagramR);
+ }
+ }
+ else if(line.equals("S"))
+ {
+ secure = !secure;
+ secureStr = secure ? "s" : "";
+
+ 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));
+
+ if(secure)
+ {
+ System.out.println("secure mode is now on");
+ }
+ else
+ {
+ System.out.println("secure mode is now off");
+ }
}
- else if(line.equals("S"))
- {
- secure = !secure;
- secureStr = secure ? "s" : "";
-
- 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));
-
- if(secure)
- {
- System.out.println("secure mode is now on");
- }
- else
- {
- System.out.println("secure mode is now off");
- }
- }
else if(line.equals("f"))
{
- communicator().flushBatchRequests();
+ communicator().flushBatchRequests();
}
else if(line.equals("s"))
{
diff --git a/java/demo/Ice/hello/Client.java b/java/demo/Ice/hello/Client.java
index 532da40bd98..9b05b8f22ef 100644
--- a/java/demo/Ice/hello/Client.java
+++ b/java/demo/Ice/hello/Client.java
@@ -13,18 +13,18 @@ public class Client extends Ice.Application
{
class ShutdownHook extends Thread
{
- public void
- run()
- {
- try
- {
- communicator().destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
+ public void
+ run()
+ {
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
}
private static void
@@ -49,15 +49,15 @@ public class Client extends Ice.Application
public int
run(String[] args)
{
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- setInterruptHook(new ShutdownHook());
+ //
+ // Since this is an interactive demo we want to clear the
+ // Application installed interrupt callback and install our
+ // own shutdown hook.
+ //
+ setInterruptHook(new ShutdownHook());
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)
{
System.err.println("invalid proxy");
@@ -68,9 +68,9 @@ public class Client extends Ice.Application
HelloPrx datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram());
HelloPrx batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram());
- boolean secure = false;
+ boolean secure = false;
int timeout = -1;
- int delay = 0;
+ int delay = 0;
menu();
@@ -102,29 +102,29 @@ public class Client extends Ice.Application
}
else if(line.equals("d"))
{
- if(secure)
- {
- System.out.println("secure datagrams are not supported");
- }
- else
- {
- datagram.sayHello(delay);
- }
+ if(secure)
+ {
+ System.out.println("secure datagrams are not supported");
+ }
+ else
+ {
+ datagram.sayHello(delay);
+ }
}
else if(line.equals("D"))
{
- if(secure)
- {
- System.out.println("secure datagrams are not supported");
- }
- else
- {
- batchDatagram.sayHello(delay);
- }
+ if(secure)
+ {
+ System.out.println("secure datagrams are not supported");
+ }
+ else
+ {
+ batchDatagram.sayHello(delay);
+ }
}
else if(line.equals("f"))
{
- communicator().flushBatchRequests();
+ communicator().flushBatchRequests();
}
else if(line.equals("T"))
{
@@ -172,13 +172,13 @@ public class Client extends Ice.Application
}
else if(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));
+ 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)
{
diff --git a/java/demo/Ice/hello/HelloI.java b/java/demo/Ice/hello/HelloI.java
index 9c9dfffdf8f..1514caf31ae 100644
--- a/java/demo/Ice/hello/HelloI.java
+++ b/java/demo/Ice/hello/HelloI.java
@@ -15,7 +15,7 @@ public class HelloI extends _HelloDisp
sayHello(int delay, Ice.Current current)
{
if(delay > 0)
- {
+ {
try
{
Thread.currentThread().sleep(delay);
@@ -23,7 +23,7 @@ public class HelloI extends _HelloDisp
catch(InterruptedException ex1)
{
}
- }
+ }
System.out.println("Hello World!");
}
@@ -31,6 +31,6 @@ public class HelloI extends _HelloDisp
shutdown(Ice.Current current)
{
System.out.println("Shutting down...");
- current.adapter.getCommunicator().shutdown();
+ current.adapter.getCommunicator().shutdown();
}
}
diff --git a/java/demo/Ice/invoke/Client.java b/java/demo/Ice/invoke/Client.java
index 362c1401f28..1d6cb450fab 100644
--- a/java/demo/Ice/invoke/Client.java
+++ b/java/demo/Ice/invoke/Client.java
@@ -32,29 +32,29 @@ public class Client extends Ice.Application
class ShutdownHook extends Thread
{
- public void
- run()
- {
- try
- {
- communicator().destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
+ public void
+ run()
+ {
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
}
public int
run(String[] args)
{
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- setInterruptHook(new ShutdownHook());
+ //
+ // Since this is an interactive demo we want to clear the
+ // Application installed interrupt callback and install our
+ // own shutdown hook.
+ //
+ setInterruptHook(new ShutdownHook());
Ice.ObjectPrx obj = communicator().propertyToProxy("Printer.Proxy");
diff --git a/java/demo/Ice/latency/Client.java b/java/demo/Ice/latency/Client.java
index dba60c230b2..f82adedd9df 100644
--- a/java/demo/Ice/latency/Client.java
+++ b/java/demo/Ice/latency/Client.java
@@ -21,21 +21,21 @@ class Client extends 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.
- //
- {
- final int repetitions = 20000;
- System.out.print("warming up the JIT compiler...");
- System.out.flush();
- for(int i = 0; i < repetitions; i++)
- {
- ping.ice_ping();
- }
- System.out.println(" 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.
+ //
+ {
+ final int repetitions = 20000;
+ System.out.print("warming up the JIT compiler...");
+ System.out.flush();
+ for(int i = 0; i < repetitions; i++)
+ {
+ ping.ice_ping();
+ }
+ System.out.println(" ok");
+ }
long tv1 = System.currentTimeMillis();
final int repetitions = 100000;
diff --git a/java/demo/Ice/minimal/Client.java b/java/demo/Ice/minimal/Client.java
index 6d215ce60fa..6ed109b7254 100755
--- a/java/demo/Ice/minimal/Client.java
+++ b/java/demo/Ice/minimal/Client.java
@@ -21,7 +21,7 @@ public class Client
return 1;
}
- hello.sayHello();
+ hello.sayHello();
return 0;
}
@@ -54,8 +54,8 @@ public class Client
ex.printStackTrace();
status = 1;
}
- }
-
- System.exit(status);
+ }
+
+ System.exit(status);
}
}
diff --git a/java/demo/Ice/minimal/Server.java b/java/demo/Ice/minimal/Server.java
index 9667d1786d8..78fd87663c6 100755
--- a/java/demo/Ice/minimal/Server.java
+++ b/java/demo/Ice/minimal/Server.java
@@ -49,8 +49,8 @@ public class Server
ex.printStackTrace();
status = 1;
}
- }
-
- System.exit(status);
+ }
+
+ System.exit(status);
}
}
diff --git a/java/demo/Ice/nested/Client.java b/java/demo/Ice/nested/Client.java
index c5f4cf25d8a..aec6d8d2baf 100644
--- a/java/demo/Ice/nested/Client.java
+++ b/java/demo/Ice/nested/Client.java
@@ -13,38 +13,38 @@ public class Client extends Ice.Application
{
class ShutdownHook extends Thread
{
- public void
- run()
- {
- /*
- * For this demo we won't destroy the communicator since it has to
- * wait for any outstanding invocations to complete which may take
- * some time if the nesting level is exceeded.
- *
- try
- {
- communicator().destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- */
- }
+ public void
+ run()
+ {
+ /*
+ * For this demo we won't destroy the communicator since it has to
+ * wait for any outstanding invocations to complete which may take
+ * some time if the nesting level is exceeded.
+ *
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ */
+ }
}
public int
run(String[] args)
{
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- setInterruptHook(new ShutdownHook());
+ //
+ // Since this is an interactive demo we want to clear the
+ // Application installed interrupt callback and install our
+ // own shutdown hook.
+ //
+ setInterruptHook(new ShutdownHook());
NestedPrx nested = NestedPrxHelper.checkedCast(
- communicator().propertyToProxy("Nested.Client.NestedServer"));
+ communicator().propertyToProxy("Nested.Client.NestedServer"));
if(nested == null)
{
System.err.println("invalid proxy");
@@ -53,7 +53,7 @@ public class Client extends 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/java/demo/Ice/session/Client.java b/java/demo/Ice/session/Client.java
index 43ff57b1783..9ef0679bada 100644
--- a/java/demo/Ice/session/Client.java
+++ b/java/demo/Ice/session/Client.java
@@ -13,111 +13,111 @@ public class Client extends Ice.Application
{
class ShutdownHook extends Thread
{
- public void
- run()
- {
- System.out.println("Hi");
- cleanup(true);
- try
- {
- communicator().destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
+ public void
+ run()
+ {
+ System.out.println("Hi");
+ cleanup(true);
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
}
static private class SessionRefreshThread extends Thread
{
- SessionRefreshThread(Ice.Logger logger, long timeout, SessionPrx session)
- {
- _logger = logger;
- _session = session;
- _timeout = timeout;
- }
+ SessionRefreshThread(Ice.Logger logger, long timeout, SessionPrx session)
+ {
+ _logger = logger;
+ _session = session;
+ _timeout = timeout;
+ }
- synchronized public void
- run()
- {
- while(!_terminated)
- {
- try
- {
- wait(_timeout);
- }
- catch(InterruptedException e)
- {
- }
- if(!_terminated)
- {
- try
- {
- _session.refresh();
- }
- catch(Ice.LocalException ex)
- {
- _logger.warning("SessionRefreshThread: " + ex);
- _terminated = true;
- }
- }
- }
- }
+ synchronized public void
+ run()
+ {
+ while(!_terminated)
+ {
+ try
+ {
+ wait(_timeout);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ if(!_terminated)
+ {
+ try
+ {
+ _session.refresh();
+ }
+ catch(Ice.LocalException ex)
+ {
+ _logger.warning("SessionRefreshThread: " + ex);
+ _terminated = true;
+ }
+ }
+ }
+ }
- synchronized private void
- terminate()
- {
- _terminated = true;
- notify();
- }
+ synchronized private void
+ terminate()
+ {
+ _terminated = true;
+ notify();
+ }
- final private Ice.Logger _logger;
- final private SessionPrx _session;
- final private long _timeout;
- private boolean _terminated = false;
+ final private Ice.Logger _logger;
+ final private SessionPrx _session;
+ final private long _timeout;
+ private boolean _terminated = false;
}
private static void
menu()
{
System.out.println(
- "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");
+ "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 int
run(String[] args)
{
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- setInterruptHook(new ShutdownHook());
+ //
+ // Since this is an interactive demo we want to clear the
+ // Application installed interrupt callback and install our
+ // own shutdown hook.
+ //
+ setInterruptHook(new ShutdownHook());
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
- String name;
- try
- {
- do
- {
- System.out.print("Please enter your name ==> ");
- System.out.flush();
- name = in.readLine().trim();
- }
- while(name.length() == 0);
- }
- catch(java.io.IOException ex)
- {
- ex.printStackTrace();
- return 0;
- }
+ String name;
+ try
+ {
+ do
+ {
+ System.out.print("Please enter your name ==> ");
+ System.out.flush();
+ name = in.readLine().trim();
+ }
+ while(name.length() == 0);
+ }
+ catch(java.io.IOException ex)
+ {
+ ex.printStackTrace();
+ return 0;
+ }
Ice.ObjectPrx base = communicator().propertyToProxy("SessionFactory.Proxy");
SessionFactoryPrx factory = SessionFactoryPrxHelper.checkedCast(base);
@@ -127,72 +127,72 @@ public class Client extends Ice.Application
return 1;
}
- synchronized(this)
- {
- _session = factory.create(name);
- _refresh = new SessionRefreshThread(communicator().getLogger(), 5000, _session);
- _refresh.start();
- }
-
- java.util.ArrayList hellos = new java.util.ArrayList();
+ synchronized(this)
+ {
+ _session = factory.create(name);
+ _refresh = new SessionRefreshThread(communicator().getLogger(), 5000, _session);
+ _refresh.start();
+ }
+
+ java.util.ArrayList hellos = new java.util.ArrayList();
menu();
- try
- {
- boolean destroy = true;
- boolean shutdown = false;
- while(true)
- {
+ try
+ {
+ boolean destroy = true;
+ boolean shutdown = false;
+ while(true)
+ {
System.out.print("==> ");
System.out.flush();
- String line = in.readLine();
+ String line = in.readLine();
if(line == null)
{
break;
}
- if(line.length() > 0 && Character.isDigit(line.charAt(0)))
- {
- int index;
- try
- {
- index = Integer.parseInt(line);
- }
- catch(NumberFormatException e)
- {
- menu();
- continue;
- }
- if(index < hellos.size())
- {
- HelloPrx hello = (HelloPrx)hellos.get(index);
- hello.sayHello();
- }
- else
- {
- System.out.println("index is too high. " + hellos.size() + " exist so far. " +
- "Use 'c' to create a new hello object.");
- }
- }
+ if(line.length() > 0 && Character.isDigit(line.charAt(0)))
+ {
+ int index;
+ try
+ {
+ index = Integer.parseInt(line);
+ }
+ catch(NumberFormatException e)
+ {
+ menu();
+ continue;
+ }
+ if(index < hellos.size())
+ {
+ HelloPrx hello = (HelloPrx)hellos.get(index);
+ hello.sayHello();
+ }
+ else
+ {
+ System.out.println("index is too high. " + hellos.size() + " exist so far. " +
+ "Use 'c' to create a new hello object.");
+ }
+ }
else if(line.equals("c"))
{
hellos.add(_session.createHello());
- System.out.println("created hello object " + (hellos.size()-1));
+ System.out.println("created hello object " + (hellos.size()-1));
}
else if(line.equals("s"))
{
- destroy = false;
- shutdown = true;
- break;
+ destroy = false;
+ shutdown = true;
+ break;
}
else if(line.equals("x"))
{
- break;
+ break;
}
else if(line.equals("t"))
{
- destroy = false;
- break;
+ destroy = false;
+ break;
}
else if(line.equals("?"))
{
@@ -205,24 +205,24 @@ public class Client extends Ice.Application
}
}
- cleanup(destroy);
- if(shutdown)
- {
- factory.shutdown();
- }
- }
- catch(java.io.IOException ex)
- {
- ex.printStackTrace();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- finally
- {
- cleanup(true);
- }
+ cleanup(destroy);
+ if(shutdown)
+ {
+ factory.shutdown();
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ ex.printStackTrace();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ cleanup(true);
+ }
return 0;
}
@@ -230,28 +230,28 @@ public class Client extends Ice.Application
synchronized private void
cleanup(boolean destroy)
{
- //
- // The refresher thread must be terminated before destroy is
- // called, otherwise it might get ObjectNotExistException.
- //
- if(_refresh != null)
- {
- _refresh.terminate();
- try
- {
- _refresh.join();
- }
- catch(InterruptedException e)
- {
- }
- _refresh = null;
- }
-
- if(destroy && _session != null)
- {
- _session.destroy();
- _session = null;
- }
+ //
+ // The refresher thread must be terminated before destroy is
+ // called, otherwise it might get ObjectNotExistException.
+ //
+ if(_refresh != null)
+ {
+ _refresh.terminate();
+ try
+ {
+ _refresh.join();
+ }
+ catch(InterruptedException e)
+ {
+ }
+ _refresh = null;
+ }
+
+ if(destroy && _session != null)
+ {
+ _session.destroy();
+ _session = null;
+ }
}
public static void
diff --git a/java/demo/Ice/session/HelloI.java b/java/demo/Ice/session/HelloI.java
index e8002b61947..a5c9eca446c 100644
--- a/java/demo/Ice/session/HelloI.java
+++ b/java/demo/Ice/session/HelloI.java
@@ -14,8 +14,8 @@ public class HelloI extends _HelloDisp
public
HelloI(String name, int id)
{
- _name = name;
- _id = id;
+ _name = name;
+ _id = id;
}
public void
diff --git a/java/demo/Ice/session/ReapThread.java b/java/demo/Ice/session/ReapThread.java
index 73af959b456..a0ebc1fdebf 100644
--- a/java/demo/Ice/session/ReapThread.java
+++ b/java/demo/Ice/session/ReapThread.java
@@ -13,72 +13,72 @@ class ReapThread extends Thread
{
static class SessionProxyPair
{
- SessionProxyPair(Demo.SessionPrx p, SessionI s)
- {
- proxy = p;
- session = s;
- }
+ SessionProxyPair(Demo.SessionPrx p, SessionI s)
+ {
+ proxy = p;
+ session = s;
+ }
- Demo.SessionPrx proxy;
- SessionI session;
+ Demo.SessionPrx proxy;
+ SessionI session;
};
synchronized public void
run()
{
- while(!_terminated)
- {
- try
- {
- wait(_timeout);
- }
- catch(InterruptedException e)
- {
- }
-
- if(!_terminated)
- {
- java.util.Iterator p = _sessions.iterator();
- while(p.hasNext())
- {
- SessionProxyPair s = (SessionProxyPair)p.next();
- try
- {
- //
- // Session destruction may take time in a
- // real-world example. Therefore the current time
- // is computed for each iteration.
- //
- if((System.currentTimeMillis() - s.session.timestamp()) > _timeout)
- {
- String name = s.proxy.getName();
- s.proxy.destroy();
- System.out.println("The session " + name + " has timed out.");
- p.remove();
- }
- }
- catch(Ice.ObjectNotExistException e)
- {
- p.remove();
- }
- }
- }
- }
+ while(!_terminated)
+ {
+ try
+ {
+ wait(_timeout);
+ }
+ catch(InterruptedException e)
+ {
+ }
+
+ if(!_terminated)
+ {
+ java.util.Iterator p = _sessions.iterator();
+ while(p.hasNext())
+ {
+ SessionProxyPair s = (SessionProxyPair)p.next();
+ try
+ {
+ //
+ // Session destruction may take time in a
+ // real-world example. Therefore the current time
+ // is computed for each iteration.
+ //
+ if((System.currentTimeMillis() - s.session.timestamp()) > _timeout)
+ {
+ String name = s.proxy.getName();
+ s.proxy.destroy();
+ System.out.println("The session " + name + " has timed out.");
+ p.remove();
+ }
+ }
+ catch(Ice.ObjectNotExistException e)
+ {
+ p.remove();
+ }
+ }
+ }
+ }
}
synchronized public void
terminate()
{
- _terminated = true;
- notify();
-
- _sessions.clear();
+ _terminated = true;
+ notify();
+
+ _sessions.clear();
}
synchronized public void
add(SessionPrx proxy, SessionI session)
{
- _sessions.add(new SessionProxyPair(proxy, session));
+ _sessions.add(new SessionProxyPair(proxy, session));
}
private final long _timeout = 10 * 1000; // 10 seconds.
diff --git a/java/demo/Ice/session/Server.java b/java/demo/Ice/session/Server.java
index 8ac9b9eeeab..59bd60dc08f 100644
--- a/java/demo/Ice/session/Server.java
+++ b/java/demo/Ice/session/Server.java
@@ -15,21 +15,21 @@ public class Server extends Ice.Application
run(String[] args)
{
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SessionFactory");
- ReapThread reaper = new ReapThread();
- reaper.start();
+ ReapThread reaper = new ReapThread();
+ reaper.start();
adapter.add(new SessionFactoryI(reaper), communicator().stringToIdentity("SessionFactory"));
adapter.activate();
communicator().waitForShutdown();
- reaper.terminate();
- try
- {
- reaper.join();
- }
- catch(InterruptedException e)
- {
- }
+ reaper.terminate();
+ try
+ {
+ reaper.join();
+ }
+ catch(InterruptedException e)
+ {
+ }
return 0;
}
diff --git a/java/demo/Ice/session/SessionFactoryI.java b/java/demo/Ice/session/SessionFactoryI.java
index b1a7a70d9f2..cd7cdfd3dd0 100644
--- a/java/demo/Ice/session/SessionFactoryI.java
+++ b/java/demo/Ice/session/SessionFactoryI.java
@@ -13,23 +13,23 @@ class SessionFactoryI extends _SessionFactoryDisp
{
SessionFactoryI(ReapThread reaper)
{
- _reaper = reaper;
+ _reaper = reaper;
}
public synchronized 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 void
shutdown(Ice.Current c)
{
- System.out.println("Shutting down...");
- c.adapter.getCommunicator().shutdown();
+ System.out.println("Shutting down...");
+ c.adapter.getCommunicator().shutdown();
}
private ReapThread _reaper;
diff --git a/java/demo/Ice/session/SessionI.java b/java/demo/Ice/session/SessionI.java
index bca977d64ee..8ef6ed3534a 100644
--- a/java/demo/Ice/session/SessionI.java
+++ b/java/demo/Ice/session/SessionI.java
@@ -14,78 +14,78 @@ class SessionI extends _SessionDisp
public
SessionI(String name)
{
- _name = name;
- _timestamp = System.currentTimeMillis();
- System.out.println("The session " + _name + " is now created.");
+ _name = name;
+ _timestamp = System.currentTimeMillis();
+ System.out.println("The session " + _name + " is now created.");
}
synchronized public HelloPrx
createHello(Ice.Current c)
{
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
- HelloPrx hello = HelloPrxHelper.uncheckedCast(c.adapter.addWithUUID(new HelloI(_name, _nextId++)));
- _objs.add(hello);
- return hello;
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+ HelloPrx hello = HelloPrxHelper.uncheckedCast(c.adapter.addWithUUID(new HelloI(_name, _nextId++)));
+ _objs.add(hello);
+ return hello;
}
synchronized public void
refresh(Ice.Current c)
{
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
- _timestamp = System.currentTimeMillis();
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+ _timestamp = System.currentTimeMillis();
}
synchronized public String
getName(Ice.Current c)
{
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
- return _name;
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+ return _name;
}
synchronized public void
destroy(Ice.Current c)
{
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
- _destroy = true;
- System.out.println("The session " + _name + " is now destroyed.");
- try
- {
- c.adapter.remove(c.id);
- java.util.Iterator p = _objs.iterator();
- while(p.hasNext())
- {
- c.adapter.remove(((HelloPrx)p.next()).ice_getIdentity());
- }
- }
- catch(Ice.ObjectAdapterDeactivatedException e)
- {
- // This method is called on shutdown of the server, in
- // which case this exception is expected.
- }
- _objs.clear();
+ _destroy = true;
+ System.out.println("The session " + _name + " is now destroyed.");
+ try
+ {
+ c.adapter.remove(c.id);
+ java.util.Iterator p = _objs.iterator();
+ while(p.hasNext())
+ {
+ c.adapter.remove(((HelloPrx)p.next()).ice_getIdentity());
+ }
+ }
+ catch(Ice.ObjectAdapterDeactivatedException e)
+ {
+ // This method is called on shutdown of the server, in
+ // which case this exception is expected.
+ }
+ _objs.clear();
}
synchronized public long
timestamp()
{
- if(_destroy)
- {
- throw new Ice.ObjectNotExistException();
- }
- return _timestamp;
+ if(_destroy)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+ return _timestamp;
}
private String _name;
diff --git a/java/demo/Ice/throughput/Client.java b/java/demo/Ice/throughput/Client.java
index 95139d85bb3..f413bc855b7 100644
--- a/java/demo/Ice/throughput/Client.java
+++ b/java/demo/Ice/throughput/Client.java
@@ -13,18 +13,18 @@ public class Client extends Ice.Application
{
class ShutdownHook extends Thread
{
- public void
- run()
- {
- try
- {
- communicator().destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
+ public void
+ run()
+ {
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
}
private static void
@@ -54,12 +54,12 @@ public class Client extends Ice.Application
public int
run(String[] args)
{
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- setInterruptHook(new ShutdownHook());
+ //
+ // Since this is an interactive demo we want to clear the
+ // Application installed interrupt callback and install our
+ // own shutdown hook.
+ //
+ setInterruptHook(new ShutdownHook());
Ice.ObjectPrx base = communicator().propertyToProxy("Throughput.Throughput");
ThroughputPrx throughput = ThroughputPrxHelper.checkedCast(base);
@@ -68,32 +68,32 @@ public class Client extends Ice.Application
System.err.println("invalid proxy");
return 1;
}
- ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway());
+ ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway());
byte[] byteSeq = new byte[ByteSeqSize.value];
- String[] stringSeq = new String[StringSeqSize.value];
- 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].s = "hello";
- structSeq[i].d = 3.14;
- }
-
- Fixed[] fixedSeq = new Fixed[FixedSeqSize.value];
- for(int i = 0; i < FixedSeqSize.value; ++i)
- {
- fixedSeq[i] = new Fixed();
- fixedSeq[i].i = 0;
- fixedSeq[i].j = 0;
- fixedSeq[i].d = 0;
- }
+ String[] stringSeq = new String[StringSeqSize.value];
+ 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].s = "hello";
+ structSeq[i].d = 3.14;
+ }
+
+ Fixed[] fixedSeq = new Fixed[FixedSeqSize.value];
+ for(int i = 0; i < FixedSeqSize.value; ++i)
+ {
+ fixedSeq[i] = new Fixed();
+ 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
@@ -102,49 +102,49 @@ public class Client extends Ice.Application
//
{
byte[] emptyBytes= new byte[1];
- String[] emptyStrings = new String[1];
- StringDouble[] emptyStructs = new StringDouble[1];
- emptyStructs[0] = new StringDouble();
- Fixed[] emptyFixed = new Fixed[1];
- emptyFixed[0] = new Fixed();
+ String[] emptyStrings = new String[1];
+ StringDouble[] emptyStructs = new StringDouble[1];
+ emptyStructs[0] = new StringDouble();
+ Fixed[] emptyFixed = new Fixed[1];
+ emptyFixed[0] = new Fixed();
final int repetitions = 10000;
System.out.print("warming up the JIT compiler...");
System.out.flush();
for(int i = 0; i < repetitions; i++)
{
- throughput.sendByteSeq(emptyBytes);
- throughput.sendStringSeq(emptyStrings);
- throughput.sendStructSeq(emptyStructs);
- throughput.sendFixedSeq(emptyFixed);
-
- throughput.recvByteSeq();
- throughput.recvStringSeq();
- throughput.recvStructSeq();
- throughput.recvFixedSeq();
-
- throughput.echoByteSeq(emptyBytes);
- throughput.echoStringSeq(emptyStrings);
- throughput.echoStructSeq(emptyStructs);
- throughput.echoFixedSeq(emptyFixed);
+ throughput.sendByteSeq(emptyBytes);
+ throughput.sendStringSeq(emptyStrings);
+ throughput.sendStructSeq(emptyStructs);
+ throughput.sendFixedSeq(emptyFixed);
+
+ throughput.recvByteSeq();
+ throughput.recvStringSeq();
+ throughput.recvStructSeq();
+ throughput.recvFixedSeq();
+
+ throughput.echoByteSeq(emptyBytes);
+ throughput.echoStringSeq(emptyStrings);
+ throughput.echoStructSeq(emptyStructs);
+ throughput.echoFixedSeq(emptyFixed);
}
- throughput.endWarmup();
-
+ throughput.endWarmup();
+
System.out.println(" ok");
}
- menu();
+ menu();
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
- char currentType = '1';
- int seqSize = ByteSeqSize.value;
+ char currentType = '1';
+ int seqSize = ByteSeqSize.value;
- // Initial ping to setup the connection.
- throughput.ice_ping();
-
+ // Initial ping to setup the connection.
+ throughput.ice_ping();
+
String line = null;
do
{
@@ -158,280 +158,280 @@ public class Client extends Ice.Application
break;
}
- long tmsec = System.currentTimeMillis();
- final int repetitions = 100;
-
- if(line.equals("1") || line.equals("2") || line.equals("3") || line.equals("4"))
- {
- currentType = line.charAt(0);
-
- switch(currentType)
- {
- case '1':
- {
- System.out.println("using byte sequences");
- seqSize = ByteSeqSize.value;
- break;
- }
-
- case '2':
- {
- System.out.println("using string sequences");
- seqSize = StringSeqSize.value;
- break;
- }
-
- case '3':
- {
- System.out.println("using variable-length struct sequences");
- seqSize = StringDoubleSeqSize.value;
- break;
- }
-
- case '4':
- {
- System.out.println("using fixed-length struct sequences");
- seqSize = FixedSeqSize.value;
- break;
- }
- }
- }
+ long tmsec = System.currentTimeMillis();
+ final int repetitions = 100;
+
+ if(line.equals("1") || line.equals("2") || line.equals("3") || line.equals("4"))
+ {
+ currentType = line.charAt(0);
+
+ switch(currentType)
+ {
+ case '1':
+ {
+ System.out.println("using byte sequences");
+ seqSize = ByteSeqSize.value;
+ break;
+ }
+
+ case '2':
+ {
+ System.out.println("using string sequences");
+ seqSize = StringSeqSize.value;
+ break;
+ }
+
+ case '3':
+ {
+ System.out.println("using variable-length struct sequences");
+ seqSize = StringDoubleSeqSize.value;
+ break;
+ }
+
+ case '4':
+ {
+ System.out.println("using fixed-length struct sequences");
+ seqSize = FixedSeqSize.value;
+ break;
+ }
+ }
+ }
else if(line.equals("t") || line.equals("o") || line.equals("r") || line.equals("e"))
{
- char c = line.charAt(0);
-
- switch(c)
- {
- case 't':
- case 'o':
- {
- System.out.print("sending");
- break;
- }
-
- case 'r':
- {
- System.out.print("receiving");
- break;
- }
-
- case 'e':
- {
- System.out.print("sending and receiving");
- break;
- }
- }
-
- System.out.print(" " + repetitions);
- switch(currentType)
- {
- case '1':
- {
- System.out.print(" byte");
- break;
- }
-
- case '2':
- {
- System.out.print(" string");
- break;
- }
-
- case '3':
- {
- System.out.print(" variable-length struct");
- break;
- }
-
- case '4':
- {
- System.out.print(" fixed-length struct");
- break;
- }
- }
-
- System.out.print(" sequences of size " + seqSize);
-
- if(c == 'o')
- {
- System.out.print(" as oneway");
- }
-
- System.out.println("...");
-
- for(int i = 0; i < repetitions; ++i)
- {
- switch(currentType)
- {
- case '1':
- {
- switch(c)
- {
- case 't':
- {
- throughput.sendByteSeq(byteSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway.sendByteSeq(byteSeq);
- break;
- }
-
- case 'r':
- {
- throughput.recvByteSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoByteSeq(byteSeq);
- break;
- }
- }
- break;
- }
-
- case '2':
- {
- switch(c)
- {
- case 't':
- {
- throughput.sendStringSeq(stringSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway.sendStringSeq(stringSeq);
- break;
- }
-
- case 'r':
- {
- throughput.recvStringSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoStringSeq(stringSeq);
- break;
- }
- }
- break;
- }
-
- case '3':
- {
- switch(c)
- {
- case 't':
- {
- throughput.sendStructSeq(structSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway.sendStructSeq(structSeq);
- break;
- }
-
- case 'r':
- {
- throughput.recvStructSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoStructSeq(structSeq);
- break;
- }
- }
- break;
- }
-
- case '4':
- {
- switch(c)
- {
- case 't':
- {
- throughput.sendFixedSeq(fixedSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway.sendFixedSeq(fixedSeq);
- break;
- }
-
- case 'r':
- {
- throughput.recvFixedSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoFixedSeq(fixedSeq);
- break;
- }
- }
- break;
- }
- }
- }
-
- double dmsec = System.currentTimeMillis() - tmsec;
- System.out.println("time for " + repetitions + " sequences: " + dmsec + "ms");
- System.out.println("time per sequence: " + dmsec / repetitions + "ms");
- int wireSize = 0;
- switch(currentType)
- {
- case '1':
- {
- wireSize = 1;
- break;
- }
-
- case '2':
- {
- wireSize = stringSeq[0].length();
- break;
- }
-
- case '3':
- {
- wireSize = structSeq[0].s.length();
- wireSize += 8; // Size of double on the wire.
- break;
- }
-
- case '4':
- {
- wireSize = 16; // Size of two ints and a double on the wire.
- break;
- }
- }
- double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0;
- if(c == 'e')
- {
- mbit *= 2;
- }
- System.out.println("throughput: " + new java.text.DecimalFormat("#.##").format(mbit) + "Mbps");
- }
- else if(line.equals("s"))
- {
- throughput.shutdown();
- }
- else if(line.equals("x"))
+ char c = line.charAt(0);
+
+ switch(c)
+ {
+ case 't':
+ case 'o':
+ {
+ System.out.print("sending");
+ break;
+ }
+
+ case 'r':
+ {
+ System.out.print("receiving");
+ break;
+ }
+
+ case 'e':
+ {
+ System.out.print("sending and receiving");
+ break;
+ }
+ }
+
+ System.out.print(" " + repetitions);
+ switch(currentType)
+ {
+ case '1':
+ {
+ System.out.print(" byte");
+ break;
+ }
+
+ case '2':
+ {
+ System.out.print(" string");
+ break;
+ }
+
+ case '3':
+ {
+ System.out.print(" variable-length struct");
+ break;
+ }
+
+ case '4':
+ {
+ System.out.print(" fixed-length struct");
+ break;
+ }
+ }
+
+ System.out.print(" sequences of size " + seqSize);
+
+ if(c == 'o')
+ {
+ System.out.print(" as oneway");
+ }
+
+ System.out.println("...");
+
+ for(int i = 0; i < repetitions; ++i)
+ {
+ switch(currentType)
+ {
+ case '1':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendByteSeq(byteSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendByteSeq(byteSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvByteSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoByteSeq(byteSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '2':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvStringSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoStringSeq(stringSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '3':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvStructSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoStructSeq(structSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '4':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvFixedSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoFixedSeq(fixedSeq);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ double dmsec = System.currentTimeMillis() - tmsec;
+ System.out.println("time for " + repetitions + " sequences: " + dmsec + "ms");
+ System.out.println("time per sequence: " + dmsec / repetitions + "ms");
+ int wireSize = 0;
+ switch(currentType)
+ {
+ case '1':
+ {
+ wireSize = 1;
+ break;
+ }
+
+ case '2':
+ {
+ wireSize = stringSeq[0].length();
+ break;
+ }
+
+ case '3':
+ {
+ wireSize = structSeq[0].s.length();
+ wireSize += 8; // Size of double on the wire.
+ break;
+ }
+
+ case '4':
+ {
+ wireSize = 16; // Size of two ints and a double on the wire.
+ break;
+ }
+ }
+ double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0;
+ if(c == 'e')
+ {
+ mbit *= 2;
+ }
+ System.out.println("throughput: " + new java.text.DecimalFormat("#.##").format(mbit) + "Mbps");
+ }
+ else if(line.equals("s"))
+ {
+ throughput.shutdown();
+ }
+ else if(line.equals("x"))
{
// Nothing to do
}
diff --git a/java/demo/Ice/throughput/ThroughputI.java b/java/demo/Ice/throughput/ThroughputI.java
index fca0554d5e2..5508620ee41 100644
--- a/java/demo/Ice/throughput/ThroughputI.java
+++ b/java/demo/Ice/throughput/ThroughputI.java
@@ -18,28 +18,28 @@ public final class ThroughputI extends _ThroughputDisp
_byteSeq = new byte[ByteSeqSize.value];
- _stringSeq = new String[StringSeqSize.value];
- for(int i = 0; i < StringSeqSize.value; ++i)
- {
- _stringSeq[i] = "hello";
- }
-
- _structSeq = new StringDouble[StringDoubleSeqSize.value];
- for(int i = 0; i < StringDoubleSeqSize.value; ++i)
- {
- _structSeq[i] = new StringDouble();
- _structSeq[i].s = "hello";
- _structSeq[i].d = 3.14;
- }
-
- _fixedSeq = new Fixed[FixedSeqSize.value];
- for(int i = 0; i < FixedSeqSize.value; ++i)
- {
- _fixedSeq[i] = new Fixed();
- _fixedSeq[i].i = 0;
- _fixedSeq[i].j = 0;
- _fixedSeq[i].d = 0;
- }
+ _stringSeq = new String[StringSeqSize.value];
+ for(int i = 0; i < StringSeqSize.value; ++i)
+ {
+ _stringSeq[i] = "hello";
+ }
+
+ _structSeq = new StringDouble[StringDoubleSeqSize.value];
+ for(int i = 0; i < StringDoubleSeqSize.value; ++i)
+ {
+ _structSeq[i] = new StringDouble();
+ _structSeq[i].s = "hello";
+ _structSeq[i].d = 3.14;
+ }
+
+ _fixedSeq = new Fixed[FixedSeqSize.value];
+ for(int i = 0; i < FixedSeqSize.value; ++i)
+ {
+ _fixedSeq[i] = new Fixed();
+ _fixedSeq[i].i = 0;
+ _fixedSeq[i].j = 0;
+ _fixedSeq[i].d = 0;
+ }
}
public void
@@ -57,13 +57,13 @@ public final class ThroughputI extends _ThroughputDisp
recvByteSeq(Ice.Current current)
{
if(_warmup)
- {
+ {
return _emptyByteSeq;
- }
- else
- {
+ }
+ else
+ {
return _byteSeq;
- }
+ }
}
public byte[]
@@ -81,13 +81,13 @@ public final class ThroughputI extends _ThroughputDisp
recvStringSeq(Ice.Current current)
{
if(_warmup)
- {
+ {
return _emptyStringSeq;
- }
- else
- {
+ }
+ else
+ {
return _stringSeq;
- }
+ }
}
public String[]
@@ -105,13 +105,13 @@ public final class ThroughputI extends _ThroughputDisp
recvStructSeq(Ice.Current current)
{
if(_warmup)
- {
+ {
return _emptyStructSeq;
- }
- else
- {
+ }
+ else
+ {
return _structSeq;
- }
+ }
}
public StringDouble[]
@@ -129,13 +129,13 @@ public final class ThroughputI extends _ThroughputDisp
recvFixedSeq(Ice.Current current)
{
if(_warmup)
- {
+ {
return _emptyFixedSeq;
- }
- else
- {
+ }
+ else
+ {
return _fixedSeq;
- }
+ }
}
public Fixed[]
diff --git a/java/demo/Ice/value/Client.java b/java/demo/Ice/value/Client.java
index 9f32eefa169..831e424ebfa 100644
--- a/java/demo/Ice/value/Client.java
+++ b/java/demo/Ice/value/Client.java
@@ -13,18 +13,18 @@ public class Client extends Ice.Application
{
class ShutdownHook extends Thread
{
- public void
- run()
- {
- try
- {
- communicator().destroy();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
- }
+ public void
+ run()
+ {
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
}
private static void
@@ -43,12 +43,12 @@ public class Client extends Ice.Application
public int
run(String[] args)
{
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- setInterruptHook(new ShutdownHook());
+ //
+ // Since this is an interactive demo we want to clear the
+ // Application installed interrupt callback and install our
+ // own shutdown hook.
+ //
+ setInterruptHook(new ShutdownHook());
Ice.ObjectPrx base = communicator().propertyToProxy("Value.Initial");
InitialPrx initial = InitialPrxHelper.checkedCast(base);
@@ -79,12 +79,12 @@ public class Client extends Ice.Application
PrinterHolder printer = new PrinterHolder();
PrinterPrxHolder printerProxy = new PrinterPrxHolder();
- boolean gotException = false;
+ boolean gotException = false;
try
{
initial.getPrinter(printer, printerProxy);
- System.err.println("Did not get the expected NoObjectFactoryException!");
- System.exit(1);
+ System.err.println("Did not get the expected NoObjectFactoryException!");
+ System.exit(1);
}
catch(Ice.NoObjectFactoryException ex)
{
@@ -130,13 +130,13 @@ public class Client extends Ice.Application
readline(in);
Printer derivedAsBase = initial.getDerivedPrinter();
- System.out.println("The type ID of the received object is \"" + derivedAsBase.ice_id() + "\"");
- assert(derivedAsBase.ice_id().equals("::Demo::Printer"));
+ System.out.println("The type ID of the received object is \"" + derivedAsBase.ice_id() + "\"");
+ assert(derivedAsBase.ice_id().equals("::Demo::Printer"));
System.out.println();
System.out.println("Now we install a factory for the derived class, and try again.");
System.out.println("Because we receive the derived object as a base object,");
- System.out.println("we need to do a class cast to get from the base to the derived object.");
+ System.out.println("we need to do a class cast to get from the base to the derived object.");
System.out.println("[press enter]");
readline(in);
@@ -146,7 +146,7 @@ public class Client extends Ice.Application
DerivedPrinter derived = (Demo.DerivedPrinter)derivedAsBase;
System.out.println("==> class cast to derived object succeded");
- System.out.println("The type ID of the received object is \"" + derived.ice_id() + "\"");
+ System.out.println("The type ID of the received object is \"" + derived.ice_id() + "\"");
System.out.println();
System.out.println("Let's print the message contained in the derived object, and");
@@ -183,7 +183,7 @@ public class Client extends Ice.Application
System.out.println();
System.out.println("That's it for this demo. Have fun with Ice!");
- initial.shutdown();
+ initial.shutdown();
return 0;
}
diff --git a/java/demo/Ice/value/InitialI.java b/java/demo/Ice/value/InitialI.java
index c0afc64a5a8..6fd9e098378 100644
--- a/java/demo/Ice/value/InitialI.java
+++ b/java/demo/Ice/value/InitialI.java
@@ -54,7 +54,7 @@ class InitialI extends Initial
public void
shutdown(Ice.Current current)
{
- current.adapter.getCommunicator().shutdown();
+ current.adapter.getCommunicator().shutdown();
}
private Simple _simple = new Simple();