dev@glassfish.java.net

Re: About the IIOP access when appclient starting

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
Date: Thu, 02 Apr 2009 22:15:26 -0500

The way this works, in v2 at least, is rather involved.

It is possible that an app client will create an InitialContext itself.
In v2 the first InitialContext creation has some side-effects, storing
information about how to contact the server using IIOP if and when
required. So, the ACC creates an InitialContext during its
initialization to control those side-effects, based on the sun-acc.xml
configuration file.

The intent of the v2 naming implementation on the client side is to
defer contacting the server until such contact is actually required,
which could be triggered by annotations. That is why I asked if your
client contains annotations.

I suppose it is possible that the deferral logic is not working as
intended. I think in practice most app clients contact the server early
in their lifetimes, so for most users it would not be obvious if the
server were contacted earlier than absolutely necessary.

- Tim

Zhang Biyun wrote:
> Hi Tim,
>
> Thanks for paying attention to this.
>
> From the view of the AppContainer source, services(e.g. naming service)
> were intialized before the app client accesses resources on the
> back-end, whether the app client have annotations or not. Right?
>
> ---------------
> /**
> * Creates the InitialContext, initializes the ORB's transaction
> service,
> * and creates and establishes the switch's transaction manager.
> * @param iiopProperties Properties object used in creating the
> InitialContext
> * @return the InitialContext created
> * @throws NamingException for errors creating the InitialContext
> */
> public static InitialContext initializeNaming(Properties
> iiopProperties) throws NamingException {
> InitialContext result = new InitialContext(iiopProperties);
> :
> }
> ---------------
>
> Besides, the following situation is possible. It is that a client
> accesses web service using HTTP/HTTPS other than IIOP, and the client
> is executed by ACC, and the initialization of naming service is not
> necessary. Right?
>
> Is it the specification of ACC that the access of app client must use
> the protocol of IIOP? If so, the IIOP access is generated even when it
> accesses a web service by HTTP/HTTPS, and it is not possible to
> communicate by exceeding client request.
>
> Best Regards,
> Zhang Biyun
>
> Tim Quinn さんは書きました:
>
>> Does your app client have annotations to access back-end services?
>>
>> - Tim
>>
>> Zhang Biyun wrote:
>>
>>> Hello Tim,
>>>
>>> I have some questions about IIOP connection when executing a appclient
>>> in Applicaiton Client Container.
>>>
>>> When the appclient commmand starting, it seems that it goes to get
>>> a connection through the iiop port of the server instance without fail
>>> for the applicaiton program that seems not to need connection to
>>> service, especially naming sevice. Does it understand what necessity for
>>> you to exist? If so, could you tell me what necessity is?
>>>
>>> Moreover, could you change like no "without fail" and doing the iiop
>>> connection if necessary?
>>> The current state and this operation are thought that it is undesirable.
>>> The IIOP access is generated even when it accesses cluster with
>>> WebService, and it is not possible to communicate exceeding Proxy under
>>> the present situation.
>>>
>>> # It seems that InitialContext was generated in main processing
>>> # (com.sun.enterprise.appclient.Main) of the client container at
>>> # preInvoke(★1).
>>>
>>> ------------------------------------
>>> public class Main {
>>>
>>> public Main(String[] args){
>>>
>>> :
>>>
>>> String appMainClass = container.preInvoke(props); →★1
>>> cleanup.setAppContainer(container);
>>>
>>> :
>>> }
>>>
>>> }
>>>
>>> public class AppContainer
>>> {
>>>
>>> :
>>>
>>> /**
>>> * This is called by main before the actual main of the application
>>> * is invoked. It initializes the container and performs login for
>>> * the user.
>>> * @return the main class of the application.
>>> */
>>> (★1) public String preInvoke(Properties props) throws Exception {
>>> return preInvoke(initializeNaming(props) ,
>>> Thread.currentThread().getContextClassLoader());
>>> }
>>>
>>> :
>>> }
>>>
>>> }
>>> ------------------------------------
>>>
>>> Thanks,
>>> Zhang Biyun
>>>
>>>
>>>
>>>
>>
>>
>>
>
>