dev@glassfish.java.net

Re: svn commit: r41383 - trunk/v3: . common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl orb/orb-iiop/src/main/java/org/glassfish/ente...

From: Ken <ken.cavanaugh_at_oracle.com>
Date: Tue, 05 Oct 2010 13:13:23 -0700

Marina Vatkina wrote:
> My build fails with
>
> [INFO] Compiling 126 source files to
> /Users/mvatkina/v3/v3/transaction/jts/target/classes
> /Users/mvatkina/v3/v3/transaction/jts/src/main/java/com/sun/enterprise/transaction/jts/iiop/TransactionIIOPInterceptorFactory.java:139:
> cannot find symbol
> symbol : class ORB
> location: package com.sun.corba.ee.spi.orb
> com.sun.corba.ee.spi.orb.ORB theORB =
> ((ORBInitInfoExt)info).getORB();
>
> -marina

I know: I see the same problem, and also in the Hudson job.
I'm looking at it (of course, everything built fine for me before my
commit).

Ken.
>
> kcavanaugh_at_dev.java.net wrote:
>> Author: kcavanaugh
>> Date: 2010-10-05 18:06:56+0000
>> New Revision: 41383
>>
>> Modified:
>>
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GroupInfoServiceObserverImpl.java
>>
>>
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RoundRobinPolicy.java
>>
>>
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContext.java
>>
>>
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContextProviderImpl.java
>>
>>
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialInitContextFactory.java
>>
>>
>> trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java
>>
>>
>> trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java
>>
>> trunk/v3/pom.xml
>>
>> trunk/v3/security/ejb.security/src/main/java/com/sun/enterprise/iiop/security/SecIORInterceptor.java
>>
>>
>> Log:
>> - Integration of IIOP-8: IIOP failover and load balancing.
>> - Extensive updates to glassfish-naming for LB
>> - A small update to ejb.security in the SecIORInterceptor
>> - Integration of GMS into orb-iiop
>> - Updated ORB to 3.1.0-b007
>> - Mainly includes a few cosmetic fixes from Dies Koper
>>
>> - Tests passed:
>> - glassfish QL
>> - web QL
>> - EJB dev tests
>> - CTS smoke
>>
>>
>> Modified:
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GroupInfoServiceObserverImpl.java
>>
>> Url:
>> https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GroupInfoServiceObserverImpl.java?view=diff&rev=41383&p1=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GroupInfoServiceObserverImpl.java&p2=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GroupInfoServiceObserverImpl.java&r1=41382&r2=41383
>>
>> ==============================================================================
>>
>> ---
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GroupInfoServiceObserverImpl.java
>> (original)
>> +++
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GroupInfoServiceObserverImpl.java
>> 2010-10-05 18:06:56+0000
>> @@ -67,12 +67,8 @@
>>
>> private GroupInfoService gis;
>>
>> - private SerialInitContextFactory ctxFactory ;
>> -
>> - public GroupInfoServiceObserverImpl(GroupInfoService gis,
>> - SerialInitContextFactory factory ) {
>> + public GroupInfoServiceObserverImpl(GroupInfoService gis ) {
>> this.gis = gis;
>> - ctxFactory = factory ;
>> }
>>
>> @Override
>> @@ -81,7 +77,8 @@
>> List<ClusterInstanceInfo> instanceInfoList =
>> gis.getClusterInstanceInfo((String[])null);
>> if (instanceInfoList != null && instanceInfoList.size() > 0) {
>> -
>> ctxFactory.getRRPolicy().setClusterInstanceInfo(instanceInfoList);
>> + SerialInitContextFactory.getRRPolicy()
>> + .setClusterInstanceInfo(instanceInfoList);
>> }
>> } catch(Exception e) {
>> _logger.log(Level.SEVERE,
>>
>> Modified:
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RoundRobinPolicy.java
>>
>> Url:
>> https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RoundRobinPolicy.java?view=diff&rev=41383&p1=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RoundRobinPolicy.java&p2=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RoundRobinPolicy.java&r1=41382&r2=41383
>>
>> ==============================================================================
>>
>> ---
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RoundRobinPolicy.java
>> (original)
>> +++
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/RoundRobinPolicy.java
>> 2010-10-05 18:06:56+0000
>> @@ -40,7 +40,6 @@
>>
>> package com.sun.enterprise.naming.impl;
>>
>> -import java.util.Arrays;
>> import java.util.logging.Level;
>> import com.sun.logging.LogDomains;
>> import java.util.logging.Logger;
>> @@ -55,6 +54,7 @@
>> import com.sun.jndi.cosnaming.IiopUrl;
>> import com.sun.corba.ee.spi.folb.ClusterInstanceInfo;
>> import com.sun.corba.ee.spi.folb.SocketInfo;
>> +import java.net.Inet4Address;
>> import java.util.ArrayList;
>> import org.glassfish.internal.api.ORBLocator;
>>
>> @@ -103,6 +103,10 @@
>> **/
>>
>> public class RoundRobinPolicy {
>> + // Each SocketInfo.type() must either start with SSL, or be
>> CLEAR_TEXT
>> + private static final String SSL = "SSL" ;
>> + private static final String CLEAR_TEXT = "CLEAR_TEXT" ;
>> +
>> private static final Logger _logger = LogDomains.getLogger(
>> RoundRobinPolicy.class, LogDomains.JNDI_LOGGER);
>>
>> @@ -111,7 +115,7 @@
>> private List<ClusterInstanceInfo> endpointsList = new
>> LinkedList<ClusterInstanceInfo>();
>>
>> - private int sumOfAllWeights = 0;
>> + private int totalWeight = 0;
>>
>> private static final int default_weight = 10;
>>
>> @@ -134,66 +138,69 @@
>> }
>>
>> //called during bootstrapping
>> - public RoundRobinPolicy(String[] list) { -
>> setClusterInstanceInfo(list);
>> + public RoundRobinPolicy(List<String> list) {
>> + setClusterInstanceInfoFromString(list);
>> + }
>> +
>> + // Copy list, changing any type that does not start with SSL to
>> CLEAR_TEXT.
>> + private List<SocketInfo> filterSocketInfos( List<SocketInfo> sis
>> ) {
>> + final List<SocketInfo> result = new ArrayList<SocketInfo>() ;
>> + for (SocketInfo si : sis) {
>> + final String newType = si.type().startsWith(SSL) ?
>> + si.type() : CLEAR_TEXT ;
>> + final SocketInfo siCopy = new SocketInfo( newType,
>> + si.host(), si.port() ) ;
>> + result.add( siCopy ) ;
>> + }
>> + return result ;
>> }
>>
>> //will be called after dynamic reconfig
>> - public synchronized final void setClusterInstanceInfo(
>> + // used in GroupInfoServiceObserverImpl
>> + synchronized final void setClusterInstanceInfo(
>> List<ClusterInstanceInfo> list) {
>>
>> - sumOfAllWeights = 0;
>> + totalWeight = 0;
>>
>> String policy = System.getProperty(
>> - SerialInitContextFactory.LOAD_BALANCING_PROPERTY);
>> - boolean isWeighted;
>> - if (policy == null) {
>> - //default is ic-based
>> - policy = SerialInitContextFactory.IC_BASED;
>> - }
>> + SerialInitContextFactory.LOAD_BALANCING_PROPERTY,
>> + SerialInitContextFactory.IC_BASED );
>> + boolean isWeighted = false ;
>>
>> if (policy.equals(SerialInitContextFactory.IC_BASED_WEIGHTED)) {
>> isWeighted = true;
>> - } else if (policy.equals(SerialInitContextFactory.IC_BASED)) {
>> - isWeighted = false;
>> - } else {
>> - isWeighted = false;
>> + } else if (!policy.equals(SerialInitContextFactory.IC_BASED)) {
>> warnLog("loadbalancing.policy.incorrect");
>> }
>>
>> - fineLog( "isWeighted = {0}", isWeighted );
>> + fineLog( "setClusterInstanceInfo: isWeighted = {0}", isWeighted );
>>
>> - //make the weights of all endpoints = default_weight
>> ArrayList<ClusterInstanceInfo> newList =
>> new ArrayList<ClusterInstanceInfo>() ;
>>
>> - for (ClusterInstanceInfo endpoint : list) {
>> - ClusterInstanceInfo newEndpoint ;
>> - if (isWeighted) {
>> - newEndpoint = new ClusterInstanceInfo( endpoint.name(),
>> - endpoint.weight(), endpoint.endpoints() ) ;
>> - } else {
>> - newEndpoint = new ClusterInstanceInfo( endpoint.name(),
>> - default_weight, endpoint.endpoints() ) ;
>> - }
>> - newList.add( newEndpoint ) ;
>> -
>> - infoLog( "endpoint.weight after checking isWeight = {0}",
>> - endpoint.weight());
>> + for (ClusterInstanceInfo clinfo : list) {
>> + final int newWeight = isWeighted ? clinfo.weight() :
>> default_weight ;
>> + fineLog( "setClusterInstanceInfo: instance {0} weight {1}",
>> + clinfo.name(), clinfo.weight() ) ;
>> +
>> + final List<SocketInfo> newEndpoints =
>> + filterSocketInfos( clinfo.endpoints() ) ;
>> + final ClusterInstanceInfo newClinfo = new
>> ClusterInstanceInfo(
>> + clinfo.name(), newWeight, newEndpoints ) ;
>> + newList.add( newClinfo ) ;
>>
>> - sumOfAllWeights += newEndpoint.weight() ;
>> + totalWeight += newWeight ;
>> }
>>
>> endpointsList = newList ;
>>
>> - infoLog( "sumOfAllWeights = {0}", sumOfAllWeights);
>> + fineLog( "setClusterInstanceInfo: totalWeight = {0}", totalWeight);
>> }
>> - /**
>> - * add a string array of endpoints to list
>> - */
>> - public synchronized final void setClusterInstanceInfo(String[]
>> list) {
>> - String[] newList = null;
>> + synchronized final void setClusterInstanceInfoFromString(
>> + List<String> list) {
>> +
>> + List<String> newList = null;
>>
>> //if no endpoints are specified as a system property,
>> //then look for JNDI provider url
>> @@ -207,7 +214,7 @@
>> // to DAS. //So if the DAS host:port is used,
>> //then it will definitely result in a NameNotFoundException
>> - if (list != null && list.length > 0) {
>> + if (!list.isEmpty()) {
>> newList = getAddressPortList(list);
>> } else {
>> newList = getEndpointForProviderURL(
>> @@ -215,17 +222,17 @@
>> }
>>
>> //randomize the list before adding it to linked list
>> - if (newList != null && newList.length > 0) {
>> - String[] new_list = randomize(newList);
>> + if (!newList.isEmpty()) {
>> + List<String> newList2 = randomize(newList);
>> List<ClusterInstanceInfo> targetServerList = new
>> LinkedList <ClusterInstanceInfo> ();
>>
>> - for (int i = 0; i < new_list.length; i++) {
>> - if (notDuplicate(new_list[i])) {
>> - targetServerList.add( makeClusterInstanceInfo( new_list[i],
>> + for(String elem : newList2) {
>> + if (notDuplicate(elem)) {
>> + targetServerList.add( makeClusterInstanceInfo( elem,
>> default_weight));
>> - }
>> - }
>> + }
>> + }
>>
>> if (!targetServerList.isEmpty()) {
>> targetServerList.addAll(endpointsList);
>> @@ -246,7 +253,7 @@
>>
>> String[] host_port = str.split(":");
>> String server_identifier = ""; //for bootstrapping, can be ""
>> - String type = "CLEAR_TEXT"; //will be clear_text for bootstrapping
>> + String type = CLEAR_TEXT; //will be clear_text for bootstrapping
>> SocketInfo socketInfo = new SocketInfo(
>> type, host_port[0], Integer.parseInt( host_port[1]) );
>> List<SocketInfo> sil = new ArrayList<SocketInfo>(1) ;
>> @@ -275,55 +282,51 @@
>> return true;
>> }
>> - /**
>> + /*
>> * This method checks for other ways of specifying endpoints
>> * namely JNDI provider url * orb host:port is used only
>> if even env passed into * getInitialContext is empty. This
>> check is performed in - * S1ASCtxFactory.getInitialContext()
>> + * SerialInitContextFactory.getInitialContext()
>> */
>> - public String[] getEndpointForProviderURL(String
>> providerURLString) {
>> - String[] newList = null;
>> + public List<String> getEndpointForProviderURL(String
>> providerURLString) {
>> if (providerURLString != null) {
>> try {
>> - IiopUrl providerURL = new IiopUrl(providerURLString);
>> - newList = getAddressPortList(providerURL);
>> + final IiopUrl providerURL = new IiopUrl(providerURLString);
>> + final List<String> newList = getAddressPortList(providerURL);
>> warnLog( "no.endpoints.selected.provider", providerURLString );
>> + return newList ;
>> } catch (MalformedURLException me) {
>> warnLog( "provider.exception", me.getMessage(),
>> providerURLString);
>> } } - return newList;
>> + return new ArrayList<String>() ;
>> }
>> /**
>> - * randomize the list
>> + * randomize the list. Note: this empties its argument.
>> */
>> - private String[] randomize(String[] list) {
>> - //randomise the list to enable loadbalancing
>> - String[] randomizedList = new String[list.length];
>> - for (int i = 0; i < list.length; i++) {
>> - int random;
>> - do {
>> - random = rand.nextInt(list.length);
>> - fineLog( "random ==> {0}", random );
>> - } while (list[random] == null);
>> - randomizedList[i] = list[random];
>> - fineLog( "randomisedList[{0}] ==> {1}", i, randomizedList[i] );
>> - list[random] = null;
>> - }
>> - return randomizedList;
>> + private List<String> randomize( List<String> list ) {
>> + List<String> result = new ArrayList<String>( list.size() ) ;
>> + while (!list.isEmpty()) {
>> + int random = rand.nextInt( list.size() ) ;
>> + String elem = list.remove( random ) ;
>> + result.add( elem ) ;
>> + }
>> +
>> + fineLog( "Randomized list {0}", result ) ;
>> + return result ;
>> }
>>
>> - /**
>> + /*
>> * get a new shape of the endpoints
>> * For e.g. if list contains A,B,C
>> * if the logic below chooses B as the endpoint to send the req to
>> * then return B,C,A.
>> * logic used is as described in Class description comments
>> */
>> - public synchronized Object[] getNextRotation() {
>> + public synchronized List<String> getNextRotation() {
>> int lowerLimit = 0; //lowerLimit
>> int random = 0;
>> //make sure that the random # is not 0
>> @@ -332,15 +335,15 @@
>> //11-upperLimit and so
>> //on. Hence we dont want random # to be 0.
>> fineLog( "RoundRobinPolicy.getNextRotation ->
>> sumOfAllWeights = {0}",
>> - sumOfAllWeights);
>> + totalWeight);
>> while( random == 0) {
>> - random = rand.nextInt(sumOfAllWeights);
>> + random = rand.nextInt(totalWeight);
>> if ( random != 0) {
>> break;
>> }
>> }
>> fineLog( "getNextRotation : random # = {0} sum of all
>> weights = {1}",
>> - new Object[]{random, sumOfAllWeights});
>> + new Object[]{random, totalWeight});
>> int i = 0;
>> for (ClusterInstanceInfo endpoint : endpointsList) {
>> int upperLimit = lowerLimit + endpoint.weight();
>> @@ -367,21 +370,25 @@
>> i++; }
>> warnLog("Could not find an endpoint to send request to!");
>> - return null;
>> + return new ArrayList<String>() ;
>> }
>> - private Object[]
>> convertIntoCorbaloc(List<ClusterInstanceInfo> list) {
>> + private List<String>
>> convertIntoCorbaloc(List<ClusterInstanceInfo> list) {
>> List<String> host_port = new ArrayList<String>();
>> for (ClusterInstanceInfo endpoint : list) {
>> List<SocketInfo> sinfos = endpoint.endpoints();
>> for (SocketInfo si : sinfos ) {
>> - String element = si.host().trim() + ":" + si.port() ;
>> - if (!host_port.contains( element )) {
>> - host_port.add( element ) ;
>> + // XXX this needs to be revised if we ever do a secure
>> + // bootstrap protocol for the initial corbaloc URL
>> resolution
>> + if (si.type().equals( CLEAR_TEXT )) {
>> + String element = si.host().trim() + ":" +
>> si.port() ;
>> + if (!host_port.contains( element )) {
>> + host_port.add( element ) ;
>> + }
>> }
>> }
>> }
>> - return host_port.toArray();
>> + return host_port ;
>> }
>>
>> /**
>> @@ -389,28 +396,23 @@
>> * corresponding to a particular host.
>> * (multi-homed hosts).
>> */
>> - private String [] getAddressPortList(String [] hostPortList) {
>> + private List<String> getAddressPortList(List<String>
>> hostPortList) {
>> // The list is assumed to contain <HOST NAME>:<PORT> values
>> List<String> addressPortVector = new ArrayList<String>();
>> for (String str : hostPortList) {
>> try {
>> IiopUrl url = new IiopUrl("iiop://" + str);
>> - String [] apList = getAddressPortList(url);
>> - addressPortVector.addAll(Arrays.asList(apList));
>> + List<String> apList = getAddressPortList(url);
>> + addressPortVector.addAll(apList);
>> } catch (MalformedURLException me) {
>> warnLog( "bad.host.port", str, me.getMessage() );
>> }
>> }
>>
>> - String [] ret = new String[addressPortVector.size()];
>> - for (int i=0; i<ret.length; i++) {
>> - ret[i] = addressPortVector.get(i);
>> - }
>> - // We return a list of <IP ADDRESS>:<PORT> values
>> - return ret;
>> + return addressPortVector ;
>> }
>> - private String [] getAddressPortList(IiopUrl iiopUrl) {
>> + private List<String> getAddressPortList(IiopUrl iiopUrl) {
>> // Pull out the host name and port
>> IiopUrl.Address iiopUrlAddress =
>> (IiopUrl.Address)(iiopUrl.getAddresses().elementAt(0));
>> @@ -421,19 +423,28 @@
>> return getAddressPortList(host, port); }
>> - public String [] getAddressPortList(String host, String
>> port) {
>> - // Get the ip addresses corresponding to the host
>> + public List<String> getAddressPortList(String host, String port) {
>> + // Get the ip addresses corresponding to the host.
>> + // XXX this currently does NOT support IPv6.
>> try {
>> InetAddress [] addresses = InetAddress.getAllByName(host);
>> - String[] ret = new String[addresses.length];
>> - for (int i = 0; i < addresses.length; i++) {
>> - ret[i] = addresses[i].getHostAddress() + ":" + port;
>> + List<InetAddress> addrs = new ArrayList<InetAddress>() ;
>> + for (InetAddress addr : addresses) {
>> + if (addr instanceof Inet4Address) {
>> + addrs.add( addr ) ;
>> + }
>> }
>> +
>> + List<String> ret = new ArrayList<String>() ;
>> + for (InetAddress addr : addrs) {
>> + ret.add( addr.getHostAddress() + ":" + port ) ;
>> + }
>> +
>> // We return a list of <IP ADDRESS>:<PORT> values
>> return ret;
>> } catch (UnknownHostException ukhe) {
>> warnLog( "unknown.host", host, ukhe.getMessage() );
>> - return null;
>> + return new ArrayList<String>() ;
>> }
>> }
>>
>>
>> Modified:
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContext.java
>>
>> Url:
>> https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContext.java?view=diff&rev=41383&p1=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContext.java&p2=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContext.java&r1=41382&r2=41383
>>
>> ==============================================================================
>>
>> ---
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContext.java
>> (original)
>> +++
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContext.java
>> 2010-10-05 18:06:56+0000
>> @@ -99,6 +99,9 @@
>>
>> private static final String JAVA_GLOBAL_URL = "java:global/";
>>
>> + private static final String IIOP_ENDPOINTSLIST =
>> + "com.sun.appserv.ee.iiop.endpointslist" ;
>> +
>>
>> // Sets unmanaged SerialContext in test mode to prevent attempts
>> to contact server. static final String INITIAL_CONTEXT_TEST_MODE
>> = "com.sun.enterprise.naming.TestMode";
>> @@ -160,7 +163,7 @@
>> * SerialContext.lookup() method. bug 5050591
>> *
>> */
>> - public static Context getStickyContext() {
>> + static Context getStickyContext() {
>> return stickyContext.get().getContext() ;
>> }
>>
>> @@ -172,7 +175,7 @@
>> stickyContext.get().release() ;
>> }
>>
>> - private void clearSticky() {
>> + static void clearSticky() {
>> stickyContext.get().clear() ;
>> }
>>
>> @@ -182,8 +185,8 @@
>> * e.g. JMS resource lookups (via ConnectorObjectFactory)
>> */
>> private static class ThreadLocalIC {
>> - private Context ctx;
>> - private int count = 1;
>> + private Context ctx = null ;
>> + private int count = 0;
>>
>> Context getContext() {
>> return ctx ;
>> @@ -192,21 +195,30 @@
>> void grab( Context context ) {
>> if (ctx == null) {
>> ctx = context ;
>> - } else {
>> - count++ ;
>> }
>> +
>> + count++ ;
>> }
>>
>> void release() {
>> - count-- ;
>> - if (count == 0) {
>> + if (count > 0) {
>> + count-- ;
>> + if (count == 0) {
>> + ctx = null ;
>> + }
>> + } else {
>> + if (_logger.isLoggable(Level.FINE)) {
>> + _logger.log( Level.FINE,
>> + "SerialContext: attempt to release
>> StickyContext "
>> + + " without grab") ;
>> + }
>> ctx = null ;
>> }
>> }
>>
>> void clear() {
>> ctx = null ;
>> - count = 1 ;
>> + count = 0 ;
>> }
>> }
>>
>> @@ -263,16 +275,18 @@
>> } else {
>> ProcessEnvironment processEnv =
>> habitat.getComponent(ProcessEnvironment.class);
>> processType = processEnv.getProcessType();
>> - _logger.log(Level.FINE,
>> - "Serial Context initializing with process
>> environment {0}",
>> - processEnv);
>> + if (_logger.isLoggable(Level.FINE)) {
>> + _logger.log(Level.FINE,
>> + "Serial Context initializing with process
>> environment {0}",
>> + processEnv);
>> + }
>> }
>>
>> // using these two temp variables allows instance variables
>> // to be 'final'.
>> JavaURLContext urlContextTemp = null;
>>
>> - if (myEnv.get("com.sun.appserv.ee.iiop.endpointslist") !=
>> null) {
>> + if (myEnv.get(IIOP_ENDPOINTSLIST) != null) {
>> urlContextTemp = new JavaURLContext(myEnv, this);
>> } else {
>> urlContextTemp = new JavaURLContext(myEnv, null);
>> @@ -334,6 +348,7 @@
>> returnValue = getRemoteProvider();
>> }
>> } catch(Exception e) {
>> + clearSticky() ;
>> e.printStackTrace();
>> NamingException ne = new NamingException(
>> "Unable to acquire SerialContextProvider for " +
>> this);
>> @@ -355,20 +370,22 @@
>> }
>>
>> private ProviderCacheKey getProviderCacheKey() {
>> - ORB myORB = getORB();
>> + final ORB myORB = getORB();
>> ProviderCacheKey key;
>> - // if( myORB != null) {
>> - // key = new ProviderCacheKey(myORB);
>> - // } else {
>>
>> - if (targetHost == null) {
>> + String eplist = null ;
>> + if (myEnv != null) {
>> + eplist = (String)myEnv.get(IIOP_ENDPOINTSLIST) ;
>> + }
>> +
>> + if (eplist != null) {
>> + key = new ProviderCacheKey(eplist) ;
>> + } else if(targetHost == null) {
>> key = new ProviderCacheKey(myORB) ;
>> } else {
>> key = new ProviderCacheKey(targetHost, targetPort);
>> }
>>
>> - // }
>> -
>> return key ;
>> }
>>
>> @@ -380,32 +397,32 @@
>>
>> private SerialContextProvider getRemoteProvider() throws
>> Exception {
>> if (provider == null) {
>> - ORB myORB = getORB() ;
>> ProviderCacheKey key = getProviderCacheKey() ;
>>
>> - // For logging / exception info purposes, keep track of
>> what the
>> - // orb has as its host/port
>> - ORBLocator orbHelper =
>> habitat.getComponent(ORBLocator.class);
>> -
>> SerialContextProvider cachedProvider;
>> synchronized(SerialContext.class) {
>> cachedProvider = providerCache.get(key);
>> }
>>
>> - if( cachedProvider == null) {
>> - String corbaloc = "corbaloc:iiop:1.2@" + targetHost
>> + ":"
>> - + targetPort + "/NameService" ;
>> - org.omg.CORBA.Object cosNamingServiceRef = null;
>> + if (cachedProvider == null) {
>> + String eplist = null ;
>> + if (myEnv != null) {
>> + eplist = (String)myEnv.get(IIOP_ENDPOINTSLIST) ;
>> + }
>>
>> - if( targetHost != null ) {
>> - cosNamingServiceRef = orb.string_to_object(
>> corbaloc ) ;
>> + org.omg.CORBA.Object objref = null;
>> + if (eplist != null) {
>> + objref = orb.string_to_object(eplist) ;
>> + } else if (targetHost != null) {
>> + String corbaloc = "corbaloc:iiop:1.2@" +
>> targetHost + ":"
>> + + targetPort + "/NameService" ;
>> + objref = orb.string_to_object( corbaloc ) ;
>> } else {
>> - cosNamingServiceRef =
>> orb.resolve_initial_references(
>> - "NameService");
>> + objref = orb.resolve_initial_references(
>> + "NameService");
>> }
>>
>> - SerialContextProvider tmpProvider =
>> - narrowProvider(cosNamingServiceRef);
>> + SerialContextProvider tmpProvider =
>> narrowProvider(objref);
>>
>> synchronized(SerialContext.class) {
>> cachedProvider = providerCache.get(key);
>> @@ -487,7 +504,7 @@
>> * be stores as a thread local variable.
>> *
>> */
>> - if (myEnv.get("com.sun.appserv.ee.iiop.endpointslist") !=
>> null) {
>> + if (myEnv.get(IIOP_ENDPOINTSLIST) != null) {
>> grabSticky() ;
>> }
>>
>> @@ -1232,8 +1249,7 @@
>> // Key is either orb OR host/port combo.
>> private ORB orb;
>>
>> - private String host;
>> - private String port;
>> + private String endpoints ;
>>
>> ProviderCacheKey(ORB orb) {
>> this.orb = orb;
>> @@ -1241,13 +1257,16 @@
>>
>> // Host and Port must both be non-null
>> ProviderCacheKey(String host, String port) {
>> - this.host = host;
>> - this.port = port;
>> + endpoints = host + ":" + port ;
>> + }
>> +
>> + ProviderCacheKey( String endpoints ) {
>> + this.endpoints = endpoints ;
>> }
>>
>> @Override
>> public int hashCode() {
>> - return (orb != null) ? orb.hashCode() : host.hashCode();
>> + return (orb != null) ? orb.hashCode() :
>> endpoints.hashCode();
>> }
>>
>> @Override
>> @@ -1259,8 +1278,9 @@
>> if( orb != null ) {
>> equal = (orb == otherKey.orb);
>> } else {
>> - if( (otherKey.host != null) &&
>> host.equals(otherKey.host)
>> - && port.equals(otherKey.port) ) {
>> + if( (otherKey.endpoints != null)
>> + && endpoints.equals(otherKey.endpoints)) {
>> +
>> equal = true;
>> }
>> }
>>
>> Modified:
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContextProviderImpl.java
>>
>> Url:
>> https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContextProviderImpl.java?view=diff&rev=41383&p1=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContextProviderImpl.java&p2=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContextProviderImpl.java&r1=41382&r2=41383
>>
>> ==============================================================================
>>
>> ---
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContextProviderImpl.java
>> (original)
>> +++
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialContextProviderImpl.java
>> 2010-10-05 18:06:56+0000
>> @@ -41,6 +41,7 @@
>> package com.sun.enterprise.naming.impl;
>>
>> import com.sun.enterprise.naming.util.LogFacade;
>> +import java.util.logging.Level;
>>
>> import javax.naming.Context;
>> import javax.naming.NamingException;
>> @@ -71,13 +72,13 @@
>> public Object lookup(String name)
>> throws NamingException, RemoteException {
>> try {
>> - _logger.fine(" SerialContextProviderImpl :: lookup " +
>> name);
>> + _logger.log(Level.FINE, " SerialContextProviderImpl ::
>> lookup {0}", name);
>>
>> return rootContext.lookup(name);
>> } catch (NamingException ne) {
>> throw ne;
>> } catch (Exception e) {
>> - _logger.severe("Exception occurred : " + e.getMessage());
>> + _logger.log(Level.SEVERE, "Exception occurred : {0}",
>> e.getMessage());
>> RemoteException re = new RemoteException("", e);
>> throw re;
>>
>>
>> Modified:
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialInitContextFactory.java
>>
>> Url:
>> https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialInitContextFactory.java?view=diff&rev=41383&p1=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialInitContextFactory.java&p2=trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialInitContextFactory.java&r1=41382&r2=41383
>>
>> ==============================================================================
>>
>> ---
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialInitContextFactory.java
>> (original)
>> +++
>> trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/SerialInitContextFactory.java
>> 2010-10-05 18:06:56+0000
>> @@ -42,6 +42,7 @@
>>
>> import com.sun.corba.ee.spi.folb.GroupInfoService;
>> import com.sun.logging.LogDomains;
>> +import java.util.ArrayList;
>> import org.glassfish.api.naming.NamingObjectsProvider;
>> import org.jvnet.hk2.component.Habitat;
>>
>> @@ -50,6 +51,7 @@
>> import javax.naming.spi.InitialContextFactory;
>> import javax.naming.spi.NamingManager;
>> import java.util.Hashtable;
>> +import java.util.List;
>> import java.util.concurrent.atomic.AtomicBoolean;
>> import java.util.logging.Level;
>> import java.util.logging.Logger;
>> @@ -58,10 +60,6 @@
>> import org.glassfish.internal.api.ORBLocator;
>> import org.omg.CORBA.ORB;
>> import org.omg.CORBA.ORBPackage.InvalidName;
>> -/**
>> - * Implements the JNDI SPI InitialContextFactory interface used to
>> create
>> - * the InitialContext objects. It creates an instance of the serial
>> context.
>> - */
>>
>> public class SerialInitContextFactory implements
>> InitialContextFactory {
>> public static final String LOAD_BALANCING_PROPERTY =
>> @@ -70,164 +68,222 @@
>> public static final String IIOP_ENDPOINTS_PROPERTY =
>> "com.sun.appserv.iiop.endpoints";
>>
>> - private static final String IIOP_URL = "iiop:1.2@";
>> -
>> - private static final String CORBALOC = "corbaloc:";
>> -
>> public static final String IC_BASED_WEIGHTED = "ic-based-weighted";
>>
>> public static final String IC_BASED = "ic-based";
>>
>> - protected static final Logger _logger = LogDomains.getLogger(
>> - SerialInitContextFactory.class, LogDomains.JNDI_LOGGER );
>> + public static final String IIOP_URL = "iiop:1.2@";
>>
>> - private static AtomicBoolean initialized = new
>> AtomicBoolean(false);
>> + public static final String CORBALOC = "corbaloc:";
>>
>> - private static String defaultHost;
>> - private static String defaultPort;
>> - private static Habitat defaultHabitat;
>> -
>> - private final Hashtable defaultEnv = new Hashtable() ;
>> - private final RoundRobinPolicy rrPolicy;
>> - private final boolean useLB ;
>> - private final Habitat habitat;
>> - private final GroupInfoServiceObserverImpl giso;
>> - private /* should be final */ GroupInfoService gis;
>>
>> - public RoundRobinPolicy getRRPolicy() {
>> - return rrPolicy;
>> + private static final RoundRobinPolicy rrPolicy ;
>> +
>> + private static final boolean useLB ;
>> +
>> + private static final AtomicBoolean initialized = new
>> AtomicBoolean(false);
>> +
>> + private static final Hashtable defaultEnv = new Hashtable() ;
>> +
>> + private static boolean propertyIsSet( String pname ) {
>> + String value = System.getProperty(pname) ;
>> + return value != null && !value.isEmpty() ;
>> }
>>
>> - public static String getCorbalocURL(Object[] list) {
>> + private static List<String> splitOnComma( String arg ) {
>> + final List<String> result = new ArrayList<String>() ;
>> + if (arg != null) {
>> + final String[] splits = arg.split( "," ) ;
>> + if (splits != null) {
>> + for (String str : splits) {
>> + result.add( str.trim() ) ;
>> + }
>> + }
>> + }
>>
>> - String corbalocURL = "";
>> - //convert list into corbaloc url
>> - for (int i = 0; i < list.length;i++) {
>> - _logger.log(Level.INFO, "list[i] ==> {0}", list[i]);
>> - if (corbalocURL.isEmpty()) {
>> - corbalocURL = IIOP_URL + ((String)list[i]).trim();
>> - } else {
>> - corbalocURL = corbalocURL + "," +
>> - IIOP_URL + ((String)list[i]).trim();
>> - }
>> - }
>> - _logger.log(Level.INFO, "corbaloc url ==> {0}", corbalocURL);
>> - return corbalocURL;
>> + return result ;
>> }
>>
>> - private String[] getEndpointList() {
>> - String[] list ;
>> - String[] commaDelimitedValues = null;
>> - String policy = null;
>> + private static String getEnvSysProperty( Hashtable env, String
>> pname ) {
>> + String value = (String)env.get( pname ) ;
>> + if (value == null) {
>> + value = System.getProperty( pname ) ;
>> + }
>> + return value ;
>> + }
>>
>> - // Get the load balancing policy
>> - String propertyValue = System.getProperty(
>> LOAD_BALANCING_PROPERTY);
>> + private static List<String> getEndpointList() {
>> + return getEndpointList( defaultEnv ) ;
>> + }
>>
>> - if (propertyValue != null) {
>> - commaDelimitedValues = propertyValue.split(",");
>> + private static List<String> getEndpointList( Hashtable env ) {
>> + final List<String> list = new ArrayList<String>() ;
>>
>> - if (commaDelimitedValues != null) {
>> - if (commaDelimitedValues[0].trim().equals(IC_BASED) ||
>> -
>> commaDelimitedValues[0].trim().equals(IC_BASED_WEIGHTED)) {
>> - policy = commaDelimitedValues[0];
>> + if (list.isEmpty()) {
>> + final String lbpv = System.getProperty(
>> LOAD_BALANCING_PROPERTY);
>> + final List<String> lbList = splitOnComma(lbpv) ;
>> + if (lbList.size() > 0) {
>> + final String first = lbList.remove( 0 ) ;
>> + if (first.equals(IC_BASED) ||
>> first.equals(IC_BASED_WEIGHTED)) {
>> + // XXX concurrency issue here: possible race on
>> global
>> + System.setProperty(LOAD_BALANCING_PROPERTY,
>> first );
>> }
>> }
>> + list.addAll( lbList ) ;
>> + }
>>
>> - if (policy != null) {
>> - System.setProperty(LOAD_BALANCING_PROPERTY, policy);
>> - }
>> + if (list.isEmpty()) {
>> + final String iepv = System.getProperty(
>> IIOP_ENDPOINTS_PROPERTY);
>> + final List<String> epList = splitOnComma(iepv) ;
>> + list.addAll( epList ) ;
>> }
>>
>> - propertyValue = System.getProperty( IIOP_ENDPOINTS_PROPERTY);
>> + if (list.isEmpty()) {
>> + final String urlValue = (String)env.get(
>> + ORBLocator.JNDI_PROVIDER_URL_PROPERTY) ;
>> + list.addAll( rrPolicy.getEndpointForProviderURL(
>> urlValue ) ) ;
>> + }
>>
>> - if (propertyValue==null || propertyValue.length()==0) {
>> - //do not use the defaults here as then we are not giving a
>> - //chance to the <policy>,host:port(,host:port)* type of
>> policy
>> - //specification
>> - list = null;
>> - } else {
>> - list = propertyValue.split(",");
>> + if (list.isEmpty()) {
>> + String host = getEnvSysProperty( env,
>> + ORBLocator.OMG_ORB_INIT_HOST_PROPERTY) ;
>> + String port = getEnvSysProperty( env,
>> + ORBLocator.OMG_ORB_INIT_PORT_PROPERTY) ;
>> +
>> + if (host != null && port != null) {
>> + list.addAll(
>> + rrPolicy.getAddressPortList(host, port) ) ;
>> + _logger.log(Level.WARNING, "no.endpoints.selected",
>> + new Object[] {host, port});
>> + }
>> }
>>
>> - //if the endpoints property was not specified, give a
>> - //chance to the <policy>,host:port(,host:port)* type of policy
>> - //specification
>> -
>> - if (list == null ) {
>> - if (commaDelimitedValues != null &&
>> commaDelimitedValues.length > 1) {
>> - list = new String[commaDelimitedValues.length-1];
>> - for (int i=0; i<list.length; i++) {
>> - list[i] = commaDelimitedValues[i+1];
>> - }
>> - } else {
>> - String host = System.getProperty(
>> - ORBLocator.OMG_ORB_INIT_HOST_PROPERTY ) ;
>> - String port = System.getProperty(
>> - ORBLocator.OMG_ORB_INIT_PORT_PROPERTY ) ;
>> - if (host != null && port != null) {
>> - list = new String[1];
>> - list[0] = host + ":" + port;
>> - }
>> + if (list.isEmpty()) {
>> + if (defaultHost != null && defaultPort != null) {
>> + list.add( defaultHost + ":" + defaultPort ) ;
>> }
>> }
>>
>> + if (list.isEmpty()) {
>> + _logger.log(Level.SEVERE, "no.endpoints");
>> + throw new RuntimeException("Cannot Proceed. No Endpoints
>> specified.");
>> + }
>> +
>> return list ;
>> }
>>
>> -
>> - private boolean propertyIsSet( String pname ) {
>> - String value = System.getProperty(pname) ;
>> - return value != null && !value.isEmpty() ;
>> + private static void doLog( Level level, String fmt, Object...
>> args ) {
>> + if (_logger.isLoggable(level)) {
>> + _logger.log( level, fmt, args ) ;
>> + }
>> }
>>
>> - public SerialInitContextFactory() {
>> - habitat = (defaultHabitat == null) ?
>> Globals.getDefaultHabitat() - : defaultHabitat;
>> + private static void fineLog( String fmt, Object... args ) {
>> + doLog( Level.FINE, fmt, args ) ;
>> + }
>>
>> + static {
>> useLB = propertyIsSet(IIOP_ENDPOINTS_PROPERTY)
>> || propertyIsSet(LOAD_BALANCING_PROPERTY) ;
>>
>> - gis = null ;
>> if (useLB) {
>> - String[] list = getEndpointList() ;
>> -
>> + List<String> list = getEndpointList() ;
>> rrPolicy = new RoundRobinPolicy(list);
>> -
>> - if (list != null && list.length > 0) {
>> - try {
>> - //fix for bug 6527987
>> - // passing the first endpoint for
>> ORBManager.getORB() to connect to
>> - //need to make NameService HA...what if first
>> endpoint is down.
>> - //need to address this issue.
>> - /* Properties props = new Properties();
>> - String hostPort = endpoint;
>> - // for IPv6 support, using lastIndex of ":"
>> - int lastIndex = hostPort.lastIndexOf(':');
>> - _logger.fine("hostPort = " + hostPort + "
>> lastIndex = " + lastIndex);
>> - _logger.fine("hostPort.substring(0, lastIndex) =
>> " + hostPort.substring(0, lastIndex));
>> - _logger.fine("hostPort.substring(lastIndex + 1)
>> = " + hostPort.substring(lastIndex + 1));
>> - props.put("org.omg.CORBA.ORBInitialHost",
>> hostPort.substring(0, lastIndex));
>> - props.put("org.omg.CORBA.ORBInitialPort",
>> hostPort.substring(lastIndex + 1));
>> - */
>> - gis = (GroupInfoService)
>> (getORB().resolve_initial_references(
>> - ORBLocator.FOLB_CLIENT_GROUP_INFO_SERVICE));
>> - } catch (InvalidName ex) {
>> - _logger.log(Level.SEVERE, null, ex);
>> - }
>> - }
>> } else {
>> rrPolicy = null ;
>> }
>> + }
>>
>> - if (gis != null) {
>> - giso = new GroupInfoServiceObserverImpl( gis, this );
>> + protected static final Logger _logger = LogDomains.getLogger(
>> + SerialInitContextFactory.class, LogDomains.JNDI_LOGGER );
>>
>> - gis.addObserver(giso);
>> + private static String defaultHost = null ;
>> +
>> + private static String defaultPort = null ;
>> +
>> + private static Habitat defaultHabitat = null ;
>> +
>> + public static RoundRobinPolicy getRRPolicy() {
>> + return rrPolicy;
>> + }
>> +
>> + static void setDefaultHost(String host) {
>> + defaultHost = host;
>> + }
>> +
>> + static void setDefaultPort(String port) {
>> + defaultPort = port;
>> + }
>> +
>> + static void setDefaultHabitat(Habitat h) {
>> + defaultHabitat = h;
>> +
>> + }
>> +
>> + static Habitat getDefaultHabitat() {
>> + return defaultHabitat;
>> + }
>> +
>> + private static String getCorbalocURL( final List<String> list) {
>> + final StringBuilder sb = new StringBuilder() ;
>> + boolean first = true ;
>> + for (String str : list) {
>> + if (first) {
>> + first = false ;
>> + sb.append( CORBALOC ) ;
>> + } else {
>> + sb.append( ',' ) ;
>> + }
>> +
>> + sb.append( IIOP_URL ) ;
>> + sb.append( str.trim() ) ;
>> + }
>> +
>> + fineLog( "corbaloc url ==> {0}", sb.toString() );
>> +
>> + return sb.toString() ;
>> + }
>>
>> - if (_logger.isLoggable(Level.FINE)) {
>> - _logger.log(Level.FINE, "getGIS: rrPolicy = {0}",
>> rrPolicy );
>> + private final Habitat habitat ;
>> +
>> + private final GroupInfoServiceObserverImpl giso ;
>> +
>> + private /* should be final */ GroupInfoService gis = null ;
>> +
>> + public SerialInitContextFactory() {
>> + habitat = (defaultHabitat == null) ?
>> Globals.getDefaultHabitat() + : defaultHabitat;
>> +
>> + if (useLB) {
>> + try {
>> + //fix for bug 6527987
>> + // passing the first endpoint for
>> ORBManager.getORB() to connect to
>> + //need to make NameService HA...what if first
>> endpoint is down.
>> + //need to address this issue.
>> + /* Properties props = new Properties();
>> + String hostPort = endpoint;
>> + // for IPv6 support, using lastIndex of ":"
>> + int lastIndex = hostPort.lastIndexOf(':');
>> + _logger.fine("hostPort = " + hostPort + " lastIndex
>> = " + lastIndex);
>> + _logger.fine("hostPort.substring(0, lastIndex) = " +
>> hostPort.substring(0, lastIndex));
>> + _logger.fine("hostPort.substring(lastIndex + 1) = "
>> + hostPort.substring(lastIndex + 1));
>> + props.put("org.omg.CORBA.ORBInitialHost",
>> hostPort.substring(0, lastIndex));
>> + props.put("org.omg.CORBA.ORBInitialPort",
>> hostPort.substring(lastIndex + 1));
>> + */
>> + gis = (GroupInfoService)
>> (getORB().resolve_initial_references(
>> + ORBLocator.FOLB_CLIENT_GROUP_INFO_SERVICE));
>> + } catch (InvalidName ex) {
>> + doLog(Level.SEVERE,
>> + "Exception in SerialInitContextFactory
>> constructor {0}",
>> + ex);
>> }
>> - } else {
>> +
>> + giso = new GroupInfoServiceObserverImpl( gis );
>> +
>> + gis.addObserver(giso);
>> +
>> + fineLog( "getGIS: rrPolicy = {0}", rrPolicy );
>> + } else {
>> giso = null ;
>> }
>> }
>> @@ -241,7 +297,6 @@
>> }
>> }
>>
>> - // XXX what should we do if result is null?
>> throw new RuntimeException( "Could not get ORB" ) ;
>> }
>>
>> @@ -251,158 +306,60 @@
>> @Override
>> @SuppressWarnings("unchecked")
>> public Context getInitialContext(Hashtable env) throws
>> NamingException {
>> - if( (defaultHost != null) &&
>> - (env.get(ORBLocator.OMG_ORB_INIT_HOST_PROPERTY) == null)) {
>> - env.put(ORBLocator.OMG_ORB_INIT_HOST_PROPERTY,
>> defaultHost);
>> - }
>> -
>> - if( (defaultPort != null) &&
>> - (env.get(ORBLocator.OMG_ORB_INIT_PORT_PROPERTY) == null)) {
>> - env.put(ORBLocator.OMG_ORB_INIT_PORT_PROPERTY,
>> defaultPort); - }
>> + final Hashtable myEnv = env == null ? new Hashtable() : env ;
>>
>> // Use Atomic look to ensure only first thread does
>> NamingObjectsProvider
>> - // initialization.
>> + // initialization. This cannot be static because we need
>> the env
>> + // argument passed to getInitialContext.
>> // TODO Note that right now the 2nd, 3rd. etc. threads will
>> proceed
>> // past here even if the first thread is still doing its
>> getAllByContract
>> // work. Should probably change the way this works to
>> eliminate that
>> // time window where the objects registered by
>> NamingObjectsProvider
>> // aren't available.
>> - if( !initialized.get() ) {
>> - boolean firstToInitialize =
>> initialized.compareAndSet(false, true);
>> -
>> - if (firstToInitialize) {
>> - // this should force the initialization of the
>> resources providers
>> - if (habitat!=null) {
>> - for (NamingObjectsProvider provider :
>> -
>> habitat.getAllByContract(NamingObjectsProvider.class)) {
>> - // no-op
>> - }
>> + final boolean firstToInitialize = initialized.compareAndSet(
>> false, true ) ;
>> + if (firstToInitialize) {
>> + // this should force the initialization of the resources
>> providers
>> + if (habitat!=null) {
>> + for (NamingObjectsProvider provider :
>> +
>> habitat.getAllByContract(NamingObjectsProvider.class)) {
>> + // no-op
>> }
>> }
>>
>> - String policy = null;
>> -
>> if (useLB) {
>> - if (env == null) {
>> - env = defaultEnv;
>> - }
>> -
>> - Object [] list;
>> -
>> - Context ctx = SerialContext.getStickyContext() ;
>> - if (ctx != null) {
>> - return ctx ;
>> - }
>> -
>> - //get next version of the randomized list using
>> round robin algo
>> - list = rrPolicy.getNextRotation();
>> -
>> - if (_logger.isLoggable(Level.FINE)) {
>> - _logger.log(Level.FINE, "getInitialContext:
>> rrPolicy = {0}",
>> - rrPolicy );
>> + final List<String> epList = getEndpointList( myEnv ) ;
>> + if (!epList.isEmpty()) {
>> + rrPolicy.setClusterInstanceInfoFromString(epList);
>> }
>>
>> - String corbalocURL = getCorbalocURL(list);
>> -
>> - env.put("com.sun.appserv.ee.iiop.endpointslist",
>> CORBALOC + corbalocURL);
>> - env.put(ORBLocator.JNDI_CORBA_ORB_PROPERTY, getORB());
>> -
>> - //user can specify the load balancing policy and
>> endpoints
>> - // via env. Hence the logic below.
>> -
>> - String propertyValue = (String) env.get(
>> - LOAD_BALANCING_PROPERTY);
>> - String[] commaDelimitedValues = null;
>> - String host = null;
>> - String port = null;
>> -
>> - if (propertyValue != null) {
>> - commaDelimitedValues = propertyValue.split(",");
>> -
>> - if (commaDelimitedValues != null) {
>> - if
>> (commaDelimitedValues[0].trim().equals(IC_BASED) ||
>> -
>> commaDelimitedValues[0].trim().equals(IC_BASED_WEIGHTED)) {
>> - policy = commaDelimitedValues[0];
>> - }
>> - }
>> -
>> - if (policy != null) {
>> - System.setProperty(LOAD_BALANCING_PROPERTY,
>> policy);
>> - }
>> - }
>> -
>> - propertyValue = (String)
>> env.get(IIOP_ENDPOINTS_PROPERTY);
>> + giso.membershipChange();
>> + }
>> + }
>>
>> - String [] temp_list =
>> - (propertyValue == null || propertyValue.length()
>> == 0)
>> - ? null
>> - : propertyValue.split(",");
>> -
>> - if (temp_list == null || temp_list.length == 0) {
>> - if (commaDelimitedValues != null) {
>> - temp_list = new
>> String[commaDelimitedValues.length - 1];
>> -
>> - for (int i=0; i<temp_list.length; i++) {
>> - temp_list[i] = commaDelimitedValues[i+1];
>> - }
>> - }
>> - }
>> + if (useLB) {
>> + Context ctx = SerialContext.getStickyContext() ;
>> + if (ctx != null) {
>> + return ctx ;
>> + }
>>
>> - //if endpoints property is not set by commandline or
>> via env
>> - // check for JNDI provider url
>> - // else use ORB host:port value
>> - if ((System.getProperty(IIOP_ENDPOINTS_PROPERTY) ==
>> null) &&
>> - (temp_list == null || temp_list.length == 0)) {
>> - if
>> (env.get(ORBLocator.JNDI_PROVIDER_URL_PROPERTY) != null) {
>> - temp_list = rrPolicy.getEndpointForProviderURL(
>> -
>> (String)env.get(ORBLocator.JNDI_PROVIDER_URL_PROPERTY));
>> - }
>> -
>> - if (temp_list == null || temp_list.length == 0) {
>> - if (env.get(
>> ORBLocator.OMG_ORB_INIT_HOST_PROPERTY) != null &&
>> - env.get(
>> ORBLocator.OMG_ORB_INIT_PORT_PROPERTY) != null) {
>> - host = (String)env.get(
>> - ORBLocator.OMG_ORB_INIT_HOST_PROPERTY);
>> - port = (String)env.get(
>> - ORBLocator.OMG_ORB_INIT_PORT_PROPERTY);
>> - } else {
>> - host = System.getProperty(
>> - ORBLocator.OMG_ORB_INIT_HOST_PROPERTY);
>> - port = System.getProperty(
>> - ORBLocator.OMG_ORB_INIT_PORT_PROPERTY);
>> - }
>> -
>> - if (host != null && port != null) {
>> - temp_list =
>> rrPolicy.getAddressPortList(host, port);
>> - _logger.log(Level.WARNING,
>> "no.endpoints.selected",
>> - new Object[] {host, port});
>> - } else {
>> - _logger.log(Level.SEVERE, "no.endpoints");
>> - throw new RuntimeException("Cannot
>> Proceed. No Endpoints specified.");
>> - }
>> - }
>> - }
>> + List<String> rrList = rrPolicy.getNextRotation();
>> + fineLog( "getInitialContext: rrPolicy = {0}", rrPolicy );
>>
>> - if (giso == null) {
>> - _logger.warning("Cannot obtain
>> GroupInfoServiceObserverImpl");
>> - }
>> + String corbalocURL = getCorbalocURL(rrList);
>>
>> - //add the list after randomising it to the circular
>> list in rrPolicy
>> - if (temp_list != null && temp_list.length > 0) {
>> - rrPolicy.setClusterInstanceInfo(temp_list);
>> - }
>> + myEnv.put("com.sun.appserv.ee.iiop.endpointslist",
>> corbalocURL);
>> + myEnv.put(ORBLocator.JNDI_CORBA_ORB_PROPERTY, getORB());
>> + } else {
>> + if (defaultHost != null) {
>> + myEnv.put( ORBLocator.OMG_ORB_INIT_HOST_PROPERTY,
>> defaultHost ) ;
>> + }
>>
>> - if (giso != null) {
>> - //need to get the list of cluster instances the
>> very first time a context is created
>> - giso.membershipChange();
>> - } else {
>> - _logger.warning("Cannot obtain
>> GroupInfoServiceObserverImpl");
>> - }
>> + if (defaultPort != null) {
>> + myEnv.put( ORBLocator.OMG_ORB_INIT_PORT_PROPERTY,
>> defaultPort ) ;
>> }
>> }
>>
>> - return createInitialContext(env != null ? env : defaultEnv);
>> + return createInitialContext(myEnv);
>> }
>>
>> private Context createInitialContext(Hashtable env) throws
>> NamingException
>> @@ -419,21 +376,4 @@
>> return serialContext ;
>> }
>> }
>> -
>> - static void setDefaultHost(String host) {
>> - defaultHost = host;
>> - }
>> -
>> - static void setDefaultPort(String port) {
>> - defaultPort = port;
>> - }
>> -
>> - static void setDefaultHabitat(Habitat h) {
>> - defaultHabitat = h;
>> -
>> - }
>> -
>> - static Habitat getDefaultHabitat() {
>> - return defaultHabitat;
>> - }
>> }
>>
>> Modified:
>> trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java
>>
>> Url:
>> https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java?view=diff&rev=41383&p1=trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java&p2=trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java&r1=41382&r2=41383
>>
>> ==============================================================================
>>
>> ---
>> trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java
>> (original)
>> +++
>> trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/GlassFishORBManager.java
>> 2010-10-05 18:06:56+0000
>> @@ -49,6 +49,7 @@
>> import com.sun.corba.ee.spi.osgi.ORBFactory;
>> import com.sun.corba.ee.spi.orbutil.ORBConstants;
>> import com.sun.corba.ee.spi.orb.ORB ;
>> +import com.sun.corba.ee.impl.folb.InitialGroupInfoService ;
>>
>> import com.sun.logging.LogDomains;
>>
>> @@ -88,7 +89,7 @@
>>
>> public final class GlassFishORBManager {
>> static final Logger logger = LogDomains.getLogger(
>> - GlassFishORBManager.class, LogDomains.UTIL_LOGGER);
>> + GlassFishORBManager.class, LogDomains.CORBA_LOGGER);
>>
>> private static void fineLog( String fmt, Object... args ) {
>> if (logger.isLoggable(Level.FINE)) {
>> @@ -210,7 +211,8 @@
>> * All external orb/iiop access should go through orb-connector
>> module
>> */
>> GlassFishORBManager(Habitat h ) {
>> -
>> + fineLog( "GlassFishORBManager: Constructing
>> GlassFishORBManager: h {0}",
>> + h ) ;
>> habitat = h;
>>
>> iiopUtils = habitat.getComponent(IIOPUtils.class);
>> @@ -221,7 +223,6 @@
>> processType = processEnv.getProcessType();
>>
>> initProperties();
>> -
>> }
>>
>> /**
>> @@ -262,6 +263,10 @@
>> initORB(props);
>> }
>>
>> + if (processType == ProcessType.Server) {
>> + new InitialGroupInfoService( orb );
>> + }
>> +
>> iiopUtils.setORB(orb);
>>
>> return orb;
>> @@ -284,6 +289,9 @@
>> }
>>
>> private void initProperties() {
>> + fineLog( "GlassFishORBManager: initProperties: processType
>> {0}",
>> + processType ) ;
>> +
>> if( (processType == ProcessType.ACC) || (processType ==
>> ProcessType.Other) ) {
>> // No access to domain.xml. Just init properties.
>> // In this case iiopListener beans will be null.
>> @@ -415,21 +423,23 @@
>> +
>> CSIv2SSLTaggedComponentHandlerImpl.class.getName(),"dummy");
>>
>> - gmsClient = new IiopFolbGmsClient() ;
>> + if (processType == ProcessType.Server) {
>> + gmsClient = new IiopFolbGmsClient( habitat ) ;
>>
>> - if (gmsClient.isGMSAvailable()) {
>> - fineLog( "GMS available and enabled - doing EE
>> initialization");
>> + if (gmsClient.isGMSAvailable()) {
>> + fineLog( "GMS available and enabled - doing EE
>> initialization");
>>
>> - // Register ServerGroupManager.
>> - // Causes it to register itself as an ORBInitializer
>> - // that then registers it as
>> - // IOR and ServerRequest Interceptors.
>> - orbInitProperties.setProperty(
>> - ORBConstants.USER_CONFIGURATOR_PREFIX
>> - +
>> "com.sun.corba.ee.impl.folb.ServerGroupManager",
>> - "dummy");
>> + // Register ServerGroupManager.
>> + // Causes it to register itself as an ORBInitializer
>> + // that then registers it as
>> + // IOR and ServerRequest Interceptors.
>> + orbInitProperties.setProperty(
>> + ORBConstants.USER_CONFIGURATOR_PREFIX
>> + +
>> "com.sun.corba.ee.impl.folb.ServerGroupManager",
>> + "dummy");
>>
>> - fineLog( "Did EE property initialization");
>> + fineLog( "Did EE property initialization");
>> + }
>> }
>> }
>>
>> @@ -598,9 +608,13 @@
>>
>> rfm = (ReferenceFactoryManager)
>> orb.resolve_initial_references(
>> ORBConstants.REFERENCE_FACTORY_MANAGER);
>> +
>> + new InitialGroupInfoService( orb ) ;
>> }
>>
>> - gmsClient.setORB(orb) ;
>> + if (processType == ProcessType.Server) {
>> + gmsClient.setORB(orb) ;
>> + }
>>
>> // SeeBeyond fix for 6325988: needs testing.
>> // Still do not know why this might make any difference.
>>
>> Modified:
>> trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java
>>
>> Url:
>> https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java?view=diff&rev=41383&p1=trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java&p2=trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java&r1=41382&r2=41383
>>
>> ==============================================================================
>>
>> ---
>> trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java
>> (original)
>> +++
>> trunk/v3/orb/orb-iiop/src/main/java/org/glassfish/enterprise/iiop/impl/IiopFolbGmsClient.java
>> 2010-10-05 18:06:56+0000
>> @@ -1,7 +1,7 @@
>> /*
>> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
>> *
>> - * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights
>> reserved.
>> + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights
>> reserved.
>> *
>> * The contents of this file are subject to the terms of either the GNU
>> * General Public License Version 2 only ("GPL") or the Common
>> Development
>> @@ -70,13 +70,13 @@
>> import com.sun.enterprise.config.serverbeans.Server;
>> import com.sun.enterprise.config.serverbeans.Servers;
>> import com.sun.enterprise.ee.cms.core.CallBack;
>> +import java.net.InetAddress;
>> +import java.net.UnknownHostException;
>> import java.util.ArrayList;
>> -import org.glassfish.api.admin.ServerEnvironment;
>> import org.glassfish.config.support.GlassFishConfigBean;
>> import org.glassfish.config.support.PropertyResolver;
>> import org.glassfish.gms.bootstrap.GMSAdapter;
>> import org.glassfish.gms.bootstrap.GMSAdapterService;
>> -import org.jvnet.hk2.annotations.Inject;
>> import org.jvnet.hk2.component.Habitat;
>> import org.omg.CORBA.ORBPackage.InvalidName;
>>
>> @@ -91,17 +91,12 @@
>> LogDomains.getLogger(IiopFolbGmsClient.class,
>> LogDomains.CORBA_LOGGER);
>>
>> - @Inject
>> + private Habitat habitat;
>> +
>> private Domain domain ;
>>
>> - // Get my Server instance so we can find our cluster
>> - @Inject( name=ServerEnvironment.DEFAULT_INSTANCE_NAME )
>> private Server myServer ;
>>
>> - @Inject
>> - private Habitat habitat;
>> -
>> - @Inject( optional=true )
>> private GMSAdapterService gmsAdapterService ;
>>
>> private GMSAdapter gmsAdapter ;
>> @@ -116,19 +111,38 @@
>> }
>> }
>>
>> - public IiopFolbGmsClient() {
>> + public IiopFolbGmsClient( Habitat habitat ) {
>> + fineLog( "IiopFolbGmsClient: constructor: habitat {0}",
>> + habitat ) ;
>> + this.habitat = habitat ;
>> +
>> + gmsAdapterService =
>> habitat.getComponent(GMSAdapterService.class) ;
>> +
>> try {
>> - if (gmsAdapterService != null) {
>> - gmsAdapter = gmsAdapterService.getGMSAdapter() ;
>> + if (gmsAdapterService == null) {
>> + return ;
>> + }
>>
>> - fineLog( "IiopFolbGmsClient->: {0}", gmsAdapter );
>> + gmsAdapter = gmsAdapterService.getGMSAdapter() ;
>> + fineLog( "IiopFolbGmsClient: gmsAdapter {0}", gmsAdapter );
>>
>> - gis = new GroupInfoServiceGMSImpl() ;
>> + if (gmsAdapter != null) {
>> + domain = habitat.getComponent( Domain.class ) ;
>> + fineLog( "IiopFolbGmsClient: domain {0}", domain) ;
>>
>> + Servers servers = habitat.getComponent(Servers.class
>> ) ;
>> + fineLog( "IiopFolbGmsClient: servers {0}", servers );
>> +
>> + String instanceName =
>> gmsAdapter.getModule().getInstanceName() ;
>> + fineLog( "IiopFolbGmsClient: instanceName {0}",
>> instanceName );
>> +
>> + myServer = servers.getServer(instanceName) ;
>> + fineLog( "IiopFolbGmsClient: myServer {0}", myServer );
>> +
>> + gis = new GroupInfoServiceGMSImpl() ;
>> fineLog("IiopFolbGmsClient: IIOP GIS created");
>>
>> currentMembers = getAllClusterInstanceInfo() ;
>> -
>> fineLog( "IiopFolbGmsClient: currentMembers = ",
>> currentMembers ) ;
>>
>> gmsAdapter.registerFailureNotificationListener(this);
>> @@ -137,15 +151,14 @@
>>
>> fineLog( "IiopFolbGmsClient: GMS action factories
>> added");
>> } else {
>> + fineLog( "IiopFolbGmsClient: gmsAdapterService is
>> null") ;
>> gis = new GroupInfoServiceNoGMSImpl() ;
>> }
>>
>> } catch (Throwable t) {
>> _logger.log(Level.SEVERE, t.getLocalizedMessage(), t);
>> } finally {
>> - if(_logger.isLoggable(Level.FINE)) {
>> - _logger.log(Level.FINE, "IiopFolbGmsClient<-: {0}",
>> gmsAdapter );
>> - }
>> + fineLog( "IiopFolbGmsClient: gmsAdapter {0}", gmsAdapter
>> ) ;
>> }
>> }
>>
>> @@ -156,17 +169,15 @@
>> (org.omg.CORBA.Object) gis);
>> fineLog( ".initGIS: naming registration complete: {0}",
>> gis);
>>
>> - if (_logger.isLoggable(Level.FINE)) {
>> - gis = (GroupInfoService)orb.resolve_initial_references(
>> - ORBConstants.FOLB_SERVER_GROUP_INFO_SERVICE);
>> - List<ClusterInstanceInfo> lcii =
>> - gis.getClusterInstanceInfo(null);
>> - _logger.log(Level.FINE,
>> - "Results from getClusterInstanceInfo:");
>> - if (lcii != null) {
>> - for (ClusterInstanceInfo cii : lcii) {
>> - _logger.log(Level.INFO, cii.toString() );
>> - }
>> + // Just for logging
>> + GroupInfoService gisRef =
>> (GroupInfoService)orb.resolve_initial_references(
>> + ORBConstants.FOLB_SERVER_GROUP_INFO_SERVICE);
>> + List<ClusterInstanceInfo> lcii =
>> + gisRef.getClusterInstanceInfo(null);
>> + fineLog( "Results from getClusterInstanceInfo:");
>> + if (lcii != null) {
>> + for (ClusterInstanceInfo cii : lcii) {
>> + fineLog( cii.toString() );
>> }
>> }
>> } catch (InvalidName e) {
>> @@ -190,6 +201,7 @@
>> @Override
>> public void processNotification(final Signal signal) {
>> try {
>> + fineLog( "processNotification: signal {0}", signal ) ;
>> signal.acquire();
>> handleSignal(signal);
>> } catch (SignalAcquireException e) {
>> @@ -212,14 +224,10 @@
>>
>> private void handleSignal(final Signal signal) {
>> - if(_logger.isLoggable(Level.FINE)) {
>> - _logger.log(Level.FINE, -
>> "IiopFolbGmsClient.handleSignal: signal from: {0}",
>> - signal.getMemberToken());
>> - _logger.log(Level.FINE, -
>> "IiopFolbGmsClient.handleSignal: map entryset: {0}",
>> - signal.getMemberDetails().entrySet());
>> - }
>> + fineLog( "IiopFolbGmsClient.handleSignal: signal from: {0}",
>> + signal.getMemberToken());
>> + fineLog( "IiopFolbGmsClient.handleSignal: map entryset: {0}",
>> + signal.getMemberDetails().entrySet());
>>
>> if (signal instanceof PlannedShutdownSignal ||
>> signal instanceof FailureNotificationSignal) {
>> @@ -300,58 +308,105 @@
>> }
>>
>> private int resolvePort( Server server, IiopListener listener ) {
>> + fineLog( "resolvePort: server {0} listener {1}", server,
>> listener ) ;
>> +
>> IiopListener ilRaw = GlassFishConfigBean.getRawView(
>> listener ) ;
>> + fineLog( "resolvePort: ilRaw {0}", ilRaw ) ;
>> +
>> PropertyResolver pr = new PropertyResolver( domain,
>> server.getName() ) ;
>> + fineLog( "resolvePort: pr {0}", pr ) ;
>> +
>> String port = pr.getPropertyValue( ilRaw.getPort() ) ;
>> + fineLog( "resolvePort: port {0}", port ) ;
>> +
>> return Integer.parseInt(port) ;
>> }
>>
>> private ClusterInstanceInfo getClusterInstanceInfo( Server server,
>> Config config ) {
>> + fineLog( "getClusterInstanceInfo: server {0}, config {1}",
>> + server, config ) ;
>> +
>> + final String name = server.getName() ;
>> + fineLog( "getClusterInstanceInfo: name {0}", name ) ;
>>
>> - String name = server.getName() ;
>> - int weight = Integer.parseInt( server.getLbWeight() ) ;
>> + final int weight = Integer.parseInt( server.getLbWeight() ) ;
>> + fineLog( "getClusterInstanceInfo: weight {0}", weight ) ;
>>
>> - String host = server.getNodeAgentRef() ; // Is this correct?
>> + String host = server.getNode() ;
>> + if (host.equals("localhost")) {
>> + try {
>> + host = InetAddress.getLocalHost().getHostName() ;
>> + } catch (UnknownHostException exc) {
>> + fineLog( "getClusterInstanceInfo: caught exception
>> for localhost lookup {0}",
>> + exc ) ;
>> + }
>> + }
>> + fineLog( "getClusterInstanceInfo: host {0}", host ) ;
>>
>> - IiopService iservice = config.getIiopService() ;
>> - List<IiopListener> listeners = iservice.getIiopListener() ;
>> + final IiopService iservice = config.getIiopService() ;
>> + fineLog( "getClusterInstanceInfo: iservice {0}", iservice ) ;
>>
>> - List<SocketInfo> sinfos = new ArrayList<SocketInfo>() ;
>> + final List<IiopListener> listeners =
>> iservice.getIiopListener() ;
>> + fineLog( "getClusterInstanceInfo: listeners {0}", listeners ) ;
>> +
>> + final List<SocketInfo> sinfos = new ArrayList<SocketInfo>() ;
>> for (IiopListener il : listeners) {
>> - SocketInfo sinfo = new SocketInfo( host, il.getId(),
>> + SocketInfo sinfo = new SocketInfo( il.getId(), host,
>> resolvePort( server, il ) ) ;
>> sinfos.add( sinfo ) ;
>> }
>> + fineLog( "getClusterInstanceInfo: sinfos {0}", sinfos ) ;
>>
>> - ClusterInstanceInfo result = new ClusterInstanceInfo( name,
>> weight,
>> + final ClusterInstanceInfo result = new ClusterInstanceInfo(
>> name, weight,
>> sinfos ) ;
>> + fineLog( "getClusterInstanceInfo: result {0}", result ) ;
>>
>> return result ;
>> }
>>
>> private Config getConfigForServer( Server server ) {
>> + fineLog( "getConfigForServer: server {0}", server ) ;
>> +
>> String configRef = server.getConfigRef() ;
>> + fineLog( "getConfigForServer: configRef {0}", configRef ) ;
>> +
>> Configs configs = habitat.getComponent( Configs.class ) ;
>> + fineLog( "getConfigForServer: configs {0}", configs ) ;
>> +
>> Config config = configs.getConfigByName(configRef) ;
>> + fineLog( "getConfigForServer: config {0}", config ) ;
>> +
>> return config ;
>> }
>>
>> // For addMember
>> private ClusterInstanceInfo getClusterInstanceInfo( String
>> instanceName ) {
>> - Servers servers = habitat.getComponent( Servers.class ) ;
>> - Server server = servers.getServer(instanceName) ;
>> + fineLog( "getClusterInstanceInfo: instanceName {0}",
>> instanceName ) ;
>> +
>> + final Servers servers = habitat.getComponent( Servers.class ) ;
>> + fineLog( "getClusterInstanceInfo: servers {0}", servers ) ;
>>
>> - Config config = getConfigForServer( server ) ;
>> + final Server server = servers.getServer(instanceName) ;
>> + fineLog( "getClusterInstanceInfo: server {0}", server ) ;
>>
>> - return getClusterInstanceInfo( server, config ) ;
>> + final Config config = getConfigForServer( server ) ;
>> + fineLog( "getClusterInstanceInfo: servers {0}", servers ) ;
>> +
>> + ClusterInstanceInfo result = getClusterInstanceInfo( server,
>> config ) ;
>> + fineLog( "getClusterInstanceInfo: result {0}", result ) ;
>> +
>> + return result ;
>> }
>>
>> private Map<String,ClusterInstanceInfo>
>> getAllClusterInstanceInfo() {
>> - Cluster myCluster = myServer.getCluster() ;
>> - Config myConfig = getConfigForServer( myServer ) ;
>> + final Cluster myCluster = myServer.getCluster() ;
>> + fineLog( "getAllClusterInstanceInfo: myCluster {0}",
>> myCluster ) ;
>> +
>> + final Config myConfig = getConfigForServer( myServer ) ;
>> + fineLog( "getAllClusterInstanceInfo: myConfig {0}", myConfig
>> ) ;
>>
>> - Map<String,ClusterInstanceInfo> result =
>> + final Map<String,ClusterInstanceInfo> result =
>> new HashMap<String,ClusterInstanceInfo>() ;
>>
>> for (Server server : myCluster.getInstances()) {
>> @@ -359,12 +414,15 @@
>> result.put( server.getName(), cii ) ;
>> }
>>
>> + fineLog( "getAllClusterInstanceInfo: result {0}", result ) ;
>> return result ;
>> }
>>
>> class GroupInfoServiceGMSImpl extends GroupInfoServiceBase {
>> @Override
>> public List<ClusterInstanceInfo>
>> internalClusterInstanceInfo() {
>> + fineLog( "internalClusterInstanceInfo: currentMembers {0}",
>> + currentMembers ) ;
>> return new ArrayList<ClusterInstanceInfo>(
>> currentMembers.values() ) ;
>> }
>>
>> Modified: trunk/v3/pom.xml
>> Url:
>> https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/pom.xml?view=diff&rev=41383&p1=trunk/v3/pom.xml&p2=trunk/v3/pom.xml&r1=41382&r2=41383
>>
>> ==============================================================================
>>
>> --- trunk/v3/pom.xml (original)
>> +++ trunk/v3/pom.xml 2010-10-05 18:06:56+0000
>> @@ -135,7 +135,7 @@
>> <stax-api.version>1.0-2</stax-api.version>
>> <jsftemplating.version>2.0.4</jsftemplating.version>
>> <scales.version>1.3.1</scales.version>
>> - <glassfish-corba.version>3.1.0-b005</glassfish-corba.version>
>> + <glassfish-corba.version>3.1.0-b007</glassfish-corba.version>
>> <uc-pkg-client.version>1.122-38.2791</uc-pkg-client.version>
>>
>> <uc-pkg-bootstrap.version>1.122-38.2791</uc-pkg-bootstrap.version>
>>
>> Modified:
>> trunk/v3/security/ejb.security/src/main/java/com/sun/enterprise/iiop/security/SecIORInterceptor.java
>>
>> Url:
>> https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/security/ejb.security/src/main/java/com/sun/enterprise/iiop/security/SecIORInterceptor.java?view=diff&rev=41383&p1=trunk/v3/security/ejb.security/src/main/java/com/sun/enterprise/iiop/security/SecIORInterceptor.java&p2=trunk/v3/security/ejb.security/src/main/java/com/sun/enterprise/iiop/security/SecIORInterceptor.java&r1=41382&r2=41383
>>
>> ==============================================================================
>>
>> ---
>> trunk/v3/security/ejb.security/src/main/java/com/sun/enterprise/iiop/security/SecIORInterceptor.java
>> (original)
>> +++
>> trunk/v3/security/ejb.security/src/main/java/com/sun/enterprise/iiop/security/SecIORInterceptor.java
>> 2010-10-05 18:06:56+0000
>> @@ -53,6 +53,8 @@
>> //import com.sun.enterprise.util.ORBManager;
>> //import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;
>> import org.glassfish.enterprise.iiop.util.IIOPUtils;
>> +import org.glassfish.gms.bootstrap.GMSAdapter;
>> +import org.glassfish.gms.bootstrap.GMSAdapterService;
>> import org.jvnet.hk2.component.Habitat;
>> import org.omg.CORBA.ORB;
>>
>> @@ -68,7 +70,10 @@
>> }
>>
>> private Codec codec;
>> + private GMSAdapterService gmsAdapterService;
>> + private GMSAdapter gmsAdapter;
>> private Habitat habitat;
>> +
>> //private GlassFishORBHelper helper = null;
>> private ORB orb;
>> @@ -77,6 +82,12 @@
>> this.habitat = habitat;
>> //helper = habitat.getComponent(GlassFishORBHelper.class);
>> this.orb = orb;
>> + this.gmsAdapterService = habitat.getComponent(
>> GMSAdapterService.class ) ;
>> + if (this.gmsAdapterService==null) {
>> + this.gmsAdapter = null ;
>> + } else {
>> + this.gmsAdapter = gmsAdapterService.getGMSAdapter() ;
>> + }
>> }
>> public void destroy() {
>> @@ -113,23 +124,20 @@
>> + " " + iorInfo );
>> }
>>
>> - /*TODO:V3:Cluster uncomment later
>> - // just inject the GMSAdapterService, and check for null
>> - if (gmsAdapterService != null) {
>> + if (gmsAdapter != null) {
>> +
>> // If this app server instance is part of a dynamic cluster
>> (that is,
>> // one that supports RMI-IIOP failover and load balancing,
>> DO NOT
>> // create the CSIv2 components here. Instead, handle this
>> in the
>> // ORB's ServerGroupManager, in conjunctions with the
>> // CSIv2SSLTaggedComponentHandler.
>> return;
>> - }*/
>> + }
>>
>> if(_logger.isLoggable(Level.FINE)) {
>> _logger.log(Level.FINE, ".addCSIv2Components " );
>> }
>> -
>> - //ORB orb = helper.getORB();
>> int sslMutualAuthPort = getServerPort("SSL_MUTUALAUTH");
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commits-unsubscribe_at_glassfish-svn.dev.java.net
>> For additional commands, e-mail: commits-help_at_glassfish-svn.dev.java.net
>>
>>