src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java

changeset 371
e324dfb90c9e
parent 158
91006f157c46
child 443
3c73273667ae
     1.1 --- a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java	Thu Nov 17 10:51:17 2011 -0800
     1.2 +++ b/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java	Wed Mar 28 02:50:50 2012 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -130,10 +130,23 @@
    1.11      private UtilSystemException utilWrapper = UtilSystemException.get(
    1.12                                                    CORBALogDomains.RPC_ENCODING);
    1.13  
    1.14 -    public static Util instance = null;
    1.15 +    private static Util instance = null;
    1.16  
    1.17      public Util() {
    1.18 -        instance = this;
    1.19 +        setInstance(this);
    1.20 +    }
    1.21 +
    1.22 +    private static void setInstance( Util util ) {
    1.23 +        assert instance == null : "Instance already defined";
    1.24 +        instance = util;
    1.25 +    }
    1.26 +
    1.27 +    public static Util getInstance() {
    1.28 +        return instance;
    1.29 +    }
    1.30 +
    1.31 +    public static boolean isInstanceDefined() {
    1.32 +        return instance != null;
    1.33      }
    1.34  
    1.35      // Used by TOAFactory.shutdown to unexport all targets for this

mercurial