Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/rmi/activation/ActivationGroupID.java
38918 views
/*1* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.rmi.activation;2627import java.rmi.server.UID;2829/**30* The identifier for a registered activation group serves several31* purposes: <ul>32* <li>identifies the group uniquely within the activation system, and33* <li>contains a reference to the group's activation system so that the34* group can contact its activation system when necessary.</ul><p>35*36* The <code>ActivationGroupID</code> is returned from the call to37* <code>ActivationSystem.registerGroup</code> and is used to identify38* the group within the activation system. This group id is passed39* as one of the arguments to the activation group's special constructor40* when an activation group is created/recreated.41*42* @author Ann Wollrath43* @see ActivationGroup44* @see ActivationGroupDesc45* @since 1.246*/47public class ActivationGroupID implements java.io.Serializable {48/**49* @serial The group's activation system.50*/51private ActivationSystem system;5253/**54* @serial The group's unique id.55*/56private UID uid = new UID();5758/** indicate compatibility with the Java 2 SDK v1.2 version of class */59private static final long serialVersionUID = -1648432278909740833L;6061/**62* Constructs a unique group id.63*64* @param system the group's activation system65* @throws UnsupportedOperationException if and only if activation is66* not supported by this implementation67* @since 1.268*/69public ActivationGroupID(ActivationSystem system) {70this.system = system;71}7273/**74* Returns the group's activation system.75* @return the group's activation system76* @since 1.277*/78public ActivationSystem getSystem() {79return system;80}8182/**83* Returns a hashcode for the group's identifier. Two group84* identifiers that refer to the same remote group will have the85* same hash code.86*87* @see java.util.Hashtable88* @since 1.289*/90public int hashCode() {91return uid.hashCode();92}9394/**95* Compares two group identifiers for content equality.96* Returns true if both of the following conditions are true:97* 1) the unique identifiers are equivalent (by content), and98* 2) the activation system specified in each99* refers to the same remote object.100*101* @param obj the Object to compare with102* @return true if these Objects are equal; false otherwise.103* @see java.util.Hashtable104* @since 1.2105*/106public boolean equals(Object obj) {107if (this == obj) {108return true;109} else if (obj instanceof ActivationGroupID) {110ActivationGroupID id = (ActivationGroupID)obj;111return (uid.equals(id.uid) && system.equals(id.system));112} else {113return false;114}115}116}117118119