KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > server > ss > spi > ASSocketFacadeUtils


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.server.ss.spi;
25
26 import com.sun.enterprise.server.PELaunch;
27 /**
28  * This utility class houses methods to get ASSocketServiceFacade
29  * @author Sivakumar Thyagarajan, Binod PG
30  * @since SJSAS 9.0
31  */

32 public class ASSocketFacadeUtils {
33     private static ASSocketServiceFacade _instance = null;
34     
35     public static ASSocketServiceFacade getASSocketService() {
36         try {
37             if(_instance == null) {
38                 String JavaDoc proxyClassName = "com.sun.enterprise.server.ss.ASSocketServiceProxy";
39                 Class JavaDoc socketServiceProxy = null;
40                 /* If the new classloader hierachy is switched on, use appserver-chain to load
41                    the class */

42                 if(Boolean.getBoolean(PELaunch.USE_NEW_CLASSLOADER_PROPERTY)) {
43                     socketServiceProxy = PELaunch.getAppServerChain().loadClass(proxyClassName);
44                 } else {
45                     socketServiceProxy = ASSocketFacadeUtils.class.getClassLoader().loadClass(proxyClassName);
46                 }
47                 _instance = (ASSocketServiceFacade)socketServiceProxy.newInstance();
48             }
49             return _instance;
50         } catch (Exception JavaDoc e) {
51             RuntimeException JavaDoc rte = new RuntimeException JavaDoc(e.getMessage());
52             rte.initCause(e);
53             throw rte;
54         }
55     }
56 }
57
Popular Tags