From abada90e3f84dc703b8ddc9efcbed8a946fadead Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Thu, 1 Feb 2007 17:09:49 +0000 Subject: Expanded tabs into spaces --- java/src/IceInternal/ObjectAdapterFactory.java | 290 ++++++++++++------------- 1 file changed, 145 insertions(+), 145 deletions(-) (limited to 'java/src/IceInternal/ObjectAdapterFactory.java') diff --git a/java/src/IceInternal/ObjectAdapterFactory.java b/java/src/IceInternal/ObjectAdapterFactory.java index e4a67e2a297..dcb67beec7f 100644 --- a/java/src/IceInternal/ObjectAdapterFactory.java +++ b/java/src/IceInternal/ObjectAdapterFactory.java @@ -16,29 +16,29 @@ public final class ObjectAdapterFactory { Ice.ObjectAdapter[] adapters; - synchronized(this) - { - // - // Ignore shutdown requests if the object adapter factory has - // already been shut down. - // - if(_instance == null) - { - return; - } + synchronized(this) + { + // + // Ignore shutdown requests if the object adapter factory has + // already been shut down. + // + if(_instance == null) + { + return; + } - adapters = (Ice.ObjectAdapter[])_adapters.values().toArray(new Ice.ObjectAdapter[0]); + adapters = (Ice.ObjectAdapter[])_adapters.values().toArray(new Ice.ObjectAdapter[0]); - _instance = null; - _communicator = null; - - notifyAll(); - } + _instance = null; + _communicator = null; + + notifyAll(); + } - // - // Deactivate outside the thread synchronization, to avoid - // deadlocks. - // + // + // Deactivate outside the thread synchronization, to avoid + // deadlocks. + // for(int i = 0; i < adapters.length; ++i) { adapters[i].deactivate(); @@ -48,60 +48,60 @@ public final class ObjectAdapterFactory public void waitForShutdown() { - synchronized(this) - { - // - // First we wait for the shutdown of the factory itself. - // - while(_instance != null) - { - try - { - wait(); - } - catch(InterruptedException ex) - { - } - } - - // - // If some other thread is currently shutting down, we wait - // until this thread is finished. - // - while(_waitForShutdown) - { - try - { - wait(); - } - catch(InterruptedException ex) - { - } - } - _waitForShutdown = true; - } - - // - // Now we wait for deactivation of each object adapter. - // - if(_adapters != null) - { - java.util.Iterator i = _adapters.values().iterator(); - while(i.hasNext()) - { - Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)i.next(); - adapter.waitForDeactivate(); - } - } + synchronized(this) + { + // + // First we wait for the shutdown of the factory itself. + // + while(_instance != null) + { + try + { + wait(); + } + catch(InterruptedException ex) + { + } + } + + // + // If some other thread is currently shutting down, we wait + // until this thread is finished. + // + while(_waitForShutdown) + { + try + { + wait(); + } + catch(InterruptedException ex) + { + } + } + _waitForShutdown = true; + } + + // + // Now we wait for deactivation of each object adapter. + // + if(_adapters != null) + { + java.util.Iterator i = _adapters.values().iterator(); + while(i.hasNext()) + { + Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)i.next(); + adapter.waitForDeactivate(); + } + } - synchronized(this) - { - // - // Signal that waiting is complete. - // - _waitForShutdown = false; - notifyAll(); - } + synchronized(this) + { + // + // Signal that waiting is complete. + // + _waitForShutdown = false; + notifyAll(); + } } public synchronized boolean @@ -114,27 +114,27 @@ public final class ObjectAdapterFactory destroy() { // - // First wait for shutdown to finish. - // - waitForShutdown(); + // First wait for shutdown to finish. + // + waitForShutdown(); Ice.ObjectAdapter[] adapters; - synchronized(this) - { - adapters = (Ice.ObjectAdapter[])_adapters.values().toArray(new Ice.ObjectAdapter[0]); + synchronized(this) + { + adapters = (Ice.ObjectAdapter[])_adapters.values().toArray(new Ice.ObjectAdapter[0]); - // - // For consistency with C#, we set _adapters to null - // so that our finalizer does not try to invoke any - // methods on member objects. - // - _adapters = null; - } + // + // For consistency with C#, we set _adapters to null + // so that our finalizer does not try to invoke any + // methods on member objects. + // + _adapters = null; + } - // - // Now we destroy each object adapter. - // + // + // Now we destroy each object adapter. + // for(int i = 0; i < adapters.length; ++i) { adapters[i].destroy(); @@ -144,62 +144,62 @@ public final class ObjectAdapterFactory public synchronized Ice.ObjectAdapter createObjectAdapter(String name, String endpoints, Ice.RouterPrx router) { - if(_instance == null) - { - throw new Ice.ObjectAdapterDeactivatedException(); - } + if(_instance == null) + { + throw new Ice.ObjectAdapterDeactivatedException(); + } Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)_adapters.get(name); if(adapter != null) { - throw new Ice.AlreadyRegisteredException("object adapter", name); + throw new Ice.AlreadyRegisteredException("object adapter", name); } - if(name.length() == 0 && (endpoints.length() != 0 || router != null)) - { - Ice.InitializationException ex = new Ice.InitializationException(); - ex.reason = "Cannot configure endpoints or router with nameless object adapter"; - throw ex; - } + if(name.length() == 0 && (endpoints.length() != 0 || router != null)) + { + Ice.InitializationException ex = new Ice.InitializationException(); + ex.reason = "Cannot configure endpoints or router with nameless object adapter"; + throw ex; + } - if(name.length() == 0) - { - String uuid = Ice.Util.generateUUID(); + if(name.length() == 0) + { + String uuid = Ice.Util.generateUUID(); adapter = new Ice.ObjectAdapterI(_instance, _communicator, this, uuid, "", null, true); _adapters.put(uuid, adapter); - } - else - { + } + else + { adapter = new Ice.ObjectAdapterI(_instance, _communicator, this, name, endpoints, router, false); _adapters.put(name, adapter); - } + } return adapter; } public synchronized Ice.ObjectAdapter findObjectAdapter(Ice.ObjectPrx proxy) { - if(_instance == null) - { - return null; - } + if(_instance == null) + { + return null; + } java.util.Iterator i = _adapters.values().iterator(); while(i.hasNext()) { Ice.ObjectAdapterI adapter = (Ice.ObjectAdapterI)i.next(); - try - { - if(adapter.isLocal(proxy)) - { - return adapter; - } - } - catch(Ice.ObjectAdapterDeactivatedException ex) - { - // Ignore. - } - } + try + { + if(adapter.isLocal(proxy)) + { + return adapter; + } + } + catch(Ice.ObjectAdapterDeactivatedException ex) + { + // Ignore. + } + } return null; } @@ -208,9 +208,9 @@ public final class ObjectAdapterFactory removeObjectAdapter(String name) { if(_waitForShutdown || _adapters == null) - { - return; - } + { + return; + } _adapters.remove(name); } @@ -218,20 +218,20 @@ public final class ObjectAdapterFactory public void flushBatchRequests() { - java.util.LinkedList a = new java.util.LinkedList(); + java.util.LinkedList a = new java.util.LinkedList(); synchronized(this) - { - java.util.Iterator i = _adapters.values().iterator(); - while(i.hasNext()) - { - a.add(i.next()); - } - } - java.util.Iterator p = a.iterator(); - while(p.hasNext()) - { - ((Ice.ObjectAdapterI)p.next()).flushBatchRequests(); - } + { + java.util.Iterator i = _adapters.values().iterator(); + while(i.hasNext()) + { + a.add(i.next()); + } + } + java.util.Iterator p = a.iterator(); + while(p.hasNext()) + { + ((Ice.ObjectAdapterI)p.next()).flushBatchRequests(); + } } // @@ -240,18 +240,18 @@ public final class ObjectAdapterFactory ObjectAdapterFactory(Instance instance, Ice.Communicator communicator) { _instance = instance; - _communicator = communicator; - _waitForShutdown = false; + _communicator = communicator; + _waitForShutdown = false; } protected synchronized void finalize() throws Throwable { - IceUtil.Assert.FinalizerAssert(_instance == null); - IceUtil.Assert.FinalizerAssert(_communicator == null); - IceUtil.Assert.FinalizerAssert(_adapters == null); - IceUtil.Assert.FinalizerAssert(!_waitForShutdown); + IceUtil.Assert.FinalizerAssert(_instance == null); + IceUtil.Assert.FinalizerAssert(_communicator == null); + IceUtil.Assert.FinalizerAssert(_adapters == null); + IceUtil.Assert.FinalizerAssert(!_waitForShutdown); super.finalize(); } -- cgit v1.2.3