diff options
author | Mark Spruiell <mes@zeroc.com> | 2009-04-03 15:15:13 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2009-04-03 15:15:13 -0700 |
commit | b415955846ce0d5c2e0c283f897190ccd2c3616a (patch) | |
tree | 10daf6bb8a05edf5052a33f10ea16c73d8ae0d89 /java/src/Ice/ObjectAdapterI.java | |
parent | Bug 3465 - Remove _adapter members from test where unecessary (diff) | |
download | ice-b415955846ce0d5c2e0c283f897190ccd2c3616a.tar.bz2 ice-b415955846ce0d5c2e0c283f897190ccd2c3616a.tar.xz ice-b415955846ce0d5c2e0c283f897190ccd2c3616a.zip |
removing Java2 mapping
Diffstat (limited to 'java/src/Ice/ObjectAdapterI.java')
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 94 |
1 files changed, 41 insertions, 53 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index ba25b1b1173..a78323d4532 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -52,7 +52,7 @@ public final class ObjectAdapterI implements ObjectAdapter IceInternal.IncomingConnectionFactory factory = (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); factory.activate(); - } + } return; } @@ -120,7 +120,7 @@ public final class ObjectAdapterI implements ObjectAdapter (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); factory.activate(); } - } + } } public synchronized void @@ -149,7 +149,7 @@ public final class ObjectAdapterI implements ObjectAdapter (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); factory.waitUntilHolding(); } - } + } public void deactivate() @@ -170,7 +170,7 @@ public final class ObjectAdapterI implements ObjectAdapter // // - // Wait for activation to complete. This is necessary to not + // Wait for activation to complete. This is necessary to not // get out of order locator updates. // while(_waitForActivate) @@ -267,18 +267,17 @@ public final class ObjectAdapterI implements ObjectAdapter } } - incomingConnectionFactories = - (IceInternal.IncomingConnectionFactory[])_incomingConnectionFactories.toArray( - new IceInternal.IncomingConnectionFactory[0]); + incomingConnectionFactories = + _incomingConnectionFactories.toArray(new IceInternal.IncomingConnectionFactory[0]); } // // Now we wait for until all incoming connection factories are // finished. // - for(int i = 0; i < incomingConnectionFactories.length; ++i) + for(IceInternal.IncomingConnectionFactory f : incomingConnectionFactories) { - incomingConnectionFactories[i].waitUntilFinished(); + f.waitUntilFinished(); } } @@ -446,7 +445,7 @@ public final class ObjectAdapterI implements ObjectAdapter return _servantManager.removeServant(ident, facet); } - public synchronized java.util.Map + public synchronized java.util.Map<String, Ice.Object> removeAllFacets(Identity ident) { checkForDeactivation(); @@ -478,7 +477,7 @@ public final class ObjectAdapterI implements ObjectAdapter return _servantManager.findServant(ident, facet); } - public synchronized java.util.Map + public synchronized java.util.Map<String, Ice.Object> findAllFacets(Identity ident) { checkForDeactivation(); @@ -600,7 +599,7 @@ public final class ObjectAdapterI implements ObjectAdapter isLocal(ObjectPrx proxy) { // - // NOTE: it's important that isLocal() doesn't perform any blocking operations as + // NOTE: it's important that isLocal() doesn't perform any blocking operations as // it can be called for AMI invocations if the proxy has no delegate set yet. // @@ -634,26 +633,22 @@ public final class ObjectAdapterI implements ObjectAdapter // endpoints used by this object adapter's incoming connection // factories are considered local. // - for(int i = 0; i < endpoints.length; ++i) + for(IceInternal.EndpointI endpoint : endpoints) { - java.util.Iterator<IceInternal.EndpointI> p = _publishedEndpoints.iterator(); - while(p.hasNext()) + for(IceInternal.EndpointI p : _publishedEndpoints) { - if(endpoints[i].equivalent(p.next())) + if(endpoint.equivalent(p)) { return true; } } - java.util.Iterator<IceInternal.IncomingConnectionFactory> q = - _incomingConnectionFactories.iterator(); - while(q.hasNext()) + for(IceInternal.IncomingConnectionFactory p : _incomingConnectionFactories) { - if(endpoints[i].equivalent(q.next().endpoint())) + if(endpoint.equivalent(p.endpoint())) { return true; } } - } // @@ -663,12 +658,11 @@ public final class ObjectAdapterI implements ObjectAdapter // if(_routerInfo != null && _routerInfo.getRouter().equals(proxy.ice_getRouter())) { - for(int i = 0; i < endpoints.length; ++i) + for(IceInternal.EndpointI endpoint : endpoints) { - java.util.Iterator<IceInternal.EndpointI> p = _routerEndpoints.iterator(); - while(p.hasNext()) + for(IceInternal.EndpointI p : _routerEndpoints) { - if(endpoints[i].equivalent(p.next())) + if(endpoint.equivalent(p)) { return true; } @@ -689,10 +683,9 @@ public final class ObjectAdapterI implements ObjectAdapter { f = new java.util.ArrayList<IceInternal.IncomingConnectionFactory>(_incomingConnectionFactories); } - java.util.Iterator<IceInternal.IncomingConnectionFactory> i = f.iterator(); - while(i.hasNext()) + for(IceInternal.IncomingConnectionFactory p : f) { - i.next().flushBatchRequests(); + p.flushBatchRequests(); } } @@ -742,7 +735,7 @@ public final class ObjectAdapterI implements ObjectAdapter public IceInternal.ServantManager getServantManager() - { + { // // No mutex lock necessary, _servantManager is immutable. // @@ -753,7 +746,7 @@ public final class ObjectAdapterI implements ObjectAdapter // Only for use by IceInternal.ObjectAdapterFactory // public - ObjectAdapterI(IceInternal.Instance instance, Communicator communicator, + ObjectAdapterI(IceInternal.Instance instance, Communicator communicator, IceInternal.ObjectAdapterFactory objectAdapterFactory, String name, String endpointInfo, RouterPrx router, boolean noConfig) { @@ -788,10 +781,9 @@ public final class ObjectAdapterI implements ObjectAdapter if(unknownProps.size() != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0) { String message = "found unknown properties for object adapter `" + _name + "':"; - java.util.Iterator<String> p = unknownProps.iterator(); - while(p.hasNext()) + for(String p : unknownProps) { - message += "\n " + p.next(); + message += "\n " + p; } _instance.initializationData().logger.warning(message); } @@ -861,7 +853,7 @@ public final class ObjectAdapterI implements ObjectAdapter // if(_routerInfo.getAdapter() != null) { - throw new AlreadyRegisteredException("object adapter with router", + throw new AlreadyRegisteredException("object adapter with router", _instance.identityToString(router.ice_getIdentity())); } @@ -870,9 +862,9 @@ public final class ObjectAdapterI implements ObjectAdapter // adapter. // IceInternal.EndpointI[] endpoints = _routerInfo.getServerEndpoints(); - for(int i = 0; i < endpoints.length; ++i) + for(IceInternal.EndpointI endpoint : endpoints) { - _routerEndpoints.add(endpoints[i]); + _routerEndpoints.add(endpoint); } java.util.Collections.sort(_routerEndpoints); // Must be sorted. @@ -905,7 +897,7 @@ public final class ObjectAdapterI implements ObjectAdapter // Also modify all existing outgoing connections to the // router's client proxy to use this object adapter for // callbacks. - // + // _instance.outgoingConnectionFactory().setRouterInfo(_routerInfo); } } @@ -927,7 +919,7 @@ public final class ObjectAdapterI implements ObjectAdapter for(int i = 0; i < endpoints.size(); ++i) { IceInternal.EndpointI endp = endpoints.get(i); - IceInternal.IncomingConnectionFactory factory = + IceInternal.IncomingConnectionFactory factory = new IceInternal.IncomingConnectionFactory(instance, endp, this, _name); _incomingConnectionFactories.add(factory); } @@ -970,7 +962,7 @@ public final class ObjectAdapterI implements ObjectAdapter { if(!_deactivated) { - _instance.initializationData().logger.warning("object adapter `" + getName() + + _instance.initializationData().logger.warning("object adapter `" + getName() + "' has not been deactivated"); } else if(!_destroyed) @@ -998,7 +990,7 @@ public final class ObjectAdapterI implements ObjectAdapter return newDirectProxy(ident, facet); } else if(_replicaGroupId.length() == 0) - { + { return newIndirectProxy(ident, facet, _id); } else @@ -1182,10 +1174,9 @@ public final class ObjectAdapterI implements ObjectAdapter // include actual addresses in the published endpoints. // java.util.List<IceInternal.EndpointI> expandedEndpoints = new java.util.ArrayList<IceInternal.EndpointI>(); - java.util.Iterator<IceInternal.EndpointI> p = endpoints.iterator(); - while(p.hasNext()) + for(IceInternal.EndpointI p : endpoints) { - expandedEndpoints.addAll(p.next().expand()); + expandedEndpoints.addAll(p.expand()); } return expandedEndpoints; } @@ -1199,7 +1190,7 @@ public final class ObjectAdapterI implements ObjectAdapter } // - // Call on the locator registry outside the synchronization to + // Call on the locator registry outside the synchronization to // blocking other threads that need to lock this OA. // LocatorRegistryPrx locatorRegistry = locatorInfo != null ? locatorInfo.getLocatorRegistry() : null; @@ -1341,7 +1332,7 @@ public final class ObjectAdapterI implements ObjectAdapter try { - locatorRegistry.setServerProcessProxy(serverId, + locatorRegistry.setServerProcessProxy(serverId, ProcessPrxHelper.uncheckedCast(createDirectProxy(_processId))); } catch(ServerNotFoundException ex) @@ -1384,9 +1375,9 @@ public final class ObjectAdapterI implements ObjectAdapter _instance.initializationData().logger.trace(_instance.traceLevels().locationCat, s.toString()); } } - } + } - static private String[] _suffixes = + static private String[] _suffixes = { "AdapterId", "Endpoints", @@ -1422,15 +1413,12 @@ public final class ObjectAdapterI implements ObjectAdapter boolean noProps = true; java.util.Map<String, String> props = _instance.initializationData().properties.getPropertiesForPrefix(prefix); - java.util.Iterator<String> p = props.keySet().iterator(); - while(p.hasNext()) + for(String prop : props.keySet()) { - String prop = p.next(); - boolean valid = false; - for(int i = 0; i < _suffixes.length; ++i) + for(String suffix : _suffixes) { - if(prop.equals(prefix + _suffixes[i])) + if(prop.equals(prefix + suffix)) { noProps = false; valid = true; |